Hi,
I'm using the AM437x IDK and successfully ported the EtherCAT stack example to linux.
During development, I observed that initialization of the TLK105L PHYs only succeeded about 50% of the time. It think that this was caused by the initialization sequence in tiecbsp.c / bsp_pruss_mdio_init():
- Start MDIO state machine by calling MDIO_osDrvInit()
- Generate PHY reset using a GPIO (Board_phyReset())
As long as the reset pulse width is small enough like in the SYS/BIOS example (300µs), this doesn't seem to cause any problems. But because I was the sysfs interface to control the GPIO with linux, the reset pulse width was longer.
I fixed this problem by changing the squence:
- Make sure that MDIO is disabled (in case of a program restart)
- Generate PHY reset using a GPIO
- Start MDIO state machine by calling MDIO_osDrvInit()
Additionally, I observed an electrical problem during PHY reset:
The PHY address lsb gets determined by the signal level at the PHY's COL pin during reset. The first PHY has a pull-down resistor connected to this pin. Unfortunately, this pin is also connected to one of the RJ-45 connector LEDs which pulls the signal to an undefined voltage of about 1.4V. Therefore, the PHY address can incorrectly be set to 1.
The TI document SLVA531A (section 6) explains how to strap LED pins correctly to GND.
Ralf