ESP32-S2 ADC2
Posted: Mon Aug 17, 2020 5:08 pm
Using the Arduino IDE, the ESP32-S2 ADC1 channels (GPIO 1 through 10) work fine and gives back the expected reading.
[Codebox]
// Read ADC (30V DC FSV - 0 to 8191 - 13bit)
uint32_t PCB_Voltage;
PCB_Voltage = ((analogRead(9) * 30 ) / 8191);
Serial.println(PCB_Voltage);
[/Codebox]
However, if I use any ADC2 channels (GPIO 11 through 20) ), I get an error:
[Codebox]
// Read ADC (30V DC FSV - 0 to 8191 - 13bit)
uint32_t PCB_Voltage;
PCB_Voltage = ((analogRead(17) * 30 ) / 8191);
Serial.println(PCB_Voltage);
[/Codebox]
E (4127) ADC: /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/driver/adc_common.c:476 (adc2_get_raw):WIDTH ERR: ESP32S2 support 13 bit width
PS. The below basic code does the same, only on ADC2, so excluding any value manipulation
[Codebox]
analogReadResolution(13);
Serial.println(analogRead(17));
[/Codebox]
Please does this error jump out at anyone?
Thanks in advance!
Dave
[Codebox]
// Read ADC (30V DC FSV - 0 to 8191 - 13bit)
uint32_t PCB_Voltage;
PCB_Voltage = ((analogRead(9) * 30 ) / 8191);
Serial.println(PCB_Voltage);
[/Codebox]
However, if I use any ADC2 channels (GPIO 11 through 20) ), I get an error:
[Codebox]
// Read ADC (30V DC FSV - 0 to 8191 - 13bit)
uint32_t PCB_Voltage;
PCB_Voltage = ((analogRead(17) * 30 ) / 8191);
Serial.println(PCB_Voltage);
[/Codebox]
E (4127) ADC: /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/driver/adc_common.c:476 (adc2_get_raw):WIDTH ERR: ESP32S2 support 13 bit width
PS. The below basic code does the same, only on ADC2, so excluding any value manipulation
[Codebox]
analogReadResolution(13);
Serial.println(analogRead(17));
[/Codebox]
Please does this error jump out at anyone?
Thanks in advance!
Dave