cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G4 : Timer triggered UART transmit with DMA

guptaniks
Associate II

Hi,

I need to synchronize my UART transmission with a timer using DMA. I don't want CPU intervention in fixed data transmission. 

My data and size is fixed. I need to continuously transmit the packet every 5ms.

kindly suggest!

3 REPLIES 3
TDK
Guru

How large is the data? If it's a single write, should be easy to set up with DMA. If it takes several writes, it will be a bit more complicated.

If you feel a post has answered your question, please click "Accept as Solution".

Data size is 4 bytes maximum.

 

TDK
Guru

> Data size is 4 bytes maximum.

So it can be packaged and sent as a uint32_t, since the STM32G4 has a TXFIFO on the UART. The peripheral will then send out the individual bytes.

 

Set up a timer to trigger DMA every update and set the destination address to be the UARTx->TXDR register. Not sure if CubeMX will let you set up everything in the gui, but it can be done in software.

UART should be set up, initialized and be ready to transmit before you start the DMA.

If you feel a post has answered your question, please click "Accept as Solution".