Skip to content

Commit 557b6ac

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'fix/fix_xtal32k_power_breaks_adc_v5.1' into 'release/v5.1'
fix(esp_system): fix XTAL32K power breaks ADC function on 32k XTAL clock pin (v5.1) See merge request espressif/esp-idf!43391
2 parents 3e94617 + d141e23 commit 557b6ac

File tree

2 files changed

+16
-0
lines changed
  • components/esp_system/port/soc

2 files changed

+16
-0
lines changed

components/esp_system/port/soc/esp32c6/clk.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ static void select_rtc_slow_clk(soc_rtc_slow_clk_src_t rtc_slow_clk_src)
177177
if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_RC32K) {
178178
rtc_clk_rc32k_enable(false);
179179
}
180+
// We have enabled all LP clock power in pmu_init, re-initialize the LP clock power based on the slow clock source after selection.
181+
pmu_lp_power_t lp_clk_power = {
182+
.xpd_xtal32k = (rtc_slow_clk_src == SOC_RTC_SLOW_CLK_SRC_XTAL32K) || (rtc_slow_clk_src == SOC_RTC_SLOW_CLK_SRC_OSC_SLOW),
183+
.xpd_rc32k = (rtc_slow_clk_src == SOC_RTC_SLOW_CLK_SRC_RC32K),
184+
.xpd_fosc = 1,
185+
.pd_osc = 0
186+
};
187+
pmu_ll_lp_set_clk_power(&PMU, PMU_MODE_LP_ACTIVE, lp_clk_power.val);
180188

181189
if (SLOW_CLK_CAL_CYCLES > 0) {
182190
/* TODO: 32k XTAL oscillator has some frequency drift at startup.

components/esp_system/port/soc/esp32h2/clk.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,14 @@ static void select_rtc_slow_clk(soc_rtc_slow_clk_src_t rtc_slow_clk_src)
178178
if (rtc_slow_clk_src != SOC_RTC_SLOW_CLK_SRC_RC32K) {
179179
rtc_clk_rc32k_enable(false);
180180
}
181+
// We have enabled all LP clock power in pmu_init, re-initialize the LP clock power based on the slow clock source after selection.
182+
pmu_lp_power_t lp_clk_power = {
183+
.xpd_xtal32k = (rtc_slow_clk_src == SOC_RTC_SLOW_CLK_SRC_XTAL32K) || (rtc_slow_clk_src == SOC_RTC_SLOW_CLK_SRC_OSC_SLOW),
184+
.xpd_rc32k = (rtc_slow_clk_src == SOC_RTC_SLOW_CLK_SRC_RC32K),
185+
.xpd_fosc = 1,
186+
.pd_osc = 0
187+
};
188+
pmu_ll_lp_set_clk_power(&PMU, PMU_MODE_LP_ACTIVE, lp_clk_power.val);
181189

182190
if (SLOW_CLK_CAL_CYCLES > 0) {
183191
/* TODO: 32k XTAL oscillator has some frequency drift at startup.

0 commit comments

Comments
 (0)