Hi!
Im trying to read a stream of data coming to my UART filling in a string of 30 bytes and then sending this string via SimpliciTI. Unfortunately I dont receive everything, some information is missing and I can not figure out why.
I also tried using 2 char arrays, so while Im sending one with Simpliciti the other one gets filled from the UART.
Here is my DMA UART configuration:
DMACTL0 = DMA0TSEL_16+DMA1TSEL_16; //DMA0 UCA0RXIFG interrupt
//DMACTL4 = DMARMWDIS;
__data16_write_addr((unsigned short) &DMA0SA, (unsigned long) &UCA0RXBUF);
__data16_write_addr((unsigned short) &DMA0DA,(unsigned long) ¤t_string1);
DMA0SZ = 30;//sizeof(current_string1); // Block size
DMA0CTL = DMASRCINCR_0+DMASBDB+DMALEVEL+DMADSTINCR_3+DMADT_4+DMAIE; // src does not change, destination increments, repeated single transfer
DMA0CTL &= ~DMAIFG;
DMA0CTL |= DMAEN;
__data16_write_addr((unsigned short) &DMA1SA, (unsigned long) &UCA0RXBUF);
__data16_write_addr((unsigned short) &DMA1DA,(unsigned long) ¤t_string2);
DMA1SZ = 30;//sizeof(current_string1); // Block size
DMA1CTL = DMASRCINCR_0+DMASBDB+DMALEVEL+DMADSTINCR_3+DMADT_4+DMAIE; // src does not change, destination increments, repeated single transfer
DMA1CTL &= ~DMAIFG;
And here is the DMA interrupt:
#pragma vector=DMA_VECTOR
__interrupt void DMA_ISR(void)
{
switch(__even_in_range(DMAIV,16))
{
case 0: break;
case 2: // DMA0IFG = DMA Channel 0
DMA0CTL &= ~DMAEN;
DMA1CTL |= DMAEN;
SMPL_Send(SMPL_LINKID_USER_UUD, current_string1, sizeof(current_string1));
break;
case 4:
DMA1CTL &= ~DMAEN;
DMA0CTL |= DMAEN;
SMPL_Send(SMPL_LINKID_USER_UUD, current_string2, sizeof(current_string2));
break; // DMA1IFG = DMA Channel 1
default: break;
}
}
Anybody has an idea how I can improve it?
PS:
Device: CC430F5137
UART configured at 115200 from XT2/2 = 13Mhz
DCO running at 20Mhz