From 5d5b142b0d5df8cc6398438f77984864d46a373d Mon Sep 17 00:00:00 2001 From: "yanzihan@espressif.com" Date: Fri, 20 Mar 2026 17:28:32 +0800 Subject: [PATCH] feat(pvt): fix hplpgap assert error in pvt func on master feat(pvt): fix hplpgap assert error in pvt func on master --- components/esp_hw_support/port/esp32c5/pmu_pvt.c | 10 +++++++--- components/esp_hw_support/port/esp32c6/pmu_pvt.c | 11 +++++++---- components/esp_hw_support/port/esp32c61/pmu_pvt.c | 10 +++++++--- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/components/esp_hw_support/port/esp32c5/pmu_pvt.c b/components/esp_hw_support/port/esp32c5/pmu_pvt.c index f4fa36face..51b88be559 100644 --- a/components/esp_hw_support/port/esp32c5/pmu_pvt.c +++ b/components/esp_hw_support/port/esp32c5/pmu_pvt.c @@ -44,9 +44,13 @@ static uint8_t get_lp_hp_gap(void) lp_hp_gap = gap_abs_value; } lp_hp_gap = lp_hp_gap - 8; - assert((lp_hp_gap >= -15) && (lp_hp_gap <= 7)); - if (lp_hp_gap < 0 ) { - lp_hp_gap = 16 - lp_hp_gap; + if (lp_hp_gap < 0) { + if (lp_hp_gap >= -15) { + lp_hp_gap = 16 - lp_hp_gap; + } else { + // pvt offset value only has 4 bit + lp_hp_gap = 31; + } } } return lp_hp_gap; diff --git a/components/esp_hw_support/port/esp32c6/pmu_pvt.c b/components/esp_hw_support/port/esp32c6/pmu_pvt.c index 114db6d602..e517f28d23 100644 --- a/components/esp_hw_support/port/esp32c6/pmu_pvt.c +++ b/components/esp_hw_support/port/esp32c6/pmu_pvt.c @@ -37,16 +37,19 @@ static uint8_t get_lp_hp_gap(void) uint8_t offset_read = efuse_ll_get_dbias_vol_gap(); bool offset_flag = offset_read >> 4; uint8_t offset_value = offset_read & 0xf; - int8_t pvt_offset = 0; if (offset_flag) { pvt_offset = -1 * offset_value; } else { pvt_offset = offset_value; } pvt_offset = pvt_offset - 2; - assert((pvt_offset >= -15) && (pvt_offset <= 13)); - if (pvt_offset < 0 ) { - pvt_offset = 16 - pvt_offset; + if (pvt_offset < 0) { + if (pvt_offset >= -15) { + pvt_offset = 16 - pvt_offset; + } else { + // pvt offset value only has 4 bit + pvt_offset = 31; + } } } return pvt_offset; diff --git a/components/esp_hw_support/port/esp32c61/pmu_pvt.c b/components/esp_hw_support/port/esp32c61/pmu_pvt.c index 4258f77155..b71cf2648e 100644 --- a/components/esp_hw_support/port/esp32c61/pmu_pvt.c +++ b/components/esp_hw_support/port/esp32c61/pmu_pvt.c @@ -43,9 +43,13 @@ static uint8_t get_lp_hp_gap(void) lp_hp_gap = gap_abs_value; } lp_hp_gap = lp_hp_gap - 8; - assert((lp_hp_gap >= -15) && (lp_hp_gap <= 7)); - if (lp_hp_gap < 0 ) { - lp_hp_gap = 16 - lp_hp_gap; + if (lp_hp_gap < 0) { + if (lp_hp_gap >= -15) { + lp_hp_gap = 16 - lp_hp_gap; + } else { + // pvt offset value only has 4 bit + lp_hp_gap = 31; + } } } return lp_hp_gap;