EMAC8_MD_W - Communicating with Internal PHY Registers

Frozen Content

The following two sections detail how to write to and read from, an internal register in the connected PHY device respectively, when using the EMAC8_MD_W component.
 

Only one action – Read or Write – can be started at a time. If you give the command to both write to and read from an internal PHY register, the read command will be accepted and proceed, while the write command will be ignored.

Writing to a PHY Register

To write to an internal register of the PHY device:

  • Check the mdr bit of the STATUS register (STATUS.2). If the MD interface is ready for another action, this bit will be High. This check is an important one, as writing to either of the address registers (PHY_ADDR, REG_ADDR) or the data register (DAT_OUT) while a command is pending can give unexpected results.
  • Write the address of the PHY Controller device to the PHY_ADDR register.
  • Write the address of the internal PHY register that you wish to write to, to the REG_ADDR register.
  • Write the data that you wish to send to the addressed internal PHY register, into the DAT_OUT register.
  • Start the Write command by setting the rwr bit of the PHY_CMD register (PHY_CMD.0).

At the end of the transmission, the mdr bit in the STATUS register will go High, signifying that the MD interface is ready for the next operation. If you have enabled the imd bit in the Interrupt Enable register (IE.2), an internal interrupt flag for the MD interface will go High, generating an active interrupt output at the Controller's INT_O pin. The interrupt will be cleared when the STATUS register is read or the device is reset.

Reading from a PHY Register

To read from an internal register of the PHY device:

  • Check the mdr bit of the STATUS register (STATUS.2). If the MD interface is ready for another action, this bit will be High. This check is an important one, as writing to either of the address registers (PHY_ADDR, REG_ADDR) while a command is pending can give unexpected results
  • Write the address of the PHY Controller device to the PHY_ADDR register.
  • Write the address of the internal PHY register that you wish to read from, to the REG_ADDR register.
  • Start the Read command by setting the rrd bit of the PHY_CMD register (PHY_CMD.1).
  • Read the data received from the addressed internal PHY register, from the DAT_IN register.

At the end of the reception, the mdr bit in the STATUS register will go High, signifying that the MD interface is ready for the next operation. If you have enabled the imd bit in the Interrupt Enable register (IE.2), an internal interrupt flag for the MD interface will go High, generating an active interrupt output at the Controller's INT_O pin. The interrupt will be cleared when the STATUS register is read or the device is reset.

You are reporting an issue with the following selected text and/or image within the active document: