Page 1 of 1

ESP32C3 ADC DMA Circular mode

Posted: Mon Aug 01, 2022 1:45 pm
by GiulioDallaVecchia
Hi ESP32 Team,

I need to sample two analog channels using ADC with DMA in circular mode, but i'm not able to find any example to do that. I've found an example where it's used the ADC with the DMA but after each EOF DMA interrupt the ADC and the DMA are restarted. I don't want to do that, but I need which the DMA tranfers the ADC data from register to a buffer and trigger an interrupt without stopping. I usually divide the buffer into two peaces. While the DMA is trasferring the data into the first half buffer I can analyse the data that is present into the second half buffer.

Is there anyone that who has done something similar?

Thanks a lot,

Giulio

Re: ESP32C3 ADC DMA Circular mode

Posted: Tue Aug 02, 2022 2:03 am
by ESP_Sprite
At least conceptually it's not hard... buffers have DMA descriptors, and those indicate where the next DMA buffer descriptor is. Simply let DMA descriptor 1 point at DMA descriptor 2, and DMA descriptor 2 point at DMA descriptor 1, and you have a circular buffer.

Re: ESP32C3 ADC DMA Circular mode

Posted: Tue Aug 02, 2022 7:43 am
by GiulioDallaVecchia
yes..."At least conceptually it's not hard..." but I'm not able to read continually an analog input. When DMA reaches the last descriptor, even if it is linked with the first one, DMA (or ADC I don't understand) stop to work.

Re: ESP32C3 ADC DMA Circular mode

Posted: Wed Aug 03, 2022 1:33 am
by ESP_Sprite
Can you post the code you're using?