cancel
Showing results for 
Search instead for 
Did you mean: 

DMA with USART1 & 2

ezyreach
Associate II
Posted on February 01, 2011 at 11:05

DMA with USART1 & 2

2 REPLIES 2
ColdWeather
Senior
Posted on May 17, 2011 at 14:23

Hello!

Your retransmitting UART2 is significant slower than the input UART1. In general it's impossible to retransmit the data stream lossless if the output is slower than the input unless the average incoming data amount is lower that the output bandwidth.

In your case the lossless retransmission will be possible only if UART1 receives the data packet-wise, while between the packets there is a pause long enough to give UART2 sufficient time to push the collected data out. A memory buffer is inevitable to cache the incoming data stream.

Then it's up to you how you manage the transmissions: interrupt driven, with DMA, etc...
picguy2
Associate II
Posted on May 17, 2011 at 14:23

What ivanov.igor.001 said plus . . .

If your CPU clock rate is 72MHz then your high speed USART delivers one byte every 6250 clocks.  If your ISR and buffering take 200 clocks you are using well under 4% of the CPU bandwidth.

Thus without any issues other than what I call “drinking from the fire hose�? you don’t need DMA.  If you receive messages one at a time with no new incoming message until it’s sent out the other port then all is well.  Simply reserve a buffer for your longest message.

Otherwise consider a pair of circular buffers with non-ISR code moving data between them.  See http://www.hmtown.com/fifo.htm