Skip to main content
Explorer
May 20, 2024
Solved

STM32F753 LWIP stack not initializing after reboot

  • May 20, 2024
  • 1 reply
  • 2314 views

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.

    This topic has been closed for replies.
    Best answer by JohnnyB

    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. 

    1 reply

    Super User
    May 20, 2024

    @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 ...

    JohnnyBAuthor
    Explorer
    May 20, 2024

    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.

    Super User
    May 20, 2024

    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:

    https://lwip.fandom.com/wiki/Debugging_lwIP#:~:text=lwIP%20is%20developed%20with%20some%20nice%20support%20for%20enabling%20various%20debug%20print%20options

     

    See also:

    https://community.st.com/t5/stm32-mcus-embedded-software/how-to-activate-debug-messages-for-lwip/td-p/234162

     

    And:

    https://community.nxp.com/t5/LPC-Microcontrollers-Knowledge/Enabling-debug-output/ta-p/1128854