With a STM32L4, I would like to use one channel of DMA1 to read the ADC and another channel to transfer the buffer from memory to UART. Basically, I would like to have some sort of oscilloscope (for positive values only and below 1 MHz signal).
Which is the best approach to manage the use of DMA and "control" the flow of data? Implementing some interrupt when the buffer is filled? Is it possible to put one channel of the DMA on "hold" while the other has full priority? Or two DMA are required for this?
At the moment, transmitting the buffer through UART without DMA is acceptable, I can have the CPU occupied for this. Should I then leave the ADC DMA as normal or circular? And then call HAL_UART_Transmit after the buffer is filled. I understand that if I leave the ADC DMA in circular mode, I'll lose some data during the UART transmission, but that may also be acceptable at the moment.
The "first version" I think would be to fill the buffer using ADC DMA in normal mode, once the buffer is filled I transfer it through UART without DMA and then "restart" ADC DMA scan. Which are the key functions to do so?
I'm new to STM32 programming, so any help is appreciated.
Thanks in advance!
Kind regards,
Luiz Guilherme Enger