Skip to content

Commit 7aca624

Browse files
committed
Merge branch 'fix/fix_adc_cali_second_step_error' into 'master'
fix(adc): fix ESP32-C5 adc calibration error See merge request espressif/esp-idf!40107
2 parents 1bbf04c + c602e55 commit 7aca624

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

components/esp_adc/esp32c5/curve_fitting_coefficients.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -28,10 +28,10 @@
2828
const static uint64_t adc1_error_coef_atten[COEFF_VERSION_NUM][COEFF_GROUP_NUM][TERM_MAX][2] = {
2929
/* Coefficients of calibration version 1 */
3030
{
31-
{{2941017829027464, 1e16}, {7368674918527, 1e16}, {0, 0}}, //atten0
32-
{{3224276125615327, 1e16}, {5325658467636, 1e16}, {0, 0}}, //atten1
33-
{{3307554632960901, 1e16}, {409244304226, 1e15}, {0, 0}}, //atten2
34-
{{1463642578413965, 1e15}, {3349642363147, 1e15}, {11676836451, 1e16}}, //atten3
31+
{{2941017829027464, 1e16}, {7368674918527, 1e16}, {0, 1}}, //atten0
32+
{{3224276125615327, 1e16}, {5325658467636, 1e16}, {0, 1}}, //atten1
33+
{{3307554632960901, 1e16}, {409244304226, 1e15}, {0, 1}}, //atten2
34+
{{1463642578413965, 1e15}, {3349642363147, 1e15}, {11676836451, 1e16}}, //atten3
3535
},
3636
};
3737

@@ -41,9 +41,9 @@ const static uint64_t adc1_error_coef_atten[COEFF_VERSION_NUM][COEFF_GROUP_NUM][
4141
const static int32_t adc1_error_sign[COEFF_VERSION_NUM][COEFF_GROUP_NUM][TERM_MAX] = {
4242
/* Coefficient sign of calibration version 1 */
4343
{
44-
{1, -1, 0}, //atten0
45-
{1, -1, 0}, //atten1
46-
{1, -1, 0}, //atten2
44+
{-1, 1, 1}, //atten0
45+
{-1, 1, 1}, //atten1
46+
{-1, 1, 1}, //atten2
4747
{1, -1, 1}, //atten3
4848
},
4949
};
@@ -54,7 +54,7 @@ void curve_fitting_get_second_step_coeff(const adc_cali_curve_fitting_config_t *
5454
assert((adc_calib_ver >= ESP_EFUSE_ADC_CALIB_VER_MIN) &&
5555
(adc_calib_ver <= ESP_EFUSE_ADC_CALIB_VER_MAX));
5656

57-
ctx->term_num = 2;
57+
ctx->term_num = 3;
5858
ctx->coeff = adc1_error_coef_atten[VER2IDX(adc_calib_ver)][config->atten];
5959
ctx->sign = adc1_error_sign[VER2IDX(adc_calib_ver)][config->atten];
6060
}

0 commit comments

Comments
 (0)