Page 1 of 1

How to keep Wifi from timing out / multiple Curl calls example / wifi: pm start, type:0

Posted: Sun Jul 23, 2017 3:53 am
by mgleason_3
I'm trying to use curl to make a restful request every minute or so ( though for testing I've calling every 5 seconds). The issue I'm running into is that everything works fine until this pops up:

I (12667) wifi: pm start, type:0

Once that message hits, the calls timeout even though the wifi shows connected. The calls continue to timeout for some time and eventually a disconnect event happens:

I (98237) wifi_utils: event_handler - DISCONNECTED EVENT reason: 2 (WIFI_REASON_AUTH_EXPIRE)

Does anyone know what is going on? Is there a call that needs to be made to let the wifi know it's still being used or to avoid power-management?

If, not has anyone seen an example that calls curl more than a couple times?

Re: How to keep Wifi from timing out / multiple Curl calls example / wifi: pm start, type:0

Posted: Sun Jul 23, 2017 8:32 am
by loboris
I've run this example for more than 12 hours without issue...
https://github.com/loboris/ESP32_curl_example

Re: How to keep Wifi from timing out / multiple Curl calls example / wifi: pm start, type:0

Posted: Wed Aug 16, 2017 11:58 pm
by mgleason_3
@loboris - thanks!

Looking through your example, there were a few things that I thought might fix it:
  1. Set WIFI_PS_NONE using: "ESP_ERROR_CHECK( esp_wifi_set_ps(WIFI_PS_NONE));".
    ** Unfortunately, it didn't seem to make a difference. Also, noticed that https://github.com/espressif/arduino-es ... esp_wifi.h says esp_wifi_set_ps is "not supported yet" and "Default power save type is WIFI_PS_NONE".
  2. Your code uses pinning - "xTaskCreatePinnedToCore(&testCurl, "testCurl", 10*1024, NULL, 5, NULL, tskNO_AFFINITY);" whereas the IDF example I was following used xTaskCreate.
    ** Unfortunately that didn't seem to affect the results either.
So, made a few changes, then went on vacation for 1.5 months. Came home, did a git pull to update the espidf. Tried again and it's been running fine. Unfortunately, I changed too many things and didn't track them well enough so I don't actually know what the issue was.