AnsweredAssumed Answered

Kinetis KE18 DMA doesn't rewind source address if destination is ADC

Question asked by Pablo Slavkin on Mar 15, 2018
Latest reply on Mar 15, 2018 by Pablo Slavkin

I'm playing with ADC and DMA and I'd configure a DMA channel to copy ram->ram without problem, and after the citter reaches zero it generates IRQ and the source address and destination address rewind using SLAST and DLAST, it all goes fine, BUT if the destination is ADC->SC1[0] (to begin a ADC sample) the ADC begins normally and DMA does his work fine, but after CITER reaches zero, DMA doesn't rewind nor generate IRQ. The only single change was the destinatino adress. Of course in that case the destination address don't move becouse always point to same ADC2->SC1[0].

   here is the TCD I'm using


9    DMA0->TCD[0].CSR&=~0x0080;
8 DMA0->TCD[0].SADDR=(uint32_t)Adc_Sc;      //Adc_Sc is an 8 byte arrays filled with 0x07
7 DMA0->TCD[0].SOFF=1;
6 DMA0->TCD[0].ATTR=0x0000;
5 DMA0->TCD[0].NBYTES_MLNO=1;
4 DMA0->TCD[0].SLAST=-8;                                          //when Citer reaches zero Adc_Sc doesn't rewind!! 
3 DMA0->TCD[0].DADDR=(uint32_t)&ADC2->SC1[0];    //if I change these with any ram pos, all goes fine

2 DMA0->TCD[0].DOFF=0;
1 DMA0->TCD[0].DLAST_SGA=0;
48 DMA0->TCD[0].CSR=0x0002;                           //when Citer reaches zero it does not generate irq
1 DMA0->TCD[0].CITER_ELINKYES=8;               //using debug I've checked it reaches zero normally
2 DMA0->TCD[0].BITER_ELINKYES=8;
3 DMA0->SERQ=0x00;