Problem socket UDP

Hello,

I encounter a problem after lot of transmission in UDP. I use the SAMR21, example RPL_UDP + my application (3 boards send values from sensor to one board). The 3 boards works fine, the problem occurs on the board which gathers all the data. It works for more or less 20 minutes and then I receive a:

printf(“ERROR: recsize < 0!\n”);

This comes from here:

if ((socket > MAX_SOCKETS) || (socket_base_sockets[socket - 1].socket_id == 0)) { return false; }

When I break here, socket = 2, then 3, then 4 and then it blocks, not a isr_hard_fault but I don’t receive anything then.

I set the push button to send a message to my other board, if I do that, the programs goes to the same error and socket = 2.

This is annoying because the program can’t run and get message for a while.

Any ideas?

Hi Baptiste!

It works for more or less 20 minutes and then I receive a:

    printf("ERROR: recsize < 0!\n");

This comes from here:     if ((socket > MAX_SOCKETS) || (socket_base_sockets[socket - 1].socket_id == 0)) {         return false;     }

When I break here, socket = 2, then 3, then 4 and then it blocks, not a isr_hard_fault but I don't receive anything then.

Sounds like sockets where not freed after sending the UDP packet. If this assumption is correct, the problem should not be dependent on the time, but on the number of transmissions. Can you check?

Cheers, Oleg

You mean than I should slow down the number of transmission? I send a packet every second on three boards which means that the other board receives three packets a second. How may I check apart from slowing down the rate of the transmission?

Baptiste,

Hi Maxence!

You mean than I should slow down the number of transmission? I send a packet every second on three boards which means that the other board receives three packets a second. How may I check apart from slowing down the rate of the transmission?

Three packets every second shouldn't be a problem. Have you checked if same (or similar code) works on native. That would be always the first indicator if it's a general problem in - let's say the network stack - or if it's something particular to this hardware.

Cheers, Oleg

Hi Oleg,

I tried on native by simulating the value from sensor and it works after one hour of running. So it seems to be a platform specific problem.

Any clues? Which test shoud I do then? and where the variable socket is incremented?

Cheers,

I have let my program running with two boards: one sender and one receiver. It seems to work for the moment (longer than with three sender boards)

After pluging a second sender, I got the problem:

if ((socket > MAX_SOCKETS) || (socket_base_sockets[socket - 1].socket_id == 0)) { return false; }

socket = 11534388 socket_base_sockets[socket - 1].socket_id = 64

And then the program goes to isr_hard_fault

Here is the backtrace

bt #0 isr_hard_fault () at RIOT/cpu/samd21/startup.c:104 #1 #2 0x000006ec in clist_advance (list=0x20001c30 <sched_runqueues>) at RIOT/core/include/clist.h:80 #3 0x000008d4 in thread_yield () at RIOT/core/thread.c:99 #4 0x000167fe in isr_eic () at RIOT/cpu/samd21/periph/gpio.c:1027 #5 #6 0x0000147a in ?? ()

Hi Baptiste,

could you open an issue please?

Cheers, Ludwig

Yes sure