Modem sleep in ESP32-C3

usmanmehmood55
Posts: 10
Joined: Wed Feb 03, 2021 7:54 am

Modem sleep in ESP32-C3

Postby usmanmehmood55 » 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:
  1. while (1)
  2. {
  3.     vTaskDelay(pdMS_TO_TICKS(3000));
  4.  
  5.     // modem sleep
  6.     esp_bt_sleep_enable();
  7.     esp_bt_controller_disable();
  8.     esp_wifi_bt_power_domain_off();
  9.        
  10.     vTaskDelay(pdMS_TO_TICKS(3000));
  11.        
  12.     // turn modem on
  13.     esp_wifi_bt_power_domain_on();
  14.     esp_bt_controller_enable(ESP_BT_MODE_BLE);
  15.     esp_bt_sleep_disable();
  16. }
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?

Who is online

Users browsing this forum: Bing [Bot] and 101 guests