Skip to main content
Graduate II
March 21, 2024
Solved

STM32F439 with FreeRTOS & ETH gets stuck in MX_LWIP_Init()

  • March 21, 2024
  • 1 reply
  • 2204 views

Hi,

I want to creater a telnet server but can't even get the board to respond to a ping. I followed the following sequence:

  1. Crearted a new project
  2. selected my Nucleo-F439ZI board
  3. selected to initialize the peripherals to their default mode
  4. Got the following clock config (note I changed the HSE to 25MHz):debug_1-1711042245301.png
  5. Enabled FreeRTOS CMSIS_V

  6. Changed Timebase Source to TIM14 (in SYS config)
  7. Enabled USE_NEWLIB_REENTRANT (In FREERTOS config)
  8. Confirmed that ETH is enabled with RMII & confirmed all the pins are routed correctly (no changes needed)
  9. Enabled LWIP
  10. Changed the Driver_PHY to LAN8742
  11. Disabled DHCP 
  12. Set IP to 192.168.000.123 with 255.255.255.0 as subnet
  13. Ctrl+s to create the sources!
  14. compiled & loaded the application & tried to ping the above IP (.123) from my laptop (set to 192.168.0.111) but do not get any response.
  15. I realized that it appears to get stuck in MX_LWIP_Init(). Why is this and how can I fix it?
    This topic has been closed for replies.
    Best answer by STea

    Hello @debug,

    as a first guess I recommend that you check the Tim14 Timebase is working as well as Systick initialization as it will be used by LWIP maybe try using anther Timer like TIM6 and see the difference.

    Another point to be aware of is memory management (pool allocation, buffer placement in SRAM ...).

    A general recommendation will be to see the working example STM32Cube_FW_F4_V1.27.0\Projects\STM32F429ZI-Nucleo\Applications\LwIP\LwIP_HTTP_Server_Netconn_RTOS which can be run on your board. And try to see the difference between this code and your generated code to pinpoint your issue.  

    BR

    1 reply

    STeaAnswer
    ST Employee
    March 26, 2024

    Hello @debug,

    as a first guess I recommend that you check the Tim14 Timebase is working as well as Systick initialization as it will be used by LWIP maybe try using anther Timer like TIM6 and see the difference.

    Another point to be aware of is memory management (pool allocation, buffer placement in SRAM ...).

    A general recommendation will be to see the working example STM32Cube_FW_F4_V1.27.0\Projects\STM32F429ZI-Nucleo\Applications\LwIP\LwIP_HTTP_Server_Netconn_RTOS which can be run on your board. And try to see the difference between this code and your generated code to pinpoint your issue.  

    BR

    Super User
    March 26, 2024

    You have the source code - use your debugger.  WHERE in MX_LWIP_Init() is it hanging?  If it is in a HAL_Delay() call, then, yeah, your timer config is probably incorrect.

    debugAuthor
    Graduate II
    April 3, 2024

    Hi,

     

    My apologies for replying late! I finally got back to it. I created a new project, set the timebase source to TIM6, enabled FreeRTOS, LWIP & Ethernet compiled and loaded and it looks like I can get LWIP_Init() fine now and my project will enter infinite loop in StartDefaultTask.

    I set the IP to 192.168.000.123/24 and my computer to 192.168.0.234/24 and when I try to send pings from my computer to 192.168.0.123, it won't respond. In Wireshark, I see the ARP requests for 192.168.0.123 going out but there's no reply to the requests from the board. What else am I missing? LWIP_ICMP is Enabled in the config (LWIP -> General Settings)

    I cloned the repo from STM32Cube_FW_F4_V1.27.0\Projects\STM32F429ZI-Nucleo\Applications\LwIP\LwIP_HTTP_Server_Netconn_RTOS, imported the project but it wouldn't build, it appears to be missing the complete contents of  LwIP_HTTP_Server_Netconn_RTOS\STM32CubeIDE\Drivers\STM32F4xx_HAL_Driver I tried to manually copy the missing files but have not succeeded in building this project yet. Not exactly sure how I can use these examples