Hi,
I have big problems to implement the UCB0 with SPI via DMA. The program runs with UCB0 and SPI without any problem. So I want to implement the DMA.
I don't get any result of the DMA. Maybee someone had the same problem and can help me.
Here is my sourcecode:
void sendFrame(uint8_t *pBuffer, uint16_t size)
{
IFG2 &= ~(UCB0RXIFG | UCB0TXIFG);
DMA1SA = __DMA_ACCESS_REG__ pBuffer;
DMA1DA = __DMA_ACCESS_REG__ &UCB0TXBUF;
DMA1SZ = size;
DMA1CTL = DMADT_0 | DMASBDB | DMASRCINCR1 | DMASRCINCR0;
DMACTL0 |= DMA1TSEL_12;
DMA1CTL |= DMAEN;
UCB0TXBUF = 0xFE;
while((IFG2 & UCB0TXIFG)==0);
}
void readFrame(uint8_t *pBuffer, uint16_t size)
{
IFG2 &= ~(UCB0RXIFG | UCB0TXIFG);
DMA1SA = __DMA_ACCESS_REG__ &UCB0RXBUF;
DMA1DA = __DMA_ACCESS_REG__ pBuffer;
DMA1SZ = size;
DMA1CTL = DMADT_0 | DMASBDB | DMADSTINCR1 | DMADSTINCR0;
DMA1CTL |= DMAEN;
DMA2SA = __DMA_ACCESS_REG__ BLANK;
DMA2DA = __DMA_ACCESS_REG__ &UCB0TXBUF;
DMA2SZ = size - 1;
DMA2CTL = DMADT_0 | DMASBDB;
DMACTL0 |= (DMA1TSEL_12 + DMA2TSEL_12);
DMA2CTL |= DMAEN;
DMA2CTL |= DMAREQ;
UCB0TXBUF = 0xFF;
while((IFG2 & UCB0RXIFG)==0);
}