Electronic – Connecting KSZ8863RLL to a MAC using RMII

macrmii

(Edited to ask further question about the MDIO/MDC pins.)

I'm adding a Lantronix xPico 250 to an embedded deivce to provide WiFi access. The device has an ARM based SOM which includes a PHY and there is also an external RJ45. The three are connected using a Microchip KSZ8663RLL 3-port switch.
The SOM's PHY is capacitively coupled to one of the PHYs on the switch, and the external RJ45 is connected to the other. These can communicate with each other no problem. The Lantronix xPico 250 supports an RMII interface so this is connected to the RMII port on the switch.
The RMII pins on the switch and the Lantronix are direcly mapped to each other by pin name. i.e. TX -> TX, RX -> RX.

It doesn't work though. I can access the xPico 250 wirelessly and accessing its internal webpages can see that the status of its ethernet link (eth0) is down. I don't have much else to go an at the moment.

I've checked the clock. The Lantronix xPico 250 expects a reference clock as an input which the switch is providing.

I've done some Googling and am aware that RMII isn't designed to work between two MACs. The datasheet for the Microchip switch refers to the RMII interface supporting both MAC and PHY modes but doesn't explain how to configure this. Every example reference design I've seen on the internet has it set up as a MAC. How can I be sure the switch is set up as an RMII PHY?

If it is actually a MAC and I'm connecting MAC to MAC, do I need to swap the signals round (ie. RX -> TX, TX -> RX etc)

Here's a schematic:
Schehmatic

Additional queestion about MDIO/MDC..
I have left the MDIO and MDC pins not connected/floating on the Lantronix. On reference designs the Lantronix has been connected to a PHY and they've been used. Is it possible that this is causing a problem? Should they generally be pulled up/down if not used?

Best Answer

Ok. I've finally got it working.

There were two issues: Firstly, the MDIO and MDC lines do need connecting from the Lantronix to the switch. I added a 1.5K pullup to the MDIO line and also pulled up SPISN (pin 39) to disable SPIQ.

Secondly, the Lantronix by default uses a PHY address of 0 when sending the read register commands over the MDIO/MDC. The two PHYs on the switch use addresses 1 and 2 so the switch was igoring them. The firmware in the factory-shipped Lantronix doesn't have scope for changing the PHY address but the latest firmware on their website (xPico200_1.9.0.1R4.signed.rom) does. I reconfigured the Lantronix to use PHY addr 1 and everything seems to work now.

eth0 link up, can ping etc..