
details
Prepare Xenomai 3 kernel
See full instruction at http://www.simplerobot.net/2019/12/xenomai-3-for-raspberry-pi-4.html
EtherCAT master
Get source code and example
git clone -b rpi4-xenomai-3 git://github.com/thanhtamh/soem-w5500-rpi.git
cd soem-w5500-rpi
chmod +x *.sh
./build.sh
And test
cd test/slaveInfo/
sudo ./slaveinfo wiz -map
Important notes
EtherCAT Master has been updated to SOEM 1.4.0. A full list of new features can be found at SOEM document link: https://openethercatsociety.github.io/doc/soem/
Note on SPI speed: The SPI bit rate is divided from GPU core frequency. For previous Raspberry pi revisions (0,1,2,3) the default core frequency is 250 Mhz. Therefore a divider of 16 will provide the spi speed of 15.625 Mhz.
wiznet_hw_config(16, 0, 0); //15.625 Mhz on previous rpi versions
With Raspberry pi 4, default core frequency is 500 Mhz, with the same divider value, spi speed is 2 times faster, e.i. a divider of 16 will provide the spi speed of 31.25 Mhz.
wiznet_hw_config(16, 0, 0); //31.25 Mhz on rpi4
GPU core frequency is a dynamic quantity, it can vary depending on system load, in order to prevent spi speed change during operation we can simply fix GPU core frequency by setting in /boot/config.txt file:
core_freq_min=500
core_freq=500
COMMENTS