[etherlab-users] Making the LED stay on in the "user" example

matthieu bec mbec at gmto.org
Thu Feb 20 23:35:26 CET 2014


Hi Allan,

Even if doing nothing, running cyclically will get you feedback your 
communication and devices are somewhat healthy, and let you take action 
if not.
Note what really matters is the sending part more than the 
writing/updating. you could find smart ways when to make changes, but on 
the other hand doing the same thing every cycle will help keep your 
cycle time constant, which might be more important in some application.

disable watchdog, I haven't actually tried, but something like that:

static ec_sync_info_t el2004_syncs[] = {
     {0, EC_DIR_OUTPUT, 4, el2004_pdos, EC_WD_DISABLED},
     {1, EC_DIR_INPUT},
     {0xff}
};

There is also a register on your slave you can poke to change timeout value.

Matthieu


On 20/02/14 13:41, Allan Brighton wrote:
>
> Hi Matthieu,
>
> To stop writing I set a flag when the operational state was reached and
> the LED was on.
> I suspected it might be the watchdog timeout, since I saw that mentioned
> somewhere, but
> I didn't find it in the documentation. Now it makes sense.
>
> So is the usual way of doing things to have a cyclic routine that always
> writes the same
> values (assuming they haven't changed)? And how do you set watchdog_mode
> to EC_WD_DISABLE?
>
> Thanks,
> Allan
>
> On 20/02/2014 20:42, Matthieu Bec wrote:
>> Hello Allan,
>>
>> What do you mean by `stop writing`, stopping the cyclic task?
>> Slaves usually drop off OP state if they stop receiving frames, yours
>> might default itself to an Off state that could explain the issue.
>> Try explicitly setting the watchdog_mode to EC_WD_DISABLE in your
>> sync_info_t.
>>
>> Matthieu
>>
>>
>> On 2/20/14, 10:10 AM, Allan Brighton wrote:
>>>
>>> Hi all,
>>>
>>> I'm new to EtherCat and EtherLab and I modified examples/user/main.c to
>>> work with the devices I have for testing: (EK1100, EL2202, EL1252,
>>> EL2252).
>>> Everything works and the LED I attached to the EL2202 turns on and off,
>>> however the code is using a timer and constantly setting the output
>>> value to 1 or 0 (on or off).
>>> Why can't you just set the value to 1 once and have the LED stay on?
>>> Even if I wait until the slave reaches the operational state, the LED
>>> just blinks once when set to 1,
>>> but doesn't stay on, unless the value is constantly updated.  What am I
>>> missing?
>>>
>>> Thanks,
>>> Allan
>>>
>>> _______________________________________________
>>> etherlab-users mailing list
>>> etherlab-users at etherlab.org
>>> http://lists.etherlab.org/mailman/listinfo/etherlab-users
>>
> _______________________________________________
> etherlab-users mailing list
> etherlab-users at etherlab.org
> http://lists.etherlab.org/mailman/listinfo/etherlab-users


-- 
Matthieu Bec                GMTO Corp
cell : +1 626 354 9367      251 S Lake Ave, Suite 300
phone: +1 626 204 0527      Pasadena, CA 91101



More information about the Etherlab-users mailing list