About 10Mbit/100Mbit autonegotiation)
For proper work Ethernet module and phy have to work with the same speed/duplex settings.
Problem is that some of PHYs don’t have any wire or any other way how phy could directly inform MCU about changed parameters.
Only way is that MCU use MDC/MDIO communication for reading phy status. Unfortunately this reading is executed during Ethernet mode initialization only in case of MII interface. RMII use default setting is 100Mbit, full duplex.10Mbit speed is now used only in rare cases when very old infrastructure.
So, basic ways how to add support for autonegotiation is adding task with periodic reads (e.g. once per seccond) of phy status (we will get speed and duplex PHY settings).
Second issue is that kinetis enet module do not offer speed change in runtime for RMII. We have to disable this module (ENET_ECR- ETHEREN=0), set new speed (ENET_RCR-RMII_10T) and enable it again.
On base of new settings from PHY we should call ENET_shutdown() modify speed settings and call ENET_Init() again.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------