documentation: update docs on ADC support for Espressif devices

Add documentation for ADC on RISC-V and Xtensa Espressif devices.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
This commit is contained in:
Filipe Cavalcanti
2025-03-26 08:16:22 -03:00
committed by Xiang Xiao
parent 238a5250f6
commit 2ff8199d90
12 changed files with 329 additions and 12 deletions
@@ -98,6 +98,27 @@ All of the configurations presented below can be tested by running the following
Where <config_name> is the name of board configuration you want to use, i.e.: nsh, buttons, wifi...
Then use a serial console terminal like ``picocom`` configured to 115200 8N1.
adc
---
The ``adc`` configuration enables the ADC driver and the ADC example application.
ADC Unit 1 is registered to ``/dev/adc0`` with channels 0, 1, 2 and 3 enabled by default.
Currently, the ADC operates in oneshot mode.
More ADC channels can be enabled or disabled in ``ADC Configuration`` menu.
This example shows channels 0 and 1 connected to 3.3 V and channels 2 and 3 to GND (all readings
show in units of mV)::
nsh> adc -n 1
adc_main: g_adcstate.count: 1
adc_main: Hardware initialized. Opening the ADC device: /dev/adc0
Sample:
1: channel: 0 value: 3061
2: channel: 1 value: 3061
3: channel: 2 value: 106
4: channel: 3 value: 99
audio
-----
@@ -376,7 +376,7 @@ The following list indicates the state of peripherals' support in NuttX:
========== ======= =====
Peripheral Support NOTES
========== ======= =====
ADC No
ADC Yes Oneshot
AES No
CAN/TWAI Yes
DAC No
@@ -547,6 +547,40 @@ audio subsystem and develop specific usages of the I2S peripheral.
Please check for usage examples using the :doc:`ESP32-S2-Saola-1 </platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index>`.
Analog-to-digital converter (ADC)
=================================
Two ADC units are available for the ESP32-S2, each with 10 channels.
Those units are independent and can be used simultaneously. During bringup, GPIOs for selected channels are
configured automatically to be used as ADC inputs.
If available, ADC calibration is automatically applied (see
`this page <https://docs.espressif.com/projects/esp-idf/en/v5.1/esp32s2/api-reference/peripherals/adc_calibration.html>`__ for more details).
Otherwise, a simple conversion is applied based on the attenuation and resolution.
Each ADC unit is accessible using the ADC character driver, which returns data for the enabled channels.
The ADC unit can be enabled in the menu :menuselection:`System Type --> ESP32-S2 Peripheral Selection --> Analog-to-digital converter (ADC)`.
Then, it can be customized in the menu :menuselection:`System Type --> ADC Configuration`, which includes operating mode, gain and channels.
========== =========== ===========
Channel ADC1 GPIO ADC2 GPIO
========== =========== ===========
0 1 11
1 2 12
2 3 13
3 4 14
4 5 15
5 6 16
6 7 17
7 8 18
8 9 19
9 10 20
========== =========== ===========
.. warning:: Minimum and maximum measurable voltages may saturate around 100 mV and 3000 mV, respectively.
Wi-Fi
======