Hello!
I'm using the MCF52233 evaluation board and i'm trying to use the TX of UART0 with the DMA0. After setting the registers values, i begin the DMA, but nothing is sended and I get the Error 0x11 in the MCF5282_DMA0_DSR register (bus error on Destination ). I saw for other posts in the forum but i didn´t find a solution. First i thought that the problem was the DMA, and tested it doing a memcopy, so the problem is between the UART and the DMA.
Thank you very much in advance for any help.
Gonzalo
PS: Sorry for my english Here is the main code
#include "support_common.h"
#define N 200 // Bytes to Transfer
uint32 status; // For Debug
static unsigned char Source[N]; // Buffer
void main(void){
int i;
unsigned long int BaudRate=115200;
uint16 ubgs= (uint16)((60000 * 1000)/(BaudRate * 32));
//-------INIT BUFFER
for (i=0;i < N ; i++ ) Source[i]=65; //Fill buffer with A
//------INIT UART 0
MCF_GPIO_PUAPAR =MCF_GPIO_PUAPAR_URXD0_URXD0 //Enable RX pin
| MCF_GPIO_PUAPAR_UTXD0_UTXD0; //Enable TX pin
MCF_UART_UCR(0) = MCF_UART_UCR_RESET_TX; //Reset Transmiter
MCF_UART_UCR(0) = MCF_UART_UCR_RESET_RX; //Reset Receiver
MCF_UART_UCR(0) = MCF_UART_UCR_RESET_MR; //Reset Mode Register
MCF_UART_UMR(0) = MCF_UART_UMR_PM_NONE //Parity None
| MCF_UART_UMR_BC_8; // 8 bits
MCF_UART_UMR(0) = MCF_UART_UMR_CM_NORMAL // Mode: Normal normal
| MCF_UART_UMR_SB_STOP_BITS_1; // 1 stopbit
MCF_UART_UMR(0) = MCF_UART_UMR_SB(0x7); // Stop bit length = 1.000
MCF_UART_UCSR(0)= MCF_UART_UCSR_TCS_SYS_CLK; //Tx system clock
//BAUD RATE
MCF_UART_UBG1(0) = (uint8)((ubgs & 0xFF00) >> 8);
MCF_UART_UBG2(0) = (uint8)(ubgs & 0x00FF);
MCF_UART_UCR(0) = MCF_UART_UCR_TX_ENABLED; //Enable Tx
//-------INIT DMA0
MCF_SCM_DMAREQC=0x0000000C; //Uart0 Tx to DMA0
MCF_SCM_MPR |= 0x04; //Enable DMA access
MCF_SCM_GPACR0 |= 0x06; //read,write
MCF_SCM_GPACR1 |= 0x06; //read,write
MCF_SCM_PACR1 |= 0x06; //read, write for DMA
MCF_SCM_PACR2 |= 0x60; //read, write for UART0
MCF_SCM_RAMBAR |= MCF_SCM_RAMBAR_BDE; //Back door enable
MCF_DMA0_SAR = (volatile unsigned long) &Source[0]; //Set source
MCF_DMA0_DAR =MCF_UART0_UTB; //Set destination
MCF_DMA0_BCR = N; //Set de number of bits
MCF_DMA0_DCR= MCF_DMA_DCR_EEXT | // External request On
MCF_DMA_DCR_CS | // Cycle Steal On
MCF_DMA_DCR_SINC | // Source Inc on
MCF_DMA_DCR_SSIZE(0x01) | // Source Size= 1 byte
MCF_DMA_DCR_DSIZE(0x01) ; // Dest Size=1 byte
//----Start DMA
MCF_DMA0_DCR |=MCF_DMA_DCR_START;
while (MCF_DMA0_BCR & 0x02000000) {} // wait until dma finish
status= MCF_DMA0_DSR;
for( ; ; ) {} // do nothing
}
Hi
Check that you have given peripherals the rights to access SRAM.
GPACR0 = SUP_USER_FULL_ACCESS; // enable peripheral SRAM access
This is not needed by memcpy() type DMA, which needs just DMA permission plus the back-door address (when from/to FLASH).
Regards
Mark
First of all, thanks for your answer. I check this and I think is all right. the value of SUP_USER_FULL_ACCESS is 0x04 or 0x06 (this is from datasheet). So the code of the dma is:
MCF_SCM_DMAREQC=0x0000000C;
MCF_SCM_MPR |= 0x04;
MCF_SCM_PACR1 = 0x06; //read, write for DMA
MCF_SCM_PACR2 = 0x60; //read, write for UART0
MCF_SCM_RAMBAR |= MCF_SCM_RAMBAR_BDE;
MCF_SCM_GPACR0 = 0x04; //read,write
MCF_SCM_GPACR1 = 0x04; //read,write
and the Error in destination continues.
Thanks again
Gonzalo