Hello,
I'm using the MIMXRT1170-EVK board with the MIMXRT1176 MCU.
I have an older project which was written with different SDK version where was some problem with ethernet. Nowdays I'm trying to make the program works but somehow I'm still getting into some infinite loop whenever I call the `netif_add()` function.
After some debugging I found out it always fails inside the PHY_KSZ8081_Init() function after this loop:
do
{
result = MDIO_Read(handle->mdioHandle, handle->phyAddr, PHY_ID1_REG,
®Value);
if (result != kStatus_Success)
{
return result;
}
counter--;
}
while ((regValue != PHY_CONTROL_ID1) && (counter != 0U));
if (counter == 0U)
{
return kStatus_Fail;
}
The bahaviour is:
- counter is always going down to 0
- regValue is always 65535 -> the do/while loop is checking for value PHY_CONTROL_ID1 which is 0x283
So the program (MDIO_Read() function) can't find value 0x283 on address handle->phyAddr (which is set to BOARD_ENET1_PHY_ADDRESS)
. Since it's trying to get the desired value 1000times, I wildly guess there might be something that takes time to setup / something with only probability to be set at some point in the program (but since it's hardware and not OTA apps I guess this theory isn't the right one but it might wait for some data and since it's initialization of ethernet, something may cause a delay? I have no idea honestly).
To provide more informations that might come handy since some of them were kinda hard to get working and might cause some struggle:
- The M7 core is running in Flash
- On this core is running only "hello world" example with setting LED into 1 and starting the second core.
- The M4 core is running in SDRAM
- IDE: MCUXpresso (so the latest SDK since it should update automatically)
- The PHY_KSZ8081_Init() is the ending function. It all starts with function netif_add()
I tried all the possible PHY addresses etc. but still can't figure out what am I missing or what might be the problem here. I'm pretty new to these NXP MCUs and Ethernet so it might be something really stupid but I have no idea what it is.