Other Parts Discussed in Thread: MSP430F6659
I am working on a project in which I need to read the data from USB and then process that data and pass it to SPI. To transfer the data from local buffer to SPI I am using DMA and the data received from SPI is put to RAM buffer using DMA too.
I have used USB CDC example which TI provide which is working fine in my Board MSP430F6659, but when I am integrating the SPI DMA code with USB code it does not work.
Can anyone please help me.Looks like DMA is doing some weird behavior,USB transfer has also done using DMA.
Here is Code snippet of DMA initialization
DMACTL2 = DMA2TSEL_16+DMA2TSEL_17; // DMA0 - UCA0TXIFG
// DMA1 - UCA0RXIFG
// Setup DMA0
__data16_write_addr((unsigned short) &DMA2SA,(unsigned long) &TxString);
// Source block address
__data16_write_addr((unsigned short) &DMA2DA,(unsigned long) &UCA0TXBUF);
// Destination single address
DMA2SZ = 1; // Block size
DMA2CTL = DMASRCINCR_3+DMASBDB; // inc src
// Setup DMA1
__data16_write_addr((unsigned short) &DMA3SA,(unsigned long) &UCA0RXBUF);
// Source block address
__data16_write_addr((unsigned short) &DMA3DA,(unsigned long) &RxString);
// Destination single address
DMA3SZ = 8; // Block size
DMA3CTL = DMADSTINCR_3+DMASBDB; // inc dst
DMA2CTL |= DMAEN; // DMA1 Enable
DMA3CTL |= DMAEN; // DMA0 Enable
//wait for DMA transfer finished
while (!(DMA2CTL & DMAIFG)) ;
DMA2CTL &= ~DMAEN; //disable DMAx