-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
ESP32-C3: ADC documentation issues (IDFGH-11205) #12372
Comments
About the attenuation, both of them are wrong. Should be 10dB. We'll give a commit to fix this to We'll update the TRM as well. About the bitwidth, there's check when using the ADC driver, other enums (except for ADC_BITWIDTH_12) are left for extensibility. ESP32C3 only supports 12bit. |
@Icarus113 I'm sorry but can you please confirm that the attenuation is indeed 10dB? I'm asking because I made some measurements and they don't quite match the provided number. I have a battery-powered ESP32-C3 (via a voltage regulator of course). The battery output is connected to ADC1 channel 4 via a voltage divider, 2:1. The attenuation is set to ADC_ATTEN_DB_11. The reading I get in the one-shot mode is 2872. Using the formula, 2×1.1V×10^(10÷20)×2872÷4095=4.88V but my voltmeter shows 4.09V (all expected since it's a nearly charged LiPo battery). Going backwards from the measured values, the attenuation is 20log(4.09V÷(2×1.1V×2872÷4095))=8.47. Even trying with Vref=1.0 or 1.2 the value is between 7.7dB and 9.3dB. Are my calculations wrong, or am I missing something? |
@cyberhuman Hi, sorry for the late update here. The condition is: By design, when using the ADC_ATTEN_DB_11, the hardware will try to attenuate the input signal to its 1/4. This means by design the attenuation is 12dB. But in reality there are some errors there, so the code says it's attenuation is 1/3.55. This error is different among chips. Besides, the Therefore you can select an attenuation based on this data in the C3 datasheet: About the plan, as by design we expect the attenuation to be 12dB, we'll update the code to |
@Icarus113 thank you for the explanation! |
@Icarus113 I went ahead with the ADC calibration driver and it worked out of the box. Thank you! |
Thanks for the feedback. So you're confused because the lack of the description about The ADC calibration related doc is here by the way. |
@Icarus113 yes I was looking at that documentation page, and yes
=> without the high level understanding of how the calibration works raises questions like
|
Hi @cyberhuman Thanks for letting us know. ESP-IDF provided ADC calibration scheme is based on the values in certain ADC calibration related on-chip eFuse bits. Espressif guarantees these bits during module manufacturing, so you don't have to burn theses eFuses bits yourself. I will add some notes in the doc clarifying this, as well an official link to contact us. |
Rename and deprecation commit: 0c81f41 |
Answers checklist.
General issue report
When checking in the ESP-IDF Programming Guide documentation for ADC, I noticed two issues:
However, the TRM mentions 12 dB instead:
So which one is correct?
Are bit widths other than 12 supported (emulated?) by ESP-IDF?
The text was updated successfully, but these errors were encountered: