imxrt 1052, adc convert with dma

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

imxrt 1052, adc convert with dma

跳至解决方案
922 次查看
ccc_clive
Contributor III

imxrt 1052, is adc module has that convert with dma? sdk 2.13 has no sample with this.

I have 13 ADC channels to convert ,so I want make a convert group with dma ,and period triggered by pit or not.So adc module can auto convert with index grop,without cpu options.Convert result  will be save to user-specified address by dma.

标签 (1)
0 项奖励
回复
1 解答
874 次查看
MultipleMonomials
Contributor III

To use the ADC with many channels in a sane way, you will probably need to make use of the ADC ETC (External Trigger Control) peripheral.  This peripheral allows you to define ADC "trigger chains" containing lists of up to 8 channels.  When triggered by an XBAR trigger, the ETC will convert the specified channels sequentially and store the results in its own registers.  It can then generate a DMA request which your DMA channel can use to read out and store the register data.  To initially kick off the process, you can use the PIT to trigger the ETC to start converting.

The only issue is that, with more than 8 ADC channels, you will need to use more than 1 ETC trigger chain to do your conversion.  Probably the easiest way is to assign some channels to ADC1 and other channels to ADC2, and then let them convert in parallel.  Or, alternately, you might be able to link multiple ETC trigger chains together sequentially using the XBAR, though I've not done this.

Additionally, since the FSL HAL library doesn't really directly support using DMA with the ADC ETC, you'll have to a bit of DMA programming yourself, e.g. setting the transfer source address to &ADC_ETC->TRIG[0]->TRIGn_RESULT_1_0 to get the data out.

I can confirm that this sort of setup is possible; we have done something fairly similar at my place but I am unable to share code due to company policy.  Soooo... have fun with that part .  Just try not to go insane reading the ADC_ETC documentation, it's some of the hardest to understand that I have ever seen.

在原帖中查看解决方案

0 项奖励
回复
4 回复数
875 次查看
MultipleMonomials
Contributor III

To use the ADC with many channels in a sane way, you will probably need to make use of the ADC ETC (External Trigger Control) peripheral.  This peripheral allows you to define ADC "trigger chains" containing lists of up to 8 channels.  When triggered by an XBAR trigger, the ETC will convert the specified channels sequentially and store the results in its own registers.  It can then generate a DMA request which your DMA channel can use to read out and store the register data.  To initially kick off the process, you can use the PIT to trigger the ETC to start converting.

The only issue is that, with more than 8 ADC channels, you will need to use more than 1 ETC trigger chain to do your conversion.  Probably the easiest way is to assign some channels to ADC1 and other channels to ADC2, and then let them convert in parallel.  Or, alternately, you might be able to link multiple ETC trigger chains together sequentially using the XBAR, though I've not done this.

Additionally, since the FSL HAL library doesn't really directly support using DMA with the ADC ETC, you'll have to a bit of DMA programming yourself, e.g. setting the transfer source address to &ADC_ETC->TRIG[0]->TRIGn_RESULT_1_0 to get the data out.

I can confirm that this sort of setup is possible; we have done something fairly similar at my place but I am unable to share code due to company policy.  Soooo... have fun with that part .  Just try not to go insane reading the ADC_ETC documentation, it's some of the hardest to understand that I have ever seen.

0 项奖励
回复
855 次查看
ccc_clive
Contributor III

First,thanks for your answer.It is similar with my application scenarios.But unfortunately,I have no more gpio pins to use.All available pins have been used.So,I use the last way to resolve ,that is changing channel by mannual(with cpu options),so this make execution efficiency very low.But there is no other way.

0 项奖励
回复
839 次查看
MultipleMonomials
Contributor III

Well, for what I described, you don't need any GPIO pins!  All of the connections can be made internally to the chip using the XBAR switch!

0 项奖励
回复
898 次查看
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

Thank you so much for your interest in our products and for using our community.

Yes, the ADC supports DMA, however we do not have the specific SDK example you are looking for so far.

Sorry for the inconvenience.

Have a nice day!

0 项奖励
回复