There are two FreeRTOS tasks, each of which creates its own NETCONN object. In one task (the first one begins to execute) there are no oddities when creating a NETCONN object. And in the second task there is: the object returned by netconn_new contains the incorrect address of the pcb union - it seems to be back to front.

I went step by step into the netconn_new_with_proto_and_callback function (it is called when netconn_new), the conn object is created absolutely normal in it:


But in the next step, when its address returns to the function call point, the debugger shows the NETCONN object with the incorrect pcb address:


Further, at the very first attempt to use, for example, p UdpConn-> pcb.udp-> loc al_ip, the processor goes into the hardware error handler.

Why it happens? The task stack increased - it did not help.

Community content is available under CC-BY-SA unless otherwise noted.