2024-10-08 05:38 AM
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!
2024-10-08 06:57 AM
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.
2024-10-08 07:20 AM
Data size is 4 bytes maximum.
2024-10-08 08:12 AM
> 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.