Dear Nxp, Dear community,
our system uses the lwip port from SDK 2.4.1 and regarding this issue we saw no change to newer SDK 2.5.
The problem is the following:
When our system has no ethernet cable connected, our firmware get's an LWIP_ASSERT in the lwip port.
"soup/lwip/port/ethernetif.c" line 433 - 347:
status = PHY_Init(ethernetif->base, ethernetifConfig->phyAddress, sysClock);
if (kStatus_Success != status)
LWIP_ASSERT("\r\nCannot initialize PHY.\r\n", 0);
This lines seem correct on the first look, but inside psl_phy.c in PHY_Init in lines 119 - 131 the root cause of this problem is:
/* Start Auto negotiation and wait until auto negotiation completion */
PHY_Write(base, phyAddr, PHY_BASICCONTROL_REG, (PHY_BCTL_AUTONEG_MASK | PHY_BCTL_RESTART_AUTONEG_MASK));
delay = PHY_TIMEOUT_COUNT;
PHY_Read(base, phyAddr, PHY_SEPCIAL_CONTROL_REG, ®);
} while (delay && ((reg & PHY_SPECIALCTL_AUTONEGDONE_MASK) == 0));
So what it does is, active the Auto negotiation and wait until this is completed.
If the device times out, i.e. this happens when there is no ethernet cable connected, the PHY_init returns an error, which actually is somehow not 100% correct and this causes an LWIP_ASSERT which halts the whole system.
There is also a different thread regarding this issue which is similar but different:
Here the solution was to disable the assert.
Is the solution for our problem the same and will this be fixed with the next SDK version or how should this error of not being able to auto negotiate being handeled correctly?
Our approach was to remove the lines in fsl_phy.c:
#if 0 /* Disable failure return. If auto-negotiation is timed out, this does not mean that the physical was not able to be initialized */
We simply want confirmation from NXP that this approach is also the fix that will be in a future SDK update.