ioLibrary_Driver icon indicating copy to clipboard operation
ioLibrary_Driver copied to clipboard

Fix the W5500 PHY configuration

Open brianrho opened this issue 1 year ago • 0 comments

Not sure there's any activity still happening in this repo, so this is more for anyone else who runs into the same PHY configuration issue.

This commit fixes the following:

  • Whenever the application specifies PHY_MODE_AUTONEGO in the wizphy_setphyconf argument, the function would unconditionally configure the PHY for "All Modes Capable". This is not quite in line with the datasheet, which permits 100BT+HDX to be paired with Auto-Negotiation.
  • PHYCFGR_OPMDC_100FA seems to have been misnamed all this time -- it should've been called PHYCFGR_OPMDC_100HA since the Auto-negotiation is paired with 100BT-HDX, not 100BT-FDX.
  • When reading the current PHY conf in wizphy_getphyconf, the above misnaming meant that the function would incorrectly return 100BT-FDX + Auto-nego, when the real conf is actually 100BT-HDX + Auto-Nego.
  • Avoid unintentional PHY reset when setting the configuration -- this is done by masking all but the RST bit of the PHYCFGR, when assembling the bits for the requested configuration.

brianrho avatar Jan 24 '23 02:01 brianrho