Page 1 of 2
ESP32-C6 ADC1 BitWidth not met. ADC Values Deltas only 1,15,16,17 or multiples of them (or Additions)
Posted: Mon Apr 15, 2024 9:44 am
by acmodbios
Hello!
Using latest esp-idf v5.2.1 a little test program which runs either on ESP32-C3 OR ESP32-C6 shows that the ESP32-C6 SAR ADC gives less accurate ADC readings - could we please fix this somehow in esp-idf ? The same problem is existing with the adc-oneshot driver.
attached are two value files of C3 & C6, it is clearly seen that the ADC of the C3 has much more different values than the C6 ADC, resulting in a bitloss on C6 CPU.
The Signal is a Ramp of 1Hz from near 0 to near 3V.
// INCLUDES
#include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include <driver/adc.h>
#include <esp_log.h>
// TAG
const char TAG[] = "ADC";
// DEFINES
#define ADC_CHANNEL ADC_CHANNEL_2
// MAIN
void app_main(void)
{
// ADC SETUP
if (adc1_config_width(ADC_WIDTH_BIT_12) != ESP_OK)
{
ESP_LOGE (TAG, "WIDTH ERROR");
}
if (adc1_config_channel_atten(ADC_CHANNEL, ADC_ATTEN_DB_12))
{
ESP_LOGE (TAG, "ATTEN ERROR");
}
int xo = 0;
while (1)
{
int x= adc1_get_raw(ADC_CHANNEL);
ESP_LOGI (TAG, "%d, %d", x, x - xo);
xo= x;
vTaskDelay(pdMS_TO_TICKS(0));
}
}
Re: ESP32-C6 ADC1 BitWidth not met. ADC Values Deltas only 1,15,16,17 or multiples of them (or Additions)
Posted: Tue Apr 16, 2024 9:26 am
by MicroController
ADC gives less accurate ADC readings ...
The Signal is a Ramp of 1Hz...
In this case, the values you'll get from the ADC obviously depend on timing.
With an ideal ADC, no signal noise, and no timing jitter, you would expect every delta to be
exactly the same, namely the slope of your voltage ramp.
What's the result when you change the signal to e.g. 0.5Hz?
Re: ESP32-C6 ADC1 BitWidth not met. ADC Values Deltas only 1,15,16,17 or multiples of them (or Additions)
Posted: Tue Apr 16, 2024 10:21 am
by acmodbios
Hello!
1Hz is the slowest i can do with my Function Generator. I get the same ADC jumps of Value also when i sample with ADC Continuous Mode Driver.
There is never any 2,3,4,5,6,7,8,9,10,11,12,13,14 values. Only 1,15,16,17 and combinations of the last ones.
https://docs.espressif.com/projects/esp ... nuous.html
best regards
Re: ESP32-C6 ADC1 BitWidth not met. ADC Values Deltas only 1,15,16,17 or multiples of them (or Additions)
Posted: Tue Apr 16, 2024 10:25 am
by acmodbios
Hello!
I seems not to be from timing. Both CPUs run from 160Mhz. Also if i sample the slope with adc cont. driver with 82kHz i never get any digital delta values (new adc value - last adc value) of 2,3,4,5,6,7,8,9,10,11,12,13,14 - only 1,15,16,17
This seems pur ADC problem.
best regards
Re: ESP32-C6 ADC1 BitWidth not met. ADC Values Deltas only 1,15,16,17 or multiples of them (or Additions)
Posted: Wed Apr 17, 2024 7:31 am
by MicroController
Btw, your function generator doesn't happen to have an output resolution of 8 bits, does it?
Re: ESP32-C6 ADC1 BitWidth not met. ADC Values Deltas only 1,15,16,17 or multiples of them (or Additions)
Posted: Wed Apr 17, 2024 8:00 am
by acmodbios
No it does not, it is an old analog one - i can also verify it with specific mV values from a super exact Aim-TTi EX354RD presented to the ADC Pin.
Thanx
Re: ESP32-C6 ADC1 BitWidth not met. ADC Values Deltas only 1,15,16,17 or multiples of them (or Additions)
Posted: Fri Sep 06, 2024 7:34 am
by mnicolas_ter
Hello,
I am experiencing the same issue, did you manage to solve/work around this problem?
I have done some testing with fixed input values and the results do not show the granularity expected from a 12 bit output.
For example, the atatched log is from a fixed signal that is supposed to convert to circa 2000 points. This log is generated using the oneshot api, but continuous mode gives the same results.
The only values present in the log are 2000, 2001, 2016 and 2017. Values in between never appear.
Using the average value of all these readings does not give satisfactory restuls either.
Thanks
Re: ESP32-C6 ADC1 BitWidth not met. ADC Values Deltas only 1,15,16,17 or multiples of them (or Additions)
Posted: Sat Sep 07, 2024 7:03 am
by acmodbios
Hello!
The issue is present up latest esp-idf v5.3, i am still testing new releases. a statement from Espressif would be HELPFUL!
I already contacted their support and never got a response. i am pretty sure they are aware of this bug.
So if anybody can help us fix this issue it would be really apreciated.
best regards
Re: ESP32-C6 ADC1 BitWidth not met. ADC Values Deltas only 1,15,16,17 or multiples of them (or Additions)
Posted: Fri Sep 13, 2024 10:07 am
by mnicolas_ter
Thanks,
from the tests I have done, it seems that the resolution of this ADC converter is actually 8 bit, which is not sufficient for my application
Re: ESP32-C6 ADC1 BitWidth not met. ADC Values Deltas only 1,15,16,17 or multiples of them (or Additions)
Posted: Sat Sep 14, 2024 5:29 am
by acmodbios
Hello!
Yes 8bit + Pseudo Random Bit Signal of values either 0x00, 0x01, 0x0F. any comment of Espressif Techs would be fine here!
maybe its fixable inside esp-idf adc driver,
br