This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3120: How to recover from a SYNC LOSS Event

Part Number: CC3120

Hello Champions ,

we are facing an issue  while trying to recover from a "Sync Loss"  happened during EMC test causing  CC3120 to get stuck .

Since during EMC test cases the software detects a "Sync Loss" event with CC3120,  we perform a CC3120 recovery restart sequence.

Some MCU's  tasks  are restarted as well right after after the "SlNetSock_select"  API timeouts .

Before to restart the MCU's task ,every binded sockets is closed  but  SlNetSock_close  fails with errno = -2005.

 

Once the restart procedure is completed ,  SlNetSock_create()  works .

If the restart process is repeated multiple times ,  SlNetSock_create() works a number of time equal to the available sockets descriptor.

It looks like, in case of Sync Loss event ,and because SlNetSock_close fails , Host Driver is still consuming the previous socket structure being unable to free that resources.

The issue does not happen if CC3120's recovery restart sequence is triggered when the network processor is working correctly, ( No sync Loss )

hereunder In detail the recovery restart sequence ;

* SYNC LOSS HANDLING sequence

1 - if SYNC LOSS detected, send event EV1 to SERVER TASK ( to indicate to the task to apply a recovery restart )

2 - inside SERVER task, SlNetSock_select timeouts,

3 - inside SERVER task, close(s) returns with -1 and errno = -2005

3 - wait for SERVER task to terminate

4 - sl_Stop(200 /*ms*/);

5 - sl_Start();  -- > CC3120 restarts

6 - start a new server Task.

7 - step 1 in server task ( s(n) = SlNetSock_create)  open a new socket,

                with   s(n) = s(n-1) + 1

8 - app works until the sequence is repeated enough times to saturate the available file descriptors

 

* SERVER TASK 

1 - s(n) = SlNetSock_create()

2 - SlNetSock_setOpt (s, .., SLNETSOCK_OPSOCK_NON_BLOCKING,..) + bind + listen

3 - SlNetSock_select

4 - accept

3a/4a if event EV1 detected, close (s), exit task

  

How can we make sure that the resources are properly cleaned-up in such a situation?

Thank you,

Paolo