Hello,
I'm trying to get DMA Channel 0 to transfer 16 bytes from the UART 0 Receive channel to memory. The configuration of the DMA is in the attached file (view using WordPad). The UART is working fine. DMA transfer is **almost** working fine. I connect my UART channel to a PC running Windows Hyperterminal.
I then manually type in characters, and have the CPU spit out the characters to UART 0 Transmit (also going to Hyperterminal). I've created a **mock** DMA Channel 0 ISR (below code). This is behavior I notice:
When the DMA Channel is initialized or re-enabled with the below **mock** ISR, it will always immediately transfer 1 byte from the UART to memory, regardless of whether the UART actually sent any data. It works as normal for the other 15 bytes. So the question is, why does the DMA spit out this first erroneous byte of data?
// Mock DMA Channel 0 finished ISR
// Check DONE bit in DSRn
if(MCF_DMA_DSR(0) & 0x01)
{
// Configure DMAREQ Register to disable DMA Channel 0
MCF_SCM_DMAREQC &= 0xFFFFFFF0;
// Clear DSRn Register with DONE bit logic 1
MCF_DMA_DSR(0) = 0x01;
// Clear UART errors with UCRn Register
MCF_UART_UCR(0) = 0x40;
// Place absolute memory address (destination address) into DARn Register
MCF_DMA_DAR(0) = (unsigned long int) &UART0_rxd[0];
// Place number of bytes to transfer into BCRn Register
MCF_DMA_BCR(0) = DMA_BYTE_count[0];
// Configure DMAREQ Register to enable DMA Channel 0
MCF_SCM_DMAREQC |= 0x00000008;
// Restart DMA channel with START bit logic 1 in DCRn Register
MCF_DMA_DCR(0) |= 0x00010000;
}
Why does this **always** spit out an erroneous first byte?
Dogbert
Solved! Go to Solution.
I solved this some time ago. Attached is functional source code to configure the DMA channels to save UART RXD characters to memory. You might be able to use this as a template.
Dogbert
Processor is MCF5232
CodeWarriors V10.0
Dogbert
I solved this some time ago. Attached is functional source code to configure the DMA channels to save UART RXD characters to memory. You might be able to use this as a template.
Dogbert
Please submit source files in standard unformatted form .. this is basically unreadable with your editors formatting codes.
> this is basically unreadable with your editors formatting codes
Trivially easy to fix. Open in Wordpad and "save as plain txt".
Tom