From 44f266693aba3dd5eee1622f431de05c8e475403 Mon Sep 17 00:00:00 2001 From: gaoxu Date: Mon, 20 Nov 2023 17:38:34 +0800 Subject: [PATCH] fix(adc): restore cali registers after light sleep wake up on H2 and enable test --- components/esp_adc/test_apps/adc/main/test_adc.c | 4 ++-- components/soc/esp32c2/include/soc/regi2c_defs.h | 2 +- components/soc/esp32c3/include/soc/regi2c_defs.h | 2 +- components/soc/esp32h2/include/soc/regi2c_defs.h | 7 +++++++ components/soc/esp32s2/include/soc/regi2c_defs.h | 2 +- components/soc/esp32s3/include/soc/regi2c_defs.h | 4 ++-- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/components/esp_adc/test_apps/adc/main/test_adc.c b/components/esp_adc/test_apps/adc/main/test_adc.c index f568dde6c7..d1d2789e4c 100644 --- a/components/esp_adc/test_apps/adc/main/test_adc.c +++ b/components/esp_adc/test_apps/adc/main/test_adc.c @@ -286,14 +286,14 @@ static void s_adc_oneshot_with_sleep(adc_unit_t unit_id, adc_channel_t channel) #define ADC2_SLEEP_TEST_CHAN ADC_CHANNEL_0 #endif -TEST_CASE("test ADC1 Single Read with Light Sleep", "[adc][manul][ignore]") +TEST_CASE("test ADC1 Single Read with Light Sleep", "[adc]") { s_adc_oneshot_with_sleep(ADC_UNIT_1, ADC1_SLEEP_TEST_CHAN); } #if (SOC_ADC_PERIPH_NUM >= 2) && !CONFIG_IDF_TARGET_ESP32C3 //ESP32C3 ADC2 oneshot mode is not supported anymore -TEST_CASE("test ADC2 Single Read with Light Sleep", "[adc][manul][ignore]") +TEST_CASE("test ADC2 Single Read with Light Sleep", "[adc]") { s_adc_oneshot_with_sleep(ADC_UNIT_2, ADC2_SLEEP_TEST_CHAN); } diff --git a/components/soc/esp32c2/include/soc/regi2c_defs.h b/components/soc/esp32c2/include/soc/regi2c_defs.h index 715a62271b..99d0e2b5f9 100644 --- a/components/soc/esp32c2/include/soc/regi2c_defs.h +++ b/components/soc/esp32c2/include/soc/regi2c_defs.h @@ -30,7 +30,7 @@ /** * Restore regi2c analog calibration related configuration registers. - * This is a workaround, and is fixed on later chips + * This is a workaround for calibration error when waking up from light sleep */ #define REGI2C_ANA_CALI_PD_WORKAROUND 1 #define REGI2C_ANA_CALI_BYTE_NUM 8 diff --git a/components/soc/esp32c3/include/soc/regi2c_defs.h b/components/soc/esp32c3/include/soc/regi2c_defs.h index 80170d6d71..142851b6f9 100644 --- a/components/soc/esp32c3/include/soc/regi2c_defs.h +++ b/components/soc/esp32c3/include/soc/regi2c_defs.h @@ -28,7 +28,7 @@ /** * Restore regi2c analog calibration related configuration registers. - * This is a workaround, and is fixed on later chips + * This is a workaround for calibration error when waking up from light sleep */ #define REGI2C_ANA_CALI_PD_WORKAROUND 1 #define REGI2C_ANA_CALI_BYTE_NUM 8 diff --git a/components/soc/esp32h2/include/soc/regi2c_defs.h b/components/soc/esp32h2/include/soc/regi2c_defs.h index e9611d885e..799f0e0b80 100644 --- a/components/soc/esp32h2/include/soc/regi2c_defs.h +++ b/components/soc/esp32h2/include/soc/regi2c_defs.h @@ -26,3 +26,10 @@ #define ANA_CONFIG2_M BIT(18) #define ANA_I2C_SAR_FORCE_PU BIT(16) + +/** + * Restore regi2c analog calibration related configuration registers. + * This is a workaround for calibration error when waking up from light sleep + */ +#define REGI2C_ANA_CALI_PD_WORKAROUND 1 +#define REGI2C_ANA_CALI_BYTE_NUM 8 diff --git a/components/soc/esp32s2/include/soc/regi2c_defs.h b/components/soc/esp32s2/include/soc/regi2c_defs.h index cc6a05b85a..034e8569b0 100644 --- a/components/soc/esp32s2/include/soc/regi2c_defs.h +++ b/components/soc/esp32s2/include/soc/regi2c_defs.h @@ -24,7 +24,7 @@ /** * Restore regi2c analog calibration related configuration registers. - * This is a workaround, and is fixed on later chips + * This is a workaround for calibration error when waking up from light sleep */ #define REGI2C_ANA_CALI_PD_WORKAROUND 1 #define REGI2C_ANA_CALI_BYTE_NUM 8 diff --git a/components/soc/esp32s3/include/soc/regi2c_defs.h b/components/soc/esp32s3/include/soc/regi2c_defs.h index 8b90a70b6c..e6a6e9cb72 100644 --- a/components/soc/esp32s3/include/soc/regi2c_defs.h +++ b/components/soc/esp32s3/include/soc/regi2c_defs.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -27,7 +27,7 @@ /** * Restore regi2c analog calibration related configuration registers. - * This is a workaround, and is fixed on later chips + * This is a workaround for calibration error when waking up from light sleep */ #define REGI2C_ANA_CALI_PD_WORKAROUND 1 #define REGI2C_ANA_CALI_BYTE_NUM 8