From d91c6d0da86c863c9215f2fa5cf1889865e9bc2f Mon Sep 17 00:00:00 2001 From: "chaijie@espressif.com" Date: Fri, 3 Nov 2023 14:33:20 +0800 Subject: [PATCH] fix(bbpll): fix bbpll calibration may stop early bug(ESP32C2/S3) --- components/esp_hw_support/port/esp32c2/rtc_clk.c | 1 + components/esp_hw_support/port/esp32h2/rtc_clk.c | 1 + components/esp_hw_support/port/esp32s3/rtc_clk.c | 1 + 3 files changed, 3 insertions(+) diff --git a/components/esp_hw_support/port/esp32c2/rtc_clk.c b/components/esp_hw_support/port/esp32c2/rtc_clk.c index a0d88be36f..d8f08fe1e7 100644 --- a/components/esp_hw_support/port/esp32c2/rtc_clk.c +++ b/components/esp_hw_support/port/esp32c2/rtc_clk.c @@ -128,6 +128,7 @@ static void rtc_clk_bbpll_configure(rtc_xtal_freq_t xtal_freq, int pll_freq) clk_ll_bbpll_set_config(pll_freq, xtal_freq); /* WAIT CALIBRATION DONE */ while(!regi2c_ctrl_ll_bbpll_calibration_is_done()); + esp_rom_delay_us(10); /* BBPLL CALIBRATION STOP */ regi2c_ctrl_ll_bbpll_calibration_stop(); diff --git a/components/esp_hw_support/port/esp32h2/rtc_clk.c b/components/esp_hw_support/port/esp32h2/rtc_clk.c index 801ccca5c9..d0dd14a779 100644 --- a/components/esp_hw_support/port/esp32h2/rtc_clk.c +++ b/components/esp_hw_support/port/esp32h2/rtc_clk.c @@ -140,6 +140,7 @@ static void rtc_clk_bbpll_configure(rtc_xtal_freq_t xtal_freq, int pll_freq) clk_ll_bbpll_set_config(pll_freq, xtal_freq); // Wait until calibration finishes while (!regi2c_ctrl_ll_bbpll_calibration_is_done()); + esp_rom_delay_us(10); // Prevent BBPLL clock jitter regi2c_ctrl_ll_bbpll_calibration_stop(); s_cur_pll_freq = pll_freq; diff --git a/components/esp_hw_support/port/esp32s3/rtc_clk.c b/components/esp_hw_support/port/esp32s3/rtc_clk.c index cdae736653..a872a3b883 100644 --- a/components/esp_hw_support/port/esp32s3/rtc_clk.c +++ b/components/esp_hw_support/port/esp32s3/rtc_clk.c @@ -162,6 +162,7 @@ static void rtc_clk_bbpll_configure(rtc_xtal_freq_t xtal_freq, int pll_freq) clk_ll_bbpll_set_config(pll_freq, xtal_freq); /* WAIT CALIBRATION DONE */ while(!regi2c_ctrl_ll_bbpll_calibration_is_done()); + esp_rom_delay_us(10); /* BBPLL CALIBRATION STOP */ regi2c_ctrl_ll_bbpll_calibration_stop();