AnsweredAssumed Answered

DMA settings: is my requirement too complicated to be done?

Question asked by Jerry Lian on May 23, 2017
Latest reply on Jun 2, 2017 by Jerry Lian

Here is what I achieved so far with channel linking:

* DMA will transfer out ADC results: 2-ADC channels(c1,c2), 3 samples per channel (s1,s1,s3)

----------------------------------------------------------------------------------------------------------------------------------

...

DMA0->TCD[0].SADDR = (uint32_t)&adc_mux[0];                    //  (adc_mux[] = {c1, c2} //channel-1, 2
DMA0->TCD[0].DADDR = (uint32_t)&ADC1->SC1[0];

...

-----------------------------------------------------------------------------------------------------------------------------------
DMA0->TCD[1].SADDR = (uint32_t) &ADC1->R[0];
DMA0->TCD[1].DADDR = (uint32_t)&adc_result[0];
DMA0->TCD[1].SOFF = 0x00;

//**** 16 bit => 2 bytes
DMA0->TCD[1].DOFF = 0x02;
DMA0->TCD[1].ATTR = DMA_ATTR_SSIZE(1)| DMA_ATTR_DSIZE(1);
DMA0->TCD[1].NBYTES_MLNO = 0x02;
DMA0->TCD[1].CITER_ELINKNO = (DMA_CITER_ELINKNO_ELINK_MASK | 0x06);
DMA0->TCD[1].BITER_ELINKNO =(DMA_BITER_ELINKNO_ELINK_MASK|0x0000|0x06);

DMA0->TCD[1].SLAST = 0x00;
DMA0->TCD[1].DLAST_SGA = -12;
DMA0->TCD[1].CSR = DMA_CSR_INTMAJOR_MASK |DMA_CSR_MAJORELINK_MASK | DMA_CSR_MAJORLINKCH(0);

------------------------------------------------------------------------------------------------------------------------------

* adc_result[ ]: [ c1s1, c2s1,    c1s2, c2s2,    c1s3, c2s3 ] and repeat  -------------- so far so good!

               

Now I want to change outputs to be:

* adc_result[ ]: [ c1s1, c1s2, c1s3,        c2s1, c2s2, c2s3 ] and repeat

* (Attention: ADC still produce results in order of: c1s1, c2s1,  c1s2, c2s2, c1s3, c2s3 )!

* How can I achieve this?

 

Thanks!

Jerry

Outcomes