The RT-THREAD eth_driver has no error, but when dealing with the LAN8720 transceiver it happens that using a direct cable connection with a PC all is working well, but when using an intermediate hub or switch the auto-enumeration process fails and the embedded ethernet devic e is always recognised as hal-duplex.
There is a bug in the ST driver, whose code is not portable and makes a reference to the wrong register ( i.e. not a LAN8720 register )
I changed the parameters but no success yet.
Something more needs to be understood.
/* Configure the MAC with the Duplex Mode fixed by the auto-negotiation process */
if((phyreg & PHY_DUPLEX_STATUS) == PHY_DUPLEX_STATUS) // != (uint32_t)RESET)
{
/* Set Ethernet duplex mode to Full-duplex following the auto-negotiation */
(heth->Init).DuplexMode = ETH_MODE_FULLDUPLEX;
}
...
// ARE THESE PARAMETERS SET FOR LAN8720A ?
// ORIGINALLY IT WAS 0x10 -> NOW 0x1F
// #define PHY_SPEED_STATUS ((uint16_t)0x0002U) /!< PHY Speed mask /
// #define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask
-> #define PHY_SR ((uint16_t)0x001FU) /!< PHY special status register Offset /
-> #define PHY_SPEED_STATUS ((uint16_t)0x0004U) /!< PHY Speed mask /
-> #define PHY_DUPLEX_STATUS ((uint16_t)0x0010U) /!< PHY Duplex mask /