I am using ESP8266_RTOS_SDK_v2.x.x LWIP library to connect to a remote server. I have a client task which calls a function to send some data to the server. The function is basically identical to the local_ota_begin() function which can be found in ota_demo example. It creates a socket, then calls 'connect', 'write', 'read' and eventually 'close'. The only difference from ota_demo is that before creating a socket it calls netconn_gethostbyname().
The task is in the 30-second loop which means the function is called twice in a minute. The task runs perfectly for several days and then it gets stuck. I see it because after each loop I blink the blue LED for 500 ms and I see that it blinks every 30 seconds for several days before it stops blinking.
However, If I power-down my router the task gets unstuck immediately! I can see that because I set a flag in the wifi_set_event_handler_cb function when the connection is lost and I test this flag at the beginning of the task loop. If the flag is set it makes the blue LED blink fast (100ms ON/OFF) for 10 times and it really blinks like that for as long as the router is powered down. This means that the task is unstuck by the loss of the wifi connection!
When I power-up the router I see that the LED stops fast blinking and starts blinking slowly for 500 ms once in 30 seconds (of course it first blinks every few seconds until the vTaskDelayUntil catches up with its time). I also see that the messages to the server go through again. It works fine again for several days until it gets stuck again.
One of the messages that go to the server is a heap size and I can see that it is stable and unchanged.
Does anyone know what is happening in LWIP, where it might get blocked and how to fix this?
Who is online
Users browsing this forum: No registered users and 9 guests
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
We also have a RTOS version and a MESH version too!
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!