mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_rtc8m_calibration_fail_after_cpu_core_reset_v4.2' into 'release/v4.2'
rtc_clk: Fix rtc8m calibration failure after cpu/core reset (backport v4.2) See merge request espressif/esp-idf!20555
This commit is contained in:
commit
6e42e604b2
@ -49,7 +49,10 @@ static uint32_t rtc_clk_cal_internal(rtc_cal_sel_t cal_clk, uint32_t slowclk_cyc
|
||||
REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_XTAL32K_EN, 1);
|
||||
}
|
||||
|
||||
bool clk8m_enabled = rtc_clk_8m_enabled();
|
||||
bool clk8md256_enabled = rtc_clk_8md256_enabled();
|
||||
if (cal_clk == RTC_CAL_8MD256) {
|
||||
rtc_clk_8m_enable(true, true);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_CLK8M_D256_EN);
|
||||
}
|
||||
/* Prepare calibration */
|
||||
@ -100,6 +103,7 @@ static uint32_t rtc_clk_cal_internal(rtc_cal_sel_t cal_clk, uint32_t slowclk_cyc
|
||||
|
||||
if (cal_clk == RTC_CAL_8MD256) {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_CLK8M_D256_EN);
|
||||
rtc_clk_8m_enable(clk8m_enabled, clk8md256_enabled);
|
||||
}
|
||||
if (timeout_us == 0) {
|
||||
/* timed out waiting for calibration */
|
||||
|
@ -57,7 +57,10 @@ uint32_t rtc_clk_cal_internal(rtc_cal_sel_t cal_clk, uint32_t slowclk_cycles)
|
||||
REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_XTAL32K_EN, 1);
|
||||
}
|
||||
|
||||
bool clk8m_enabled = rtc_clk_8m_enabled();
|
||||
bool clk8md256_enabled = rtc_clk_8md256_enabled();
|
||||
if (cal_clk == RTC_CAL_8MD256) {
|
||||
rtc_clk_8m_enable(true, true);
|
||||
SET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_CLK8M_D256_EN);
|
||||
}
|
||||
/* There may be another calibration process already running during we call this function,
|
||||
@ -115,6 +118,7 @@ uint32_t rtc_clk_cal_internal(rtc_cal_sel_t cal_clk, uint32_t slowclk_cycles)
|
||||
|
||||
if (cal_clk == RTC_CAL_8MD256) {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_CLK8M_D256_EN);
|
||||
rtc_clk_8m_enable(clk8m_enabled, clk8md256_enabled);
|
||||
}
|
||||
|
||||
return cal_val;
|
||||
|
Loading…
Reference in New Issue
Block a user