Hi,
I am using MSP430F6438, the following code i used to trigger DMA and transfer data but if i test in the debugger the DMASZ register never decrements, can any one guide me what mistsake i done in code.
#include <msp430.h>
static char String1[] = { "Hello World\r\n" };
int main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog
P2SEL = BIT4+BIT5; // P4.4,5 = UART1 TXD/RXD
// configure USCI_A1 UART
UCA0CTL1 = UCSSEL__SMCLK; // SMCLK
UCA0BR0 = 0x03; // 32768Hz 9600 32k/9600=3.41
UCA0BR1 = 0x0;
UCA0MCTL = UCBRS_3+UCBRF_0; // Modulation UCBRSx = 3
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
// configure DMA0
DMACTL0 = DMA0TSEL_17;
__data16_write_addr((unsigned short) &DMA0SA,(unsigned long) String1);
// Source block address
__data16_write_addr((unsigned short) &DMA0DA,(unsigned long) &UCA0TXBUF);
// Destination single address
DMA0SZ = sizeof String1-1; // Block size
DMA0CTL &= ~(DMALEVEL);
DMA0CTL = DMADT_0 + DMASRCINCR_3 + DMASBDB + DMAEN;// Rpt, inc src, enable
while(1);
}
#pragma vector=DMA_VECTOR __interrupt void DMA_ISR (void)
{
DMA0CTL &= ~DMAIFG;
DMA0CTL &= ~DMAEN;
}
Thanks in advance