OpenEtherCATsociety / SOEM

Simple Open Source EtherCAT Master
Other
1.24k stars 653 forks source link

ec_FOEwrite: Allow sending a 0byte file to "clear" a slave file in file system, if file is present. #766

Closed nakarlsson closed 7 months ago

nakarlsson commented 7 months ago

Hi,

I got scenario where a customer try to "clear" a file in the slave filesystem if it exists by sending a 0 size file with given filename. Doing this will make the SOES FoE state machine end up in an error state since no DATA packet is sent. Seems SOEM ecx_FOEwrite doesn't support that out-of-the-box since it will not send the 0 size DATA packet due to the file line below. My suggestion was to add a SDO that would do this in a controlled way.

https://github.com/OpenEtherCATsociety/SOEM/blob/c5db2741ee131decd80c94b51afda5f947ce7f95/soem/ethercatfoe.c#L217

However, I can't find anything in the EtherCAT specification that would disallow sending a 0 byte file, To solve this one would initialize dofinalzero to TRUE and it would work as expected.

Any thoughts?