Closed
Description
Hardware:
Board: ESP32S2 Saola, ESP32S2 Dev Module
Core Installation version: 2.0.0
IDE name: Arduino IDE 1.8.16
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Ubuntu 18.04
Description:
Analog input on ADC2 returns WIDTH ERR. A0-A9 work fine.
Sketch: (leave the backquotes for code formatting)
void setup() {
Serial.begin(115200);
Serial.println(analogRead(A10));
}
void loop() {
}
Debug Messages:
E (90) ADC: adc2_get_raw(578): WIDTH ERR: see `adc_bits_width_t` for supported bit width
[ 559][E][esp32-hal-adc.c:174] __analogRead(): GPIO11: ESP_ERR_INVALID_ARG
Metadata
Metadata
Assignees
Labels
No labels
Activity
touchgadget commentedon Sep 13, 2021
Setting the default analogWidth to 4 for ESP32S2 seems to solve this problem. adc2_get_raw rejects all other values.
[-]analogRead(A10) WIDTH ERR[/-][+][ESP32-S2] analogRead(A10) WIDTH ERR[/+]touchgadget commentedon Sep 28, 2021
@chegewara, @caternuson, @atanisoft, @ladyada
The following patch make more sense because the fix is specific to ESP32S2. It compiles cleanly with Board Types=[ESP32 Dev Module | ESP32S2 Dev Module | ESP32C3 Dev Module] and Core Debug Level=Debug.
ladyada commentedon Sep 28, 2021
great @touchgadget can you do a PR so @me-no-dev can merge it?
touchgadget commentedon Sep 28, 2021
@ladyada OK, I will submit a PR but it is fine if @caternuson updates #5711.
Fix analogRead of adc2 channels
caternuson commentedon Sep 28, 2021
ok, i pushed those changes
VojtechBartoska commentedon Mar 30, 2022
I'm closing this one. For some reason it wasn't closed by merged PR.