Close

LAN9252-SPI adapter assembly and testing

A project log for EtherCAT servodrive

Free CoE (CAN over EtherCAT) CiA402 servodrive on STM32. For open motor controllers like ODrive, STMBL, or your next thing.

kubabudakubabuda 08/04/2021 at 14:150 Comments

Assembly

PCBs arrived from board house

lan9252spi_rev1

First one is already assembled. It is dirty from resin-based flux, but looks OK

lan9252spi_rev1_assembled

Connected to Ethernet port, and powered up. Nothing bad happened. Flashed with DIGIO ESI (EtherCAT Slave Info), restarted, opened Simple EtherCAT Explorer and looks it is working.

lan9252spi_rev1_bootup

Now to make it work with microcontroller.

Testing

Lets start with EasyCAT Arduino library on ATMega, using platformio

It is working. How stable is it? Turns out not very much. After random period up, usually few minutes, ESC is either disconnected from master or starts to spew garbage values. What could be wrong? First culprit is power that was supplied from 3V3 regulator on Arduino. Lets add another one, powered from separate USB cable. That worked. For convinience, to have only 1 USB cable connected, 5V line to separate regulator can be pulled from ISCP header

lan9252spi_rev1_arduino_first_try

BTW, turns out that LAN9252 lines are not 5V tolerant. Suprise, ESC is working entire time without issues, but is uncomfortably close to absolute maximum rating. Voltage level shifter fixes that.

lan9252spi_rev1_arduino_corrected

Now on to port that STM32F4 Discovery board. Built quick adapter using SPI1 pinout exposed on STMBL extension header. Problem with power supply repeats. 3V3 from EVB is not good, another USB cable just to power up ESC is needed.

lan9252spi_rev1_stm32f4disco

It is working too. But STMBL is using StdPeriph drivers. Time to ditch Arduino code and port SOES to SPL

Known issues

TLDR: dont build this version. It worked good enough for my use case (single node development), but if you think of using it for anything practical buy EasyCAT PRO or wait for something better.

Next step: make CoE stack work on new hardware

Discussions