Merge branch 'bugfix/fix_pvt_print_and_sleep_cost_on_chip761_v5.5' into 'release/v5.5'

fix pvt efuse print bug on c6 and adjust pvt prepare cost in sleep wakeup on c6/c5/c61 (v5.5)

See merge request espressif/esp-idf!45271
This commit is contained in:
Michael (XIAO Xufeng)
2026-01-21 04:12:04 +08:00
2 changed files with 18 additions and 11 deletions
+17 -2
View File
@@ -191,11 +191,14 @@
#elif CONFIG_IDF_TARGET_ESP32C6
#define DEFAULT_SLEEP_OUT_OVERHEAD_US (318)
#define DEFAULT_HARDWARE_OUT_OVERHEAD_US (56)
#define PVT_REINIT_COST_US (60)
#elif CONFIG_IDF_TARGET_ESP32C5
#define DEFAULT_SLEEP_OUT_OVERHEAD_US (318)
#define DEFAULT_HARDWARE_OUT_OVERHEAD_US (56)
#define PVT_REINIT_COST_US (25)
#elif CONFIG_IDF_TARGET_ESP32C61
#define DEFAULT_SLEEP_OUT_OVERHEAD_US (230)
#define PVT_REINIT_COST_US (90)
#define DEFAULT_HARDWARE_OUT_OVERHEAD_US (70)
#elif CONFIG_IDF_TARGET_ESP32H2
#define DEFAULT_SLEEP_OUT_OVERHEAD_US (118)
@@ -1477,9 +1480,9 @@ esp_err_t esp_light_sleep_start(void)
// Re-calibrate the RTC clock
sleep_low_power_clock_calibration(false);
uint32_t cur_cpu_freq = esp_clk_cpu_freq() / MHZ;
uint32_t xtal_freq = rtc_clk_xtal_freq_get();
if (s_config.overhead_out_need_remeasure) {
uint32_t cur_cpu_freq = esp_clk_cpu_freq() / MHZ;
uint32_t xtal_freq = rtc_clk_xtal_freq_get();
if (cur_cpu_freq < xtal_freq) {
s_config.sleep_time_overhead_out = DEFAULT_SLEEP_OUT_OVERHEAD_US * xtal_freq / cur_cpu_freq;
} else {
@@ -1496,6 +1499,18 @@ esp_err_t esp_light_sleep_start(void)
*/
#if SOC_PMU_SUPPORTED
int sleep_time_sw_adjustment = LIGHT_SLEEP_TIME_OVERHEAD_US + sleep_time_overhead_in + s_config.sleep_time_overhead_out;
#if CONFIG_ESP_ENABLE_PVT && !SOC_PVT_EN_WITH_SLEEP
/* PVT will only be enabled during the wake-up process if the CPU's clock source is PLL when the CPU goes to sleep. */
if ((cur_cpu_freq > xtal_freq)
#if CONFIG_IDF_TARGET_ESP32C5
/* On esp32c5, CPU 40m is divided from PLL160/240M */
|| (xtal_freq == SOC_XTAL_FREQ_48M && cur_cpu_freq == 40)
#endif
) {
sleep_time_sw_adjustment += PVT_REINIT_COST_US;
}
#endif
int sleep_time_hw_adjustment = pmu_sleep_calculate_hw_wait_time(sleep_flags, rtc_clk_slow_src_get(), s_config.rtc_clk_cal_period, s_config.fast_clk_cal_period);
s_config.sleep_time_adjustment = sleep_time_sw_adjustment + sleep_time_hw_adjustment;
#else