esp-idf/examples/system/ulp_riscv/adc
Marius Vikhammer 07471019ef ulp-riscv: enable ULP-RISCV ADC example for esp32s2
ADC can now be used from the ULP-RISCV on S2 after the RTC power parameters were
fixed in a624d8d061

Closes https://github.com/espressif/esp-idf/issues/11052
Closes https://github.com/espressif/esp-idf/issues/11040
2023-04-24 10:12:09 +08:00
..
main system: fix printf format errors in all system and cxx examples 2022-12-12 16:56:20 +08:00
CMakeLists.txt ulp-riscv: add support for using ADC as well as an example show-casing it. 2022-07-11 09:31:22 +08:00
README.md ulp-riscv: enable ULP-RISCV ADC example for esp32s2 2023-04-24 10:12:09 +08:00
sdkconfig.defaults ulp-riscv: add support for using ADC as well as an example show-casing it. 2022-07-11 09:31:22 +08:00

Supported Targets ESP32-S2 ESP32-S3

ULP-RISC-V ADC Example

This example demonstrates how to use the ULP-RISC-V coprocessor to poll the ADC in deep sleep.

The ULP program periodically measures the input voltage on EXAMPLE_ADC_CHANNEL (by default ADC1 channel 0, GPIO1 on both ESP32-S2 and ESP32-S3). The voltage is compared to an upper threshold. If the voltage is higher than the threshold, the ULP wakes up the system.

By default, the threshold is set to 1.75V, approximately.

In this example, you need to connect a voltage source (e.g. a DC power supply) to the GPIO pin corresponding to the ADC channel specified in ulp/example_config.h (see the macros defined on the top of the header file). Feel free to modify the channel setting.

Hardware Required

  • A development board with a SOC which has a RISC-V ULP coprocessor (e.g., ESP32-S2 Saola)
  • A USB cable for power supply and programming

Example output

Below is the output from this example.

Not a ULP-RISC-V wakeup (cause = 0), initializing it!
Entering in deep sleep

ULP-RISC-V woke up the main CPU
Threshold: high = 2000
Value = 4095 was above threshold
Entering in deep sleep