Jason Gossiaux

MCF5282 UART Rx DMA Request

Discussion created by Jason Gossiaux on Aug 27, 2007
Latest reply on Sep 6, 2007 by Jason Gossiaux
Hello everyone,
 
 
   I am looking to use DMA on our MCF5282 core, but am having some issues with it.  First, some background...
 
  Our design is currently utilizing UART1 at 2Mbps to handle serial data transactions.  The current code is interrupt driven, and works remarkably well at the high data rate.  However, peformance tests have shown that we need the core to be servicing the main loop during recieves, which it cannot do due to the interrupt overhead.
 
  The solution would be to let DMA handle the receives, removing the interrupt overhead and freeing the core to handle the main loop.  Well, that is if I could get DMA working :smileytongue:
 
   I have attempted to setup the DMA Channel 0 to handle UART1, Source to UART1's Rx address, Source Size as 1 byte, Source increment Off, Destination to an address in memory, Destination Size of 1, Destination Increment On, Cycle Steal On, Byte count set to 0x00FFFFFF (255), and External Enable On.  My register setup is as follows:
 
 
// Serial Setup //
 
// No code, but we setup UART1 for 8 bits/character, no parity, Interrupt on RXRdy Fifo Not full @ 2Mbps

MCF5282_DMA0_DCR  |= 0x00100000;              // Source Size 1 (destination hold by default)
MCF5282_DMA0_DCR  |=  0x20000000;             // Enable Cycle Steal Mod
MCF5282_DMA0_DCR  |=  0x00080000;             // Enable Destination Increment
MCF5282_DMA0_DCR  |=  0x00020000;             // Destination Size 1

ptr = &ModNetUart->RxBuffer[ModNetUart->RxWritePtr];
MCF5282_DMA0_DAR = (DWORD)ptr;             // Setup Destination Address

MCF5282_DMA0_BCR |= 0x00FFFFFF;             //  Setup Byte Count to 255 (ignores lower 2 bytes)

MCF5282_DMA0_SAR    |= (DWORD)&MCF5282_UART1_URB;   // Source to UART1 Receive Buffer
MCF5282_SCM_DMAREQC = 0x0009;      // Setup DMA0 for UART1
MCF5282_DMA0_DCR   |=  0x40000000;   // External Enable

Now, what ends up happening is I enable the External DMA0 Enable, and I get an Error 0x21 in the MCF5282_DMA0_DSR register (Source Error). 

 

Some points of confusion:

1). There is no clear way to setup DMA for only transmits or only recieves in the 5282 user manual.
2). There is a footnote in the UART register description saying DMA only works on channels 2 and 3 - but this is not clear and never repeated in the documentation.

3). The masking of Rx interrupts is described in a confusing manner in the documentation.  What should the status of the IMR and UMR registers be for UART1 for DMA to work on only recieves?

Could anyone possibly provide me with some sample code for making DMA work on recieves for a 5282 core?  I've seen a previous thread with samples for a 5223 transmit driven by an external peripheral, but was unable to adapt it for what I need.  Thank you very much in advance for any help you can provide me with!

 

- Jason

Outcomes