ESP32C3 ADC DMA Circular mode

GiulioDallaVecchia
Posts: 5
Joined: Mon Mar 07, 2022 8:01 am

ESP32C3 ADC DMA Circular mode

Postby GiulioDallaVecchia » Mon Aug 01, 2022 1:45 pm

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

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

Re: ESP32C3 ADC DMA Circular mode

Postby ESP_Sprite » Tue Aug 02, 2022 2:03 am

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.

GiulioDallaVecchia
Posts: 5
Joined: Mon Mar 07, 2022 8:01 am

Re: ESP32C3 ADC DMA Circular mode

Postby GiulioDallaVecchia » Tue Aug 02, 2022 7:43 am

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.

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

Re: ESP32C3 ADC DMA Circular mode

Postby ESP_Sprite » Wed Aug 03, 2022 1:33 am

Can you post the code you're using?

Who is online

Users browsing this forum: No registered users and 83 guests