我在配置了430DMA后发现,我没有使能,配置完成后会进一次DMA终端。不知道什么原因。
//DMA1通道1设置,内存7->SPI_TX
DMACTL0 |= DMA1TSEL_21;
__data16_write_addr((unsigned short) &DMA1SA,(unsigned long) SPI_UCA1_TXbuf);// Source block address
__data16_write_addr((unsigned short) &DMA1DA,(unsigned long) &UCA1TXBUF);// Destination single address
DMA1SZ = 27; // Block size
DMA1CTL |= DMADT_0|DMASRCINCR_3|DMASBDB|DMALEVEL|DMAIE; // inc src
//DMA2通道2设置,SPI_RX->内存
DMACTL1 |= DMA2TSEL_20;
__data16_write_addr((unsigned short) &DMA2SA,(unsigned long) &UCA1RXBUF); // Source block address
__data16_write_addr((unsigned short) &DMA2DA,(unsigned long) SPI_UCA1_RXbuf);// Destination single address
DMA2SZ = 27; // Block size
DMA2CTL |= DMADT_0|DMADSTINCR_3|DMASBDB|DMALEVEL; // inc dst __bis_SR_register(GIE); // interrupts enabled
Triton Zhang:
进中断后判断下DMAIV是不是发生在DMA0的中断上.
你设计的SPI-TXIFG 触发DMA,当SPI TXBUF为空时会置位TXIFG,触发DMA。