-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C3: ADC raw values calibration #550
Conversation
Tested on ESP32-C3 and I get the same values I get with the eps-idf example. (With |
@@ -59,4 +59,25 @@ impl Efuse { | |||
let efuse = unsafe { &*EFUSE::ptr() }; | |||
efuse.rd_repeat_data1.read().wdt_delay_sel().bits() | |||
} | |||
|
|||
/// Read Efuse data and return them | |||
pub fn read_efuse(address: u32, offset: u32, size: u32) -> u32 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Efuses also can be read via peripheral access like so:
let efuse = unsafe { &*EFUSE::ptr() };
efuse.rd_sys_part1_data0.read().bit_field()
But seems currently bit fields isn't described.
(see registers definition in esp32c3.base.svd)
Superseded by #555 |
This adds initial ADC raw values calibration. The solution is ported from https://github.com/apache/nuttx/blob/master/arch/risc-v/src/esp32c3/esp32c3_adc.c
The
11dB
attenuation seems to be working fine, however, other values(0, 2.5, and 6dB) are weird - I'm getting 4095(raw) for the default state (with11dB
I'm getting ~2200(raw)). The weirdest thing here is that I have the same behavior in ESP-IDF oneshot example. I've tested with Rust board (C3, revision3) and 5V joystick.If anyone has any idea, what is going on with
attenuations
(or can test this code) it'd be very appreciated.I'll look into calculating voltage from raw values in the meantime.
Related #326