Skip to main content
ezyreach
Associate III
February 1, 2011
Question

DMA with USART1 & 2

  • February 1, 2011
  • 2 replies
  • 595 views
Posted on February 01, 2011 at 11:05

DMA with USART1 & 2

    This topic has been closed for replies.

    2 replies

    ColdWeather
    Senior
    May 17, 2011
    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 III
    May 17, 2011
    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