I am trying to use the lwip stack in freertos for a UDP based communication over multiple sockets. My first problem was, that socket creation failed because, lwip_socket
has a call to netconn_new
, which contains a call to TCPIP_APIMSG(&msg)
, which returned with an error. I figured out that the error in TCPIP_APIMSG(&msg)
was produced because sys_mbox_valid(&mbox)
returned false.
I could solve the problem after recognizing that I created more UDP sockets than allowed by the lwip configuration variable memp_n_udp_pcb
. I just increased memp_n_udp_pcb
.
Now I have the problem that lwip_sendto
stops working after sending about 300 packets. Again, an invalid mbox in TCPIP_APIMSG(&msg)
seems to be the reason. lwip_sendto
calls netconn_send
, which calls TCPIP_APIMSG(&msg)
, which returns an error due to an invalid mbox.
I am only trying to use the lwip stack with freertos, but I have no experience with the implementation details of the lwip stack. I have no idea what the invalid mbox means and how to solve the problem.
I hope someone can explain to me what is going wrong here.
Are there any further settings (except memp_n_udp_pcb
) I have to change when using more than the predefined number of 4 UDP sockets?
Why does lwip_sendto
fail after sending a few hundred packets without problems?