Skip to main content
Graduate II
October 2, 2024
Question

STM32F407VE + LAN8720AI HTTPD hangs

  • October 2, 2024
  • 1 reply
  • 1083 views

Hello, 

   I am trying to make the HTTPD webserver working in a custom board using STM32F407VET6 and LAN8720AI.

I made some progress (see previous post). The state of the art is the following.

- ping works;

- TCP echo server works;

- HTTP ST example page works when pages are managed as in the "LwIP_HTTP_Server_Netconn_RTOS" example. 

This example does not use the full LwIP code but pages are managed via a custom function.

When I try to use the LwIP code which is based on the following calls

 

MX_LWIP_Init();

httpd_init();

 

the interface goes up, ping works but as soon as I open the http page the network rx/tx system geos down.

The problem is that 

netconn_write_partly();

never returns. I made a project using the NUCLEO-F439ZI board using CubeMX and everything works as expected. 

When I generate the same code for my board (same clocks, same memory configuration, it changes the MCU and the LAN8720 driver), httpd does not work.

Microchip says that if the link is up and ping/socket works it is a firmware issue. On the other hands I don't know what else I could check. 

Every idea will be highlty appreciated. 

Attached the project. Thank you. 

    This topic has been closed for replies.

    1 reply

    Super User
    October 2, 2024

    @MRaff.1 wrote:

    as soon as I open the http page the network rx/tx system goes down.


    What, exactly, does that mean ?

    • Does it hit a Hard Fault?
    • Some other Error Handler?
    • Gets stuck in a busy-wait loop?
    • other??

    What do you see in the LwIP logs?

    MRaff.1Author
    Graduate II
    October 2, 2024

    Hello Andrew, 

         thank you for your support. 

    @Andrew Neil wrote:


    @MRaff.1 wrote:

    as soon as I open the http page the network rx/tx system goes down.


    What, exactly, does that mean ?

    • Does it hit a Hard Fault?
    • Some other Error Handler?
    • Gets stuck in a busy-wait loop?
    • other??

    What do you see in the LwIP logs?


    No I don't get HardFault, or other error handlers: the default task is running even after the LWIP stack stops working.

    What I see now is that http_send() is called. http_write() cycles as the whole 9820 bytes of the page were sent but there are no packets on LAN (192.168.0.112 is the board, you can see the ping at the beginning).

    MRaff1_0-1727873170464.png

    With the following settings

    //FreeRTOSConf.h
    #define configTOTAL_HEAP_SIZE ((size_t)45*1024)
    
    //lwipConf.h
    #define MEM_SIZE 1600
    ...
    #define LWIP_DEBUG 1
    #define MEMP_DEBUG LWIP_DBG_ON
    #define MEM_DEBUG LWIP_DBG_ON
    #define TCP_OUTPUT_DEBUG LWIP_DBG_ON
    #define TCP_INPUT_DEBUG LWIP_DBG_ON
    #define HTTPD_DEBUG LWIP_DBG_ON
    #define PBUF_DEBUG LWIP_DBG_OFF

    I get this logs:

    httpd_init
    tcp_outpu+e:nothing to send (ng9693p0f9c4 letcp_output_segment: 536934764:536934764

     

    The uart  is not as fast as the logs output. Enabling the PBUF_DEBUG:

    pbuf_free: deallocating 0x2000f9ec
    pbuf_free: deallocating 0x2000f9ec
    pbuf_free: deallocating 0x2000f9ec
    pbuf_free: deallocating 0x2000f9ec
    pbuf_free: deallocating 0x2000f9bc
    pbuf_free: deallocating 0x2000f9ec
    pbuf_free: deallocating 0x2000fa24
    pbuf_free: deallocating 0x2000f9ec
    pbuf_free: deallocating 0x2000f9ec
    pbuf_free: deallocating 0x2000f9bc
    pbuf_free: deallocating 0x2000f9ec
    pbu_padp_h deaad-fiting 0x2000f9bc
    pbu_padp_h dhe-bueesc06)
    0 8:4 new