External MII interface to managed switch

Discussion to talk about hardware related topics only.
Post Reply
User avatar
asargent
Posts: 5
Joined: Mon Feb 09, 2009 6:43 am

External MII interface to managed switch

Post by asargent »

I have a managed switch that can be managed via MII or RMII. I understand that internally the Netburners talk MII to the internal PHYs, but I need the ability to talk to the external switch chip via MII to access the management registers. Has anyone done this already? Any recommendations on how to approach this?
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: External MII interface to managed switch

Post by lgitlitz »

If this is a higher volume product or you need to be sending network data through the switch then you should contact NetBurner sales about a custom design. If you are just looking just talk to the management interface to prototype a few units then you can hack on some jumper wires to the NetBurner PHY. These pins would be the MDIO ( MII management open-collector data I/O, Pin#1 of 8721 PHY ) and MDC ( MII management clock, Pin#2 of 8721 PHY ). One problem you may have is that the MDC signal is actively driven. If there is another device talking to the management interface of your switch you will need to put a selector to choose between the MDC signals. The MDIO should be OK to tie together since it is open-collector.

You also need to make sure that your other PHY/Switch has a different 4-bit address then the NetBurner PHY. This is usually configurable with hardware pull-up/down on the PHY pins. The Ethernet driver automatically scans all addresses to find the NetBurner PHY address, you can print this out using the "void ShowFECRegisters()" function from etherprint.cpp. Once you connect your device you can do something like the following to confirm that both PHYs are communicating at unique addresses:

Code: Select all

for(int i=0; i< 32; i++)
{
   WORD test = GetMII( i, 0x3); 
   if(test != 0xFFFF && test != 0x0 )
      iprintf("We found a PHY_ID = %X at address %X\r\n", test, i);
}


You should then be able to read or write to the PHY management registers of your switch with the following two functions:
DWORD GetMII( BYTE mii_dev, BYTE addr );
DWORD SetMII( BYTE mii_dev, BYTE addr, WORD value );
The mii_dev parameter is your 4-bit address we discovered in the code above.
The addr parameter is the address of the register you are looking to talk to

-Larry

edit: I forgot to mention, you will likely need to modify the NetBurner Ethernet driver so it does not interfere with the MII communication. The Ethernet driver is constantly polling the MII interface of the PHY to confirm there is an active link, and speed/duplex status. You probably only need to modify the ProcessDuplex function in Ethernet.cpp. Comment out any lines that write to the sim.fec.mii_data register, also change any lines that read from sim.fec.mii_data to be a constant. This will make the driver think that it always has a valid link but at least it will function.
User avatar
asargent
Posts: 5
Joined: Mon Feb 09, 2009 6:43 am

Re: External MII interface to managed switch

Post by asargent »

Thanks for the info! Looks pretty straight forward software wise. We are looking at doing this with the SB2Le, so we are checking pinouts etc.
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: External MII interface to managed switch

Post by lgitlitz »

Sorry I thought you were talking about any of the non-L2e platforms. The SBL2e is a completely different beast from the other network platforms, including the Ethernet driver. The Ethernet PHY is actually on-chip so there is no external MII communication. There are MII management signals multiplexed with the CAN signals so they can be brought out. Still I have never tried using any of the FEC signals externally with this processor. I do not know if setting these signals to be external would interfere with the signals internally routed to the on-chip PHY. Definitely will require some experimentation on this platform.
Post Reply