Day: November 30, 2016

Tips to get Ethernet working on NuttX

I want to share here my experience to get Ethernet working on Bambino 200E board. In fact after you realize what needs to be done life become easy.

Almost all microcontroller with Ethernet MAC needs an external PHY chip to convert its signal to the physical media’s signal (in the twister pair cable). Normally this PHY communicate with the microcontroller using MII (Media-Independent Interface) or RMII (Reduced Media-Independent Interface) protocol.

So the first thing you need to find is the PHY Address used for your board’s PHY. The Bambino 200E uses the Micrel KSZ8031RNL and because there is not a Pull-UP resistor in the CRS_DV/PHYAD[1:0] the PHY Address will be 0, then you need to define it in your configuration:


And since the KSZ8031 support Auto Negotiation to detect the Ethernet mode and speed you need to define it:


Now comes the trick part, you need to setup the PHYSR (Status Register). The PHYSR is basically the address of the register where the PHY informs about the Auto Negotiation status.

So initially you could think it is the Basic Status register (at 1h), but the Basic Status is used to inform which modes and speeds your Ethernet router/hub/switch supports.

The right register in in fact the “PHY Control 1” (1Eh = 30). See the Operation Mode Indication field bits (1E.2:0) :

[000] = still in auto-negotiation
[001] = 10Base-T half-duplex
[010] = 100Base-TX half-duplex
[011] = reserved
[100] = reserved
[101] = 10Base-T full-duplex
[110] = 100Base-TX full-duplex
[111] = reserved

So, we need to define the following configuration to get Ethernet working:


I spent almost a working day to get Ethernet working, if I was aware of the above information it should matter of few minutes to get everything working.