Skip to content

Commit 8b2a1b4

Browse files
committed
Merge branch 'feat/ot_sleep_lock_type' into 'master'
feat(openthread): use apb_freq_max mode for esp_openthread_sleep pm lock See merge request espressif/esp-idf!39800
2 parents 570f9d3 + 55f48c9 commit 8b2a1b4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

components/openthread/src/port/esp_openthread_sleep.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ esp_err_t esp_openthread_sleep_init(void)
1919
{
2020
esp_err_t err = ESP_OK;
2121

22-
err = esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "ieee802154", &s_pm_lock);
22+
// Here we use APB_MAX because modem requires MODEM_REQUIRED_MIN_APB_CLK_FREQ.
23+
// No need for CPU_MAX to reduce current consumption during Rx window.
24+
err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "ot_sleep", &s_pm_lock);
2325
if (err == ESP_OK) {
2426
esp_pm_lock_acquire(s_pm_lock);
25-
ESP_LOGI(TAG, "Enable ieee802154 light sleep, the wake up source is ESP timer");
27+
ESP_LOGI(TAG, "Enable OpenThread light sleep, the wake up source is ESP timer");
2628
} else {
2729
if (s_pm_lock != NULL) {
2830
esp_pm_lock_delete(s_pm_lock);

examples/openthread/ot_sleepy_device/light_sleep/main/esp_ot_sleepy_device.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "esp_openthread_netif_glue.h"
2626
#include "esp_ot_sleepy_device_config.h"
2727
#include "esp_vfs_eventfd.h"
28+
#include "esp_private/esp_clk.h"
2829
#include "driver/uart.h"
2930
#include "nvs_flash.h"
3031
#include "openthread/logging.h"
@@ -192,7 +193,7 @@ static esp_err_t ot_power_save_init(void)
192193

193194
esp_pm_config_t pm_config = {
194195
.max_freq_mhz = cur_cpu_freq_mhz,
195-
.min_freq_mhz = cur_cpu_freq_mhz,
196+
.min_freq_mhz = esp_clk_xtal_freq() / MHZ,
196197
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
197198
.light_sleep_enable = true
198199
#endif

0 commit comments

Comments
 (0)