Hi,
I am using ZC702 demo board. I want to make ethernet communication using auto-negation. but I saw that the “get_ieee_phy_speed” function always returns the speed as 10Mbit. To find the speed, register address 17 is read. However, as far as I understand, address 17 is a vendor specific address. I think there is a mistake here. Can’t we read from standard register addresses here?
Is your board/DUT directly connected to PC/laptop?
Can you take a look at this related issue here: FreeRTOS-Plus-TCP PHY autonegotiate setup, and see if your case is similar?
If we want an autoneg that works with all phys, we should only use the first 16 registers because they are the standard ones. As far as I can see, phys write their capabilities to the standard registers by default. Therefore, just starting the autoneg process and doing a soft reset is enough for autoneg. A vendor specific code was written using registers after 16 in the Zynq port. Those registers should not be used.
XEmacPs_PhyRead( xemacpsp, phy_addr, IEEE_CONTROL_REG_OFFSET, &control );
control |= IEEE_CTRL_AUTONEGOTIATE_ENABLE;
control |= IEEE_STAT_AUTONEGOTIATE_RESTART;
XEmacPs_PhyWrite( xemacpsp, phy_addr, IEEE_CONTROL_REG_OFFSET, control );
XEmacPs_PhyRead( xemacpsp, phy_addr, IEEE_CONTROL_REG_OFFSET, &control );
control |= IEEE_CTRL_RESET_MASK;
XEmacPs_PhyWrite( xemacpsp, phy_addr, IEEE_CONTROL_REG_OFFSET, control );
After this stage, we can first check if the reset is complete and then if the autoneg is complete. Then, the partner’s abilities can be learned from the 5th and 10th registers.
Thank you for sharing this. If you are interested in contributing this change to FreeRTOS+TCP please feel free to raise a PR in Github.