I am using a Cortex M4, the XMC4500 and I am experiencing a strange problem that I don’t understand.
I have LWIP 1.4.0 working and when I activate the netif callback I create a FreeRTOS timer to check the PHY link each second. When the link is out, I bring the interface down. When the link comes back, I brin the interface up.
uint32_t previousLinkState = 0;
void CheckUnplug( xTimerHandle xTimer )
extern synopGMACdevice GMACdevice;
if(GMACdevice.LinkState == 0 && previousLinkState == 1)
previousLinkState = 0;
else if(GMACdevice.LinkState != 0 && previousLinkState == 0)
previousLinkState = 1;
The strange thing: imagine I was sending via socket something and I disconnect the cable. It obviously stops. Then I reconnect the cable. The connection doesn’t resume, even though it should. If in this moment I put a breakpoint (I use a Segger JLink, GDB server, ARM GCC toolchain) in the netif_set_link_up call it actually stops, does it and the connection gets resumed.
Long story short, is like if the timer code was not executing if I don’t put a breakpoint, which is really confusing.
Anyone knows anything about this?