cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 lwip netconn_recv netbuf overwritten from browser broadcast message.

JKuen.2
Associate II

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.

3 REPLIES 3
Pavel A.
Evangelist III

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

JKuen.2
Associate II

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.

Piranha
Chief II

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