You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I receive unexpected ADC readings from my ESP32-Wrover-E (ESP32-D0WDQ5 revision 3.1) when using the following code:
#![no_std]#![no_main]use esp_backtrace as _;use esp_println::println;use hal::{
adc::{Attenuation,ADC,AdcConfig},
analog::AnalogExt,
clock::ClockControl,
peripherals::Peripherals,
prelude::*,
system::SystemExt,Delay,IO,};#[entry]fnmain() -> ! {let peripherals = Peripherals::take();let system = peripherals.SYSTEM.split();let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);let analog = peripherals.SENS.split();// Configure the system clocklet clocks = ClockControl::max(system.clock_control).freeze();// Configure the ADCletmut adc_config = AdcConfig::default();letmut adc_pin =
adc_config.enable_pin(io.pins.gpio25.into_analog(),Attenuation::Attenuation11dB);letmut adc = ADC::adc(analog.adc2, adc_config.into()).unwrap();letmut delay = Delay::new(&clocks);loop{let sample = nb::block!(adc.read(&mut adc_pin)).unwrap();println!("ADC Value: {sample}");
delay.delay_ms(200u32);}}
For me, this results in inverted values for the ADC, e.g. 0V being 4095 and 3.3V being 0. Is this expected? I couldn't find any notice in the reference manual. But I found an issue about this in the official esp-idf repo: espressif/esp-idf#4557 this says, that the data inversion bit should be set and that it will be added to the IDF framework on next release.
Doing this, fixes the issue for me. Maybe, this is missing in ADC initialization code for the ESP32?
Hi, I receive unexpected ADC readings from my ESP32-Wrover-E (ESP32-D0WDQ5 revision 3.1) when using the following code:
For me, this results in inverted values for the ADC, e.g. 0V being 4095 and 3.3V being 0. Is this expected? I couldn't find any notice in the reference manual. But I found an issue about this in the official esp-idf repo: espressif/esp-idf#4557 this says, that the data inversion bit should be set and that it will be added to the IDF framework on next release.
Doing this, fixes the issue for me. Maybe, this is missing in ADC initialization code for the ESP32?
Btw: This happens on both ADCs and on every channel.
The text was updated successfully, but these errors were encountered: