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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
838 次查看
jerrylian
Contributor IV

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

0 项奖励
1 解答
677 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Jerry Lian

It is not possible to set that order with a configuration of DOFF, CITER, BITER, etc. for this case you could use another DMA to order your array, but this is not the most optimal implementation, so I don't know if it works for you. Another option is to use scatter gatter feature, but for this you will have to implement 12 different TCD configuration, so I don't know if it works for you.

Hope this information could help you. Please let me know fi you have any other question.

Best Regards

Jorge Alcala

在原帖中查看解决方案

0 项奖励
2 回复数
678 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Jerry Lian

It is not possible to set that order with a configuration of DOFF, CITER, BITER, etc. for this case you could use another DMA to order your array, but this is not the most optimal implementation, so I don't know if it works for you. Another option is to use scatter gatter feature, but for this you will have to implement 12 different TCD configuration, so I don't know if it works for you.

Hope this information could help you. Please let me know fi you have any other question.

Best Regards

Jorge Alcala

0 项奖励
677 次查看
jerrylian
Contributor IV

Hi, Jorge:

I have figured it by using dynamic scatter/gather feature. And I just need one TCD instead of 12 in TCD-loop, surely I need to update TCD during major interrupt!

Thanks for your answer!

Jerry

0 项奖励