Hi, I am working on codes for xmega256a3bu chip and a plan is to start TCC0 timer using DMA via. Event sytem like this.
ACB.CH0 (analog comparator) => Event CH1 => DMA.CH2 => TCC0.CTRLA (clk source: Event CH0)
DMA.CH2 provides 0x08 value (Event CH0) to TCC0.CTRLA to start it.
I am using ASF and the actual codes are as below.
The problem is that TCC0.CTRLA is never written 0x08 hence, TCC0 never starts.
I created an interrupt routine to toggle IO pin to check ACB.CH0's output changes as it reacts to input signal change, and I confirmed it is working.
The next thing I did was to swap the source and destination address to see if TCC0.CTRLA value (in this case it is 0x00) is written to tcc0Start (data array).
Then I found DMA put 0x00 value to tcc0Start. So DMA is also seems to be working. Yet, I am not able to write CTRLA register.
I appreciate your help on this matter. Thank you in advance.
memset(&dmach_conf, 0, sizeof(dmach_conf));
dma_channel_set_burst_length(&dmach_conf, DMA_CH_BURSTLEN_1BYTE_gc); //
dma_channel_set_transfer_count(&dmach_conf, 1); //
dma_channel_set_dest_reload_mode(&dmach_conf, DMA_CH_DESTRELOAD_NONE_gc); //
The below code is written in another function to start DMA.
DMA.CH2.CTRLA|=0xa<<4; // this start DMA.CH2 (dmaChannel2)