cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030RC - Example code or logic explanation for 2 USART's TX and RX through DMA.

MM.12
Associate

Hi,

USART1- RX1 and TX1

USART2- RX2 and TX2

2 BUFFERS - BUF1 & BUF2

DMA Access

USART1 - Peripheral to Mem,

USART2 - Mem to Peripheral

  RX1 receives data and stores it in BUF1. TX2 waits till BUF1 is full. Once BUF1 is full now RX1 has to keep storing the data in BUF2. When RX1 stores in BUF2 , TX2 has to initiate the transmit process from BUF1 by transmitting the first data which got stored first in BUF1 and successive data stored in BUF1 has to be transmitted by TX2. When BUF2 gets filled now the control should move back to BUF1 which by now would have got emptied as RX1 receives data at a slower rate and TX2 transmits data at a faster rate. RX1 baud rate is slow compared to TX2 baud rate so as to prevent data loss while receiving. 

1 REPLY 1

The problem with cut-n-paste development is that you eventually find the end of the road.

Did you have a bounty in mind?

Try a different approach.

One larger buffer, circular mode DMA, interrupt in at the half points for receive, initiating a one-shot (normal) mode DMA for the inactive half transmission.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..