Page 1 of 1

ADC oneshot calibration max 3.114 (5.1.1 is worse) What is going on please?

Posted: Thu Aug 10, 2023 2:54 pm
by greg-dickson
I was just experimenting with the ADC one shot read and found that reading a pin basically pulled high will max out at 3.114 volts.
The actual measured voltage at the pin is 3.3v.

Is this normal or is there something wrong.
  1. if((adc->error = adc_oneshot_read(adc_handle, adc->adc_channel , &(adc->raw_result))) == ESP_OK)
  2.     {
  3.           ESP_LOGI(TAG, "ADC%d Channel[%d] Raw Data: %d",adc->unit_id, adc->adc_channel, adc->raw_result);
  4.           if (do_calibration == ESP_OK)
  5.           {
  6.             adc->error = adc_cali_raw_to_voltage(adc_cali_handle, adc->raw_result, &(adc->millivolts));  
  7.             ESP_LOGI(TAG, "ADC%d Channel[%d] Calibrated Data: %d",adc->unit_id, adc->adc_channel, adc->millivolts);
  8.           }
  9.     }
produces
adc_gpio_read: ADC0 Channel[2] Raw Data: 4095
adc_gpio_read: ADC0 Channel[2] Calibrated Data: 3114

Also then doing a resistance calculation on a voltage divider (using the calibrated millivolts) I need to use 3.25 instead of 3.3v as the supply voltage to get reasonable resistance values across the unknown side of the divider.

Re: ADC oneshot calibration max 3.114 volts

Posted: Thu Sep 07, 2023 10:41 am
by greg-dickson
Oh My go esp-idf5.1.1 is worse
This is on several S3 units.

Code: Select all

 
(14593) truc_adc_gpio_read: ADC0 Channel[2] Raw Data: 4095
(14593) truc_adc_gpio_read: ADC0 Channel[2] Calibrated Data: 3076
What's going on guys?