cancel
Showing results for 
Search instead for 
Did you mean: 

Retriggering Configured DMA for USART Tx

honboxuan
Associate II
Posted on January 19, 2014 at 19:50

Hello all,

I have written a function to configure the DMA for use with one of the USARTs for TX, which works when I trigger it using DMA_Cmd() function. As with the usual USART DMA configurations, all it does is transfer some bytes from a buffer in memory to the appropriate USART. Specifically, I'm using DMA_Mode_Normal instead of ''DMA_Mode_Circular'' so the transfer stops without having a use the transfer complete interrupt (no interrupts currently).

My intention, however, is to have the CPU perform some calculations, write the result (of fixed size) to the buffer, trigger the DMA transfer, and loop back to the calculations while the DMA does its work.

So far, I seem to only be able to achieve this by reconfiguring the DMA (DeInit, Init) and calling DMA_Cmd. I initially thought setting the NDTR value to the size of the buffer was the key, but that did not work. I am sure there is a better way to achieve this, where it is not necessary to reconfigure the DMA.

Any help will be appreciated. Thank you in advance!

Hon
1 REPLY 1
honboxuan
Associate II
Posted on January 23, 2014 at 20:46

Solved. Had to clear the flags for the corresponding stream in the DMA low interrupt flag clear register (DMA_LIFCR), even though no interrupts are enabled.