OpenEtherCATsociety / SOEM

Simple Open Source EtherCAT Master
Other
1.35k stars 686 forks source link

operational status of slave and cycle times #838

Closed sigurdrb closed 4 months ago

sigurdrb commented 4 months ago

Hi again (I think this will be my last question for a while. I'm sorry if I'm asking a lot of questions).

What is the correct way in SOEM to change the cycle time of the master? If I want to write outputs to the slave every 0.5s, what is the correct parameter to change? I tried experimenting with osal_usleep() and the ec_send_processdata() /ec_receive_processdata(), but that just caused errors on the slave.

nakarlsson commented 4 months ago

0.5s is to slow for the standard slave watchdog. The watchdog defaults to 100ms, if you don’t send data faster than 100ms the slaves will enter SafeOp + Error. Thats probably the issue you see. Check the slave manual on HowTo adjust the watchdog or send data faster.

https://github.com/OpenEtherCATsociety/SOEM/blob/master/test/linux/red_test/red_test.c

Above is a sample that also consider DC Synchronization, eg. you can make it simpler if DC Synchronization is not needed.

sigurdrb commented 4 months ago

Ok, I see. Thanks for the feedback!