ESP32S2 Simultaneous ADC/DAC DMA

jimbuk2
Posts: 1
Joined: Tue May 23, 2023 5:20 pm

ESP32S2 Simultaneous ADC/DAC DMA

Postby jimbuk2 » Tue May 23, 2023 5:28 pm

I have sadly discovered that the ADC and DAC cannot both be used in continuous DMA mode. I assume this is because they share the same DMA controller from the SPI3 peripheral. Could there be a way to route another DMA to the ADC/DAC? I do not have the processing headroom to use one shot modes/ timers.

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

Re: ESP32S2 Simultaneous ADC/DAC DMA

Postby ESP_Sprite » Wed May 24, 2023 11:02 am

There's a limited amount of DMA channels, this is true, but given that you're not running out of them in general, DAC and ADC should work together. Is there any specific error you're getting?

qumbetlian
Posts: 1
Joined: Wed Aug 30, 2023 7:12 pm

Re: ESP32S2 Simultaneous ADC/DAC DMA

Postby qumbetlian » Wed Aug 30, 2023 7:30 pm

Me too have the same problem. I didn't succeed to use adc and dac simultaneously. The error that I get is:

E (3388) spi: alloc_dma_chan(212): no available dma channel
assert failed: dma_chan_free spi_common.c:331 (spi_dma_chan_enabled & BIT(dma_chan))

If I stop the continuous DAC and try just continuous ADC, it work. Maybe jimbuk2 has right, both ADC and DAC can use only the same DMA of SPI3. and cannot be used both simultaneously. :(

gelakinetic
Posts: 2
Joined: Sun Mar 17, 2024 4:06 am

Re: ESP32S2 Simultaneous ADC/DAC DMA

Postby gelakinetic » Sun Mar 17, 2024 4:12 am

I just ran into this issue, and it looks like the IDF is hardcoding SPI3_HOST for both the DAC and ADC: Is there a reason that SPI3_HOST needs to be used specifically, or can this be dynamically allocated?

gelakinetic
Posts: 2
Joined: Sun Mar 17, 2024 4:06 am

Re: ESP32S2 Simultaneous ADC/DAC DMA

Postby gelakinetic » Sun Mar 17, 2024 4:19 am

Oh, the technical reference manual notes that the DMA channel is shared. So I guess it's a hardware limitation?
GP-SPI3 is also a general purpose SPI controller, but shares a DMA channel with ADC and DAC modules.
GP-SPI3 works as either a master or a slave. As a master, GP-SPI3 provides three CS lines, CS0 ~ CS2.

Who is online

Users browsing this forum: Bing [Bot] and 99 guests