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

mgleason_3
Posts: 44
Joined: Mon Nov 07, 2016 5:04 pm

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

Postby mgleason_3 » Sun Jul 23, 2017 3:53 am

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?

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

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

Postby loboris » Sun Jul 23, 2017 8:32 am

I've run this example for more than 12 hours without issue...
https://github.com/loboris/ESP32_curl_example

mgleason_3
Posts: 44
Joined: Mon Nov 07, 2016 5:04 pm

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

Postby mgleason_3 » Wed Aug 16, 2017 11:58 pm

@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.

Who is online

Users browsing this forum: Baidu [Spider] and 67 guests