thanhtam-h / soem-w5500-rpi

Realtime ethercat master for Raspberry pi
GNU General Public License v3.0
218 stars 87 forks source link

Segmentation Fault with c++ #17

Closed AlSa-91 closed 4 years ago

AlSa-91 commented 4 years ago

Dear Tam I work with the RPI4 patched with your Xenomai version and C++. 1) Would you be so kind and add the "extern c++" flags to winznet.h so that others don't have the problem and have to search why their code doesn't compile because of linking? 2) In my code I cyclically (1ms) specify a position. If I use the standard ethernet controller, everything runs through. But since I want to use your module, I adapted my master with minimal changes, that wiz is the NIC. The problem is that the first time I run through here I get a segmentation fault after 1-2 seconds of motor operation. When I call it again it doesn't even get that far to run through the motor state machine and again and again I get the segmenatation fault. With the normal NIC this doesn't happen, but as you explain in your block, a driver has to be written first. But I lack the necessary know-how. For running code with standard NIC I use the current SOEM version, whereas with wiz I use your older version. Do you have any idea what might be causing this? Für den

3) Is it actually possible to copy the current SOEM version to your Version?

Thanks for your help.

thanhtam-h commented 4 years ago

The driver is written to adapt with SOEM, it should be in C to be compatible with SOEM. You can manual modify wiznet_drv.h for C++ if you need. The version for rpi4-xenomai is 1.4.0 which is latest SOEM version. In case you want to update, you can overwrite last soem directory from official repository. Remember, only sorm directory can be overwritten, do not copy other directories.