Premium Content

New Signal Chain Resources from Texas Instruments:

Use The MDIO Bus To Interrogate Complex Devices

Date Posted: December 03, 2001 12:00 AM

MDIO extended frame format: The master communicates with the slave via MDIO frames. The specification provides for four types of frames.

To read or write a register in a specific MMD on a given port, the master (STA) opens the register by issuing an address frame with the port.device.register address. The selected MMD latches onto the address, and then the STA issues a read, write, or read-address-increment frame.

For the write operation, the STA provides the valid data in the frame. For read operations, the STA three-states the MDIO line, and the MMD sources the data. For the read-address-increment, the MMD supplies the data as in Figure 4a, yet increments its address register and will be ready for the next read or read-address-increment command. If the address register contains 0FFFFh, it won't roll over to 0. The frame formats of the various frames are shown in Figures 4a to 4e, and the terminology is described in Figure 4f.

An MDIO example: Vitesse's VSC7226 is a good example of an MDIO interface because it uses a clean method to access more than 32-by-32 registers. This is accomplished via a banking register. The device supports four identical bidirectional channels. Dedicated pins can configure these channels, or individual channels can be configured via the MDIO configuration port.

Implementing an MDIO with a general-purpose controller: An MDIO STA is commonly seen implemented in the host CPU, such as a PowerPC or an FPGA. If the ASIC is doing the "housekeeping" and needs to interrogate the board status, the MDIO MMD may be implemented in a general-purpose microcontroller. The STA can be implemented in just about any microcontroller. But the MMD needs a controller that's fast enough to respond in 300 ns. For convenience, we describe the implementation in Ubicom's SX52/IP2K flash microcontrollers because later on, the article discusses the possibility of interfacing to the TCP/IP stack, and remotely interrogating the system over the Internet.

Implementing the MDIO STA:> This is easier as there's full control over the clock. The pseudo code in Listing 1 describes the process.

Implementing the MDIO MMD: This is a bit more difficult because the device must respond to the clock from the STA. Typically, the clock line would drive the microcontroller's hardware-interrupt pin. When a transition is detected, the MDIO state machine would begin. The implementation is very platform specific. Listing 2 shows a partial pseudo C code.

Internet connectivity to the MDIO STA: One in-teresting possibility is to incorporate the TCP/IP stack provided by Ubicom, and route the data through to the MDIO module. The limitation of this solution is that a designer can only implement the STA, as using an external interrupt complicates this method.

In the solution shown in Figure 5, the MDIO and TCP/IP stack are implemented in a single-chip microcontroller. A user with proper access rights can interrogate the MMDs in a switch, or a router over the Web.

So, the MDIO is a simple yet very efficient bus. The information contained in this article should prepare designers to implement the MDIO bus in a low-cost microcontroller. With the advent of the Internet, interfacing the MDIO to the TCP/IP stack yields a very effective and practical way to interrogate a remote device. The best part is that this solution doesn't add much cost to the managed device.

Management Data Input/Output | MDIO Bus | microcontrollers
Part Inventory
Go
powered by:
 

 
You must log on before posting a comment.

Are you a new visitor? Register Here
    There are no comments to display. Be the first one!