Modem sleep in ESP32-C3
Posted: Tue Apr 26, 2022 4:42 am
Hi.
I have been trying to implement modem sleep in the ESP32-C3, more specifically for BLE, since I could not find a singular function that handles modem sleep. The current draw when modem is on, is about 80 mA, and when modem has not been turned on, the average current draw is 10 mA.
So far I have been able to come up with this:
However, I have not been able to turn on BLE back again fully. Not to mention, sometimes when a BLE transmission is in progress and I force it to modem sleep, the current draw does not drop immediately, but very (painfully) slowly.
Is there an easy way to turn on modem sleep? And is there a way to find out if there are any ongoing or pending BLE transmissions?
I have been trying to implement modem sleep in the ESP32-C3, more specifically for BLE, since I could not find a singular function that handles modem sleep. The current draw when modem is on, is about 80 mA, and when modem has not been turned on, the average current draw is 10 mA.
So far I have been able to come up with this:
- while (1)
- {
- vTaskDelay(pdMS_TO_TICKS(3000));
- // modem sleep
- esp_bt_sleep_enable();
- esp_bt_controller_disable();
- esp_wifi_bt_power_domain_off();
- vTaskDelay(pdMS_TO_TICKS(3000));
- // turn modem on
- esp_wifi_bt_power_domain_on();
- esp_bt_controller_enable(ESP_BT_MODE_BLE);
- esp_bt_sleep_disable();
- }
Is there an easy way to turn on modem sleep? And is there a way to find out if there are any ongoing or pending BLE transmissions?