async analogRead

kendo55
Posts: 4
Joined: Fri Aug 03, 2018 5:59 pm

async analogRead

Postby kendo55 » Mon Jan 11, 2021 9:13 am

in both adc ESP-IDF-exaples,
https://github.com/espressif/esp-idf/bl ... ple_main.c
we have a sync read of the adc value.
and therefor we loss a lot of cpu time!

Code: Select all

r = adc2_get_raw( ADC2_EXAMPLE_CHANNEL, width, &read_raw);
do we have a way to start the conversion,
and then to polling or better, have a interrupt, if the conversion is done.


My research has shown there was an attempt at the "arduino-esp32" version (2017).
This has been removed in the meantime

https://github.com/espressif/arduino-esp32/issues/220

My preferred solution would be, if we had a DMA supported adc.
Automatic continues adc (with cycle time, and number of chanels, as a parameters) via DMA. Independent from the CPU.
The only CPU time we use, is , to read the memory area that was written to by the DMA.
This is realised, on STM32 CPU's since about ten years!

mggarland
Posts: 1
Joined: Fri Aug 25, 2023 7:56 pm

Re: async analogRead

Postby mggarland » Fri Aug 25, 2023 7:59 pm

Hi,

Just Wonder if you ever got to the bottom of this?

An interrupt driven return would be ideal in my scenario.

Thanks

ESP_Sprite
Posts: 9719
Joined: Thu Nov 26, 2015 4:08 am

Re: async analogRead

Postby ESP_Sprite » Sat Aug 26, 2023 1:50 am

FWIW, all ESP32 chips have the capability to do DMA-based ADC reads. The ESP32 does it via the I2S peripheral; later chips have a standalone DMA implementation.

Who is online

Users browsing this forum: Gaston1980 and 118 guests