0
\$\begingroup\$

I am trying to use the ethernet PHY which comes with my Digilent Nexus 4 DDR, a Microchip LAN8720A (datasheet). I wrote a controller which lets me read and write values to the smi registers using the mdio and mdc signals. Now I need to be able to tell if I am running in 10 Mbps or 100 Mbps mode. Also whether I am in full or half duplex mode. It looks like register 1 (BASIC STATUS REGISTER) would contain this information. However, this register has bits 14-11 enabled. These bits accoring to my spec mean...

14 - 100BASE-TX Full Duplex

13 - 100BASE-TX Half Duplex

12 - 10BASE-T Full Duplex

11 - 10BASE-T Half Duplex

I suppose this is telling me what the phy can do, and not the speed of the current link established by the auto negotiation. There is also the auto negotiation advertisement register (reg 4) which has multiple modes enabled, and the link partner ability register (reg 5). This two shows all four modes being lit up.

How can I tell what speed / duplex mode my link is? Do I have to infer it by picking the intersection of the highest ability from the link partner ability register and auto negotiation advertisement register?

\$\endgroup\$
  • \$\begingroup\$ t quite sure what the LAN8720 does for you, but typically the whole thing would work like: * Both ends advertise the things they can do * you pick the speed you want and that the other side supports \$\endgroup\$ – Marcus Müller Jun 21 '18 at 11:55
  • \$\begingroup\$ You should be able to check the speed pretty reliably by measuring the receive clock frequency. That doesn't tell you the duplex mode, but who uses half duplex these days anyway. \$\endgroup\$ – alex.forencich Jun 25 '18 at 14:52
0
\$\begingroup\$

Yes, the basic status register indicates the PHY's capabilities. The register map shows that those bits are read-only.

The datasheet does tell you how to read the actual link speed:

Once auto-negotiation has completed, information about the resolved link can be passed back to the controller via the Serial Management Interface (SMI). The results of the negotiation process are reflected in the Speed Indication bits of the PHY Special Control/Status Register, as well as in the Auto Negotiation Link Partner Ability Register. The auto-negotiation protocol is a purely physical layer activity and proceeds independently of the MAC controller.

So you could take the highest common capability between what your PHY advertises and what its partner advertises, but it would be simpler and more reliable to look at the actual link status:

PHY Special Control/Status Register bits

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.