Skip to content

Commit

Permalink
Merge branch 'feature/rmt_no_light_sleep_lock' into 'master'
Browse files Browse the repository at this point in the history
rmt: avoid auto light sleep when use xtal as the clock source

See merge request espressif/esp-idf!21831
  • Loading branch information
suda-morris committed Jan 13, 2023
2 parents c0c2e3a + 7c9e3b6 commit bcc307c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/driver/rmt/rmt_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t
#if SOC_RMT_SUPPORT_XTAL
case RMT_CLK_SRC_XTAL:
periph_src_clk_hz = esp_clk_xtal_freq();
#if CONFIG_PM_ENABLE
sprintf(chan->pm_lock_name, "rmt_%d_%d", group->group_id, channel_id); // e.g. rmt_0_0
// XTAL will be power down in the light sleep (predefined low power modes)
// acquire a NO_LIGHT_SLEEP lock here to prevent the system go into light sleep automatically
ret = esp_pm_lock_create(ESP_PM_NO_LIGHT_SLEEP, 0, chan->pm_lock_name, &chan->pm_lock);
ESP_RETURN_ON_ERROR(ret, TAG, "create NO_LIGHT_SLEEP lock failed");
ESP_LOGD(TAG, "install NO_LIGHT_SLEEP lock for RMT channel (%d,%d)", group->group_id, channel_id);
#endif // CONFIG_PM_ENABLE
break;
#endif // SOC_RMT_SUPPORT_XTAL
#if SOC_RMT_SUPPORT_REF_TICK
Expand Down

0 comments on commit bcc307c

Please sign in to comment.