EmbeddedRelated.com
Forums

DMA question

Started by Alesandro Correa March 16, 2012
Hi,

I
need to get bytes from UART (UCA1RXBUF) and send to a block in
memory using DMA. The problem is all time when start software is
started a reset happens.

The
strange is, if I send byte by byte (doing a pause) the bytes is
transfered without problem and all block is fill by bytes.

My
code is below and I am using the MSP430F5438.

Thank
for any help!

Alessandro

//****************************************************************

#include


unsigned char DMA_BUFFER[20];

void
main()
{

WDTCTL = WDTPW + WDTHOLD;

// DMA Config
DMA0SA = (unsigned
int) &UCA1RXBUF; // Address from UCA1RXBUF.
DMA0DA = (unsigned
int) &DMA_BUFFER; // Destination address (20 bytes)
DMA0SZ sizeof(DMA_BUFFER); // size os my buffer where
the bytes will be received
DMACTL0 = 0;
DMACTL0 | DMA0TSEL_20; // trigger from UCA1RXBUF
DMA0CTL = 0;
DMA0CTL |= DMADT_4;
// repeat simple tranfer
DMA0CTL | DMADSTINCR_3; // dst inc
DMA0CTL | DMADSTBYTE; //destination is a byte
DMA0CTL | DMASRCBYTE; // source is a byte

DMA0CTL |= DMAEN; // enable DMA

while(1);
}
//****************************************************************



Beginning Microcontrollers with the MSP430

Not sure if this helps, but why you use &DMA_BUFFER instead of
DMA_BUFFER (or &DMA_BUFFER[0]) for DMA0DA?