2024-05-20 09:13 AM
We're running into what seems to be a low-level race-condition when initializing LWIP on boot. The LWIP always initializes successfully after using the STLink to flash the .elf either in debug and release modes. After flashing, I verify by sending a ping command to the Ethernet interface and get a good response with TTL. I then subsequently cycle the power and ping returns the infamous "Request timed out" message.
It's difficult to debug because the initialization issue goes away once I start a debug session. So, I'm completely in the dark on this one. Any and all help/suggestion/insight is much appreciated.
Solved! Go to Solution.
2024-05-20 01:54 PM
I solved this problem by adding a HAL_Delay() in main.c before LWIP is initialized. The reason for the delay was based on my hunch of power instability. So, the delay allowed the entire device to reach a steady-state.
2024-05-20 09:19 AM
@JohnnyB wrote:It's difficult to debug because the initialization issue goes away once I start a debug session. So, I'm completely in the dark on this one. .
Shine light with, eg, UART output; LEDs to show progress; etc ...
2024-05-20 09:23 AM
Thanks. The UART works as we have serial communication with the board and we have onboard LEDs to indicate the board is in a running state. It's just the Ethernet stack is not initialized.
2024-05-20 09:28 AM - edited 2024-05-20 09:55 AM
So sprinkle UART status output through the LwIP process - so that you can see progress when the debugger's not connected.
Compare & contrast with when it doesn't work ...
Do the LEDs indicate that the board is in a "running state" when this happens?
EDIT:
Not surprisingly, it seems LwIP has printf dbugging built in:
See also:
And:
https://community.nxp.com/t5/LPC-Microcontrollers-Knowledge/Enabling-debug-output/ta-p/1128854
2024-05-20 01:54 PM
I solved this problem by adding a HAL_Delay() in main.c before LWIP is initialized. The reason for the delay was based on my hunch of power instability. So, the delay allowed the entire device to reach a steady-state.
2024-05-21 01:19 AM
If you're happy with that, then please mark it as the solution.
2024-05-21 07:27 AM
Andrew, just wanted to send a quick thank you for promptly chiming in to try to help. Cheers.