I cannot get a DMA block transfer to trigger from a timer. I can trigger via software (DMA_REQ), but no timer trigger works. Here's my code attempting to trigger DMA0 from Timer B CCR2:
// SMCLK is 12 MHz
//------------------------------------------------------------------
// DMA setup
//------------------------------------------------------------------
DMACTL0 = DMA0TSEL_2; // Ch 0 Trigger Timer_B = (TBCCR2 CCIFG)
DMACTL1 = 0;
DMA0CTL = 0
+ DMADT_1 // Block transfer
+ DMASRCINCR_3 // Source address is incremented
;
// Source
__data20_write_long((unsigned long)&DMA0SA, waveform_buffer_addr);
// Destination
__data20_write_long((unsigned long)&DMA0DA, (unsigned long)&DAC12_0DAT);
// Size
DMA0SZ = waveform_buffer_size;
//------------------------------------------------------------------
// Timer B setup
//------------------------------------------------------------------
TBCTL = 0
+ TBSSEL_2 // SMCLK
+ ID_0 // Divide by 1
+ MC_0 // Stop mode: the timer is halted (during configuration)
;
TBR = 0x0; // counter register initialized to 0
TBCCTL0 = 0;
TBCCR0 = 12000 - 1; // 12000 / 12 MHz = 1 ms
TBCCR2 = 12000 - 1; // 12000 / 12 MHz = 1 ms
SET_BIT(TBCTL, MC_1); // Up mode: the timer counts up to TBCCR0
//------------------------------------------------------------------
// Setting DMAEN has no effect
//------------------------------------------------------------------
SET_BIT(DMA0CTL, DMAEN);