esp-idf: Wi-Fi power management stops when disconnected (IDFGH-2825)
Environment
- Development Kit: [none]
- Module or chip used: [ESP32-WROVER]
- IDF version: v3.3.1-209-gcc34d5a5b
- Build System: [Make]
- Compiler version: 1.22.0-80-g6c4433a5
- Operating System: [Windows]
- (Windows only) environment type: [MSYS2 mingw32].
- Using an IDE?: [No]
- Power Supply: [Battery]
Problem Description
The ESP32 module is powered by a battery. Power management is enabled to prevent power issues when connecting to Wi-Fi access points.
The power management seems to be deactivated in case the access point on which the ESP32 is connected is shut down. This will quickly drain the battery power unless the Wi-Fi is disabled. In the worst case, the battery level or the Wi-Fi disconnection are not detected in time and the brownout detector will be triggered.
Expected Behavior
The Wi-Fi driver stays in power management mode MIN_MODEM.
Actual Behavior
Power management is deactivated when the Wi-Fi is down.
Steps to reproduce
- Run the power_save example and wait until the ESP32 is connected to the access point
- Shut down the access point
- Power management stops and ESP32 current consumption raise
Code to reproduce this issue
Reproducible with the power_save example of the esp-idf: https://github.com/espressif/esp-idf/tree/release/v3.3/examples/wifi/power_save
Only the Wi-Fi SSID and password have been changed in the configuration.
Debug Logs
I (3259) wifi: AP's beacon interval = 102400 us, DTIM period = 1
I (6749) event: sta ip: 192.168.0.89, mask: 255.255.255.0, gw: 192.168.0.254
I (6749) power_save: SYSTEM_EVENT_STA_GOT_IP
I (6749) power_save: got ip:192.168.0.89
I (28329) wifi: bcn_timout,ap_probe_send_start
I (30829) wifi: ap_probe_send over, resett wifi status to disassoc
I (30829) wifi: state: run -> init (c800)
I (30829) wifi: pm stop, total sleep time: 17168969 us / 27447850 us
I (30839) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (30839) power_save: SYSTEM_EVENT_STA_DISCONNECTED
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (11 by maintainers)
Commits related to this issue
- esp/espnow: Add wifi disconnect PM opt to config. Add CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y to sdkconfig.base. This prevents excessive power consumption when the device becomes disconnected fr... — committed to glenn20/micropython by glenn20 2 years ago
- esp/espnow: Add wifi disconnect PM opt to config. Add CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y to sdkconfig.base. This prevents excessive power consumption when the device becomes disconnected fr... — committed to glenn20/micropython by glenn20 2 years ago
- esp/espnow: Add wifi disconnect PM opt to config. Add CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y to sdkconfig.base. This prevents excessive power consumption when the device becomes disconnected fr... — committed to glenn20/micropython by glenn20 2 years ago
https://github.com/espressif/esp-idf/blob/606557b48bd195e400c2e3928d8d7c7d4ed9b050/components/esp_wifi/include/esp_wifi.h#L1241-L1243
@TianaESP Is the interval in milliseconds or is the recommended interval not possible?