Hi All,
I'm having some issues with crashing when it comes to receiving UDP datagrams.
The system I have so far, is a satellite modem which connects to gateway via PPPoS module and then I have a UDP task which receives and transmits data to/from our server.
Problem with the satellite modem is that, it has theoretical maximum throughput 2400kbps, but in reality is no more than 1200kbps and with latency of 5-20 seconds.
The task works fine if we use it with GSM modem, which has 5-6x the goodput of satellite and much much lower latency <1s
In any case, after running the example code for a bit, it crashes when receiving data.
Here is the backtrace:
Assertion "buf != NULL" failed at line 574 in ../../../../lwip/src/api/api_lib.c
Thread 4 "ppp_sat_app" received signal SIGABRT, Aborted.
[Switching to Thread 0x75cff470 (LWP 1015)]
__GI_raise (address@hidden) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (address@hidden) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x76e3e824 in __GI_abort () at abort.c:89
#2 0x00018580 in netconn_recv_data (conn=0x2, address@hidden <memp_memory_NETCONN_base+156>,
new_buf=0x76f4e078 <lock>, address@hidden) at ../../../../lwip/src/api/api_lib.c:574
#3 0x00018b7c in netconn_recv (conn=0x4a2dc <memp_memory_NETCONN_base+156>,
address@hidden <udp_transmit_thread+744>, new_buf=0x75cfee48, address@hidden)
at ../../../../lwip/src/api/api_lib.c:666
#4 0x00017d60 in udp_transmit_thread (arg=<optimized out>) at udp_transmit.c:304
#5 0x76f56fc4 in start_thread (arg=0x75cff470) at pthread_create.c:335
#6 0x76ee2bc8 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:76 from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
And here is the code snippet where it crashes, line 304 is the while loop:
//2. Check if we have received anything over network.
while ((err = netconn_recv(conn, &recv_net_buf)) == ERR_OK) {
do {
netbuf_data(recv_net_buf, (void**)&recv_buffer, &recv_buffer_len);
printf("Recved: %d\n", recv_buffer_len);
// write_to_serial(huart, recv_buffer, recv_buffer_len);
write_serial(pixhawk_serial, recv_buffer, recv_buffer_len);
#if 0
if (err != ERR_OK) {
printf("netconn_write: error \"%s\"\n", lwip_strerr(err));
}
#endif
} while (netbuf_next(recv_net_buf) >= 0);
netbuf_delete(recv_net_buf);
}
Some things I've tried, is to increase the number of PBUF, which didn't seem to have helped, unless I have misunderstood how to do it. I don't fully yet understand the LWIP library.
Any help would be greatly appreciated, thank you.