What I made with LAN9252 for SPS Nuremberg 2016 (controller is RPi3)
For the 2017 show (controller is i.MX6):
The slave stack code for the 2016 demo didn't use the SSC, it used a minimal implementation that did PDO in Freerun as I didn't have access to the conformance test tool at the time. By the 2017 demo I have switched to a heavily modified SSC that passes all the tests. As well as DC sync so that all inverter PWM cycles for all drives are in sync.
Things to keep in mind:
* You need an SII in the EEPROM that is good enough to boot the LAN9252, otherwise not even the 0x12345678 test read register would work as the entire chip won't boot. This is one of among many WTF worthy design decisions Microchip made.
* Don't let the claim of fast SPI bus fool you. The insane register indirect access scheme completely nullifies the high clock frequency advantage as you have to constantly baby the SPI bus for even simple int32 register reads.
* Comment out stuff to do with timeouts in the SSC (and comment out most of the SSC except for the ESM portion) and run the thing in a main() while(1) loop. Start simple, slowly uncomment as your unit tests reach those area.
* The SSC does not give a complete implementation example for the CoE part. Especially with Object Dictionary access. You need to write your own SDO access calls.
* It really helps if you had experience implementing the CANopen stack.
* Get your hand on the official test tool or at least tools like
https://sourceforge.net/projects/ethercat-explorer/ that generate simple test commands. With protocol development initially you will be doing a lot of whack-a-mole with unit test failures. You need a proper test tool, TwinCAT is not that tool.
* While Beckhoff claims that EtherCAT is a free standard that applies only if you don't sell EtherCAT products. To sell EtherCAT products they must be tested against the CTT and that has an annual subscription fee. The real rub is if you stop paying the subscription you must recall your existing products from the market.
At the end I only kept the Mailbox and ESM AL part of SSC, everything else was custom. For extra points in masochism I am using a C2000 based MCU where a single char in 16bits. As comparison in complexity - excluding the low level Object Dictionary access which is shared with the EtherCAT stack my CANopen stack was >2k lines of code. The EtherCAT equivalent is about 3x that.