OpenEtherCATsociety / SOEM

Simple Open Source EtherCAT Master
Other
1.31k stars 670 forks source link

How to synchronize on stm32? #857

Open PhamTuTai opened 1 day ago

PhamTuTai commented 1 day ago

Hello everyone. I have run the servo on linux based on the tutorial on the forum. However, according to red_test. We need to calculate PI to calculate the time delay. But this value is calculated in ns. Currently I am developing ethercat on stm32f7. I am not using RTOS. I want to ask if anyone on this forum has solved this time compensation problem? And if anyone has any idea how to handle this problem please let me know. Thanks everyone.

ArthurKetels commented 18 hours ago

There is no problem. You can do exactly the same on bare metal STM32f7 as on standard linux. The only thing you need to do is to adapt the OSAL and OSHW abstraction to your platform. Making a network driver is most of the work.

I have successfully implemented SOEM on 8bit 16bit and 32bit micro controllers without much fuss.

To be specific on your time keeping. EtherCAT has an internal time representation of 1ns. But the actual resolution is only 10ns. As long your hardware can support something with a few us resolution you are fine.