What fastest way to change the size of the DMA addressed by a peripheral. In particular the DAC? Stopping and starting the DAC using HAL_DAC_Stop_DMA and HAL_DAC_Start_DMA with a new Data Length takes up a lot of cycles if I use the CubeMX functions. I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-27 7:38 AM
I tried DMA_SetConfig after __HAL_DMA_DISABLE and clearly it is not enough.
Incidentally my intention is not change the size of the DMA allocated area - rather the size of this region accessed by a peripheral
- Labels:
-
DAC
-
DMA
-
STM32CubeMX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-27 9:41 PM
Hi, to manage high perf and lower CPU​usage take a look to DMA circular mode. So the DMA is never stopped and run continuously (automaticaly cycling). Doing so permit to manage alternatively one half of the buffer by CPU, during this time DMA continue to fill the other half buffer...
With HAL you only need to register DMA call back to half complete (​HC = the first half buffer) and transmit complete (TC = the second half buffer).
You MUST choose the correct size of buffer to be sure that you have sufficient time to handle an half buffer before the other one is full...​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-27 9:47 PM
Ouups​. It's apply also to DAC. But in this case DMA read from memory to DAC...
And with CPU you write in the actually free half buffer.
First hal buffer after received HC​,
Second half buffet after received TC.
That all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-06-28 1:05 PM
Yes! That's exactly what I did. Got a memory pointer to point to another area of ram and yes sir. No noticeable delay from my end. Brilliant
