"Double buffering" internal DAC DMA
Posted: Sat Aug 24, 2024 11:58 pm
Hello,
I am trying to write some code for audio processing purposes in the ESP32 IDF. My goal is to have the DMA running in a 'double buffer' configuration. In a double buffer configuration, the DMA reads from one buffer, while the second buffer of equal size is written to. Once the DMA transfer is complete, the DMA points to the first address of the newly filled buffer, and the previously read buffer is now the one being written to. As an audio application, the switching of the buffers would be seamless causing no audio artifacting.
Looking at the dac_audio_example_main file, I am having trouble understanding whether I should be using synchronous or asynchronous reading, for example, do the dac_event_callbacks apply to both synchronous and asynchronous reading? I am also having trouble understanding the 'desc_num' as it relates to 'buf_size' in the dac_continuous_config_t.
There is more about the internal DAC DMA that I am having trouble understanding, but I am afraid that the more granular that I make my questions, the more I might confuse what I'm trying to achieve so I will start there. Any help is appreciated. Thank you!
I am trying to write some code for audio processing purposes in the ESP32 IDF. My goal is to have the DMA running in a 'double buffer' configuration. In a double buffer configuration, the DMA reads from one buffer, while the second buffer of equal size is written to. Once the DMA transfer is complete, the DMA points to the first address of the newly filled buffer, and the previously read buffer is now the one being written to. As an audio application, the switching of the buffers would be seamless causing no audio artifacting.
Looking at the dac_audio_example_main file, I am having trouble understanding whether I should be using synchronous or asynchronous reading, for example, do the dac_event_callbacks apply to both synchronous and asynchronous reading? I am also having trouble understanding the 'desc_num' as it relates to 'buf_size' in the dac_continuous_config_t.
There is more about the internal DAC DMA that I am having trouble understanding, but I am afraid that the more granular that I make my questions, the more I might confuse what I'm trying to achieve so I will start there. Any help is appreciated. Thank you!