Skip to main content
Visitor II
May 21, 2022
Question

STM32H743 lwip netconn_recv netbuf overwritten from browser broadcast message.

  • May 21, 2022
  • 3 replies
  • 1389 views

I have a project on a STM32H743-Nucleo-board based on the STM32CubeH7 repository project with a custom tcp server application running. So far I assumed that, when using netconn_recv(), the netbuf data are valid until the next netconn_recv() command. But sometimes it happens that an incoming BROWSER protocol broadcast message overwrites my rxbuffer and my application ends up with an error message, due to the corrupt data in the rxbuffer. The error dos not occur, when I have wireshark running on the PC. But I can see artifacts of the broadcast message in the rx buffer when inspecting with the debugger.

My server loop is quite simple

while (running) {
 errRet = netconn_recv(current_conn, &rxbuf);
 if (errRet != ERR_OK) {
 break;
 }
 
 do {
 netbuf_data(rxbuf, (void*) &rxdata, &rxlen);
 if (netconn_receive (current_conn, rxdata, rxlen) != ERR_OK)
 break;
 
 } while (netbuf_next(rxbuf) >= 0);
 
}

I enabled the stack and heap overflow hook function, but there seems all ok.

    This topic has been closed for replies.

    3 replies

    Super User
    May 22, 2022

    Do you use the latest/recent ETH driver version and matching ethernetif.c ?

    JKuen.2Author
    Visitor II
    May 31, 2022

    I found it out. I forgot to mention that my project is based on this STMCubeH7 repository application. So far I've been working with version 1.9.1, but now there's a newer version, v1.10.0. I did an update and it seems to work now.

    Graduate II
    June 1, 2022

    For H7 the firmware package v1.10 is the first one with an actually functional ETH driver. All of the previous ones were just broken by design. But still it fixes only the driver. A bunch of other flaws, especially related to lwIP, are still there.

    https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32