dzurikmiroslav/esp32-evse

ADC calibration fails on chips without factory ADC calibration fuse burned.

Closed this issue · 0 comments

ADC calibration fails on chips without factory ADC calibration fuse burned. Those should be quite old chips.
logs:
I (840) adc: Calibration scheme version is Line Fitting
E (840) adc_cali: adc_cali_create_scheme_line_fitting(186): default vref didn't set
E (850) adc: No calibration scheme

From documentation on docs.espressif.com:
There is also a configuration adc_cali_line_fitting_config_t::default_vref. Normally this can be simply set to 0. Line Fitting scheme doesn’t rely on this value. However, if the Line Fitting scheme required eFuse bits are not burnt on your board, driver will rely on this value to do the calibration.

Nominal value is such case is - 1100mV. Adding this value to adc_cali_line_fitting_config_t cali_config solved the issue:

components/peripherals/src/adc.c

#if ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED
    if (!calibrated) {
        ESP_LOGI(TAG, "Calibration scheme version is %s", "Line Fitting");
        adc_cali_line_fitting_config_t cali_config = {
            .unit_id = ADC_UNIT_1,
            .atten = ADC_ATTEN_DB_11,
            .bitwidth = ADC_BITWIDTH_DEFAULT,
            .default_vref = 1100,