How can I set/change ADC data rate in QN9080?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How can I set/change ADC data rate in QN9080?

ソリューションへジャンプ
1,877件の閲覧回数
smittal2
Contributor III

I'm using QN9080 to develop an application. My application requires the usage of ADC to output at 400Hz. Where can I set this data rate?

Is this same as ADC down sample rate in ADC_SDDefaultConfig(), or kADC_DownSample256?

タグ(3)
1 解決策
1,507件の閲覧回数
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Sandeep Mittal,

If you want to use the ADC with a sample frequency, you need to set up a timer with this frequency. In the SDK example the trigger is using the function: ADC_DoSoftwareTrigger. For you're aplication you will need to change it for a timer trigger.

You can use the adc interrupt driver example in the SDK and change the source of the trigger, in this case I'm using the CTIMER3_OUT2:

pastedImage_3.png

You'll need to set up this timer, so I suggest to you to check the ctimer simple match driver example. For the 400Hz frequency, you'll need to change the match value, the following configuration should do it:

pastedImage_4.png

Hope it helps,

Alexis Andalon

元の投稿で解決策を見る

6 返答(返信)
1,508件の閲覧回数
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Sandeep Mittal,

If you want to use the ADC with a sample frequency, you need to set up a timer with this frequency. In the SDK example the trigger is using the function: ADC_DoSoftwareTrigger. For you're aplication you will need to change it for a timer trigger.

You can use the adc interrupt driver example in the SDK and change the source of the trigger, in this case I'm using the CTIMER3_OUT2:

pastedImage_3.png

You'll need to set up this timer, so I suggest to you to check the ctimer simple match driver example. For the 400Hz frequency, you'll need to change the match value, the following configuration should do it:

pastedImage_4.png

Hope it helps,

Alexis Andalon

1,507件の閲覧回数
smittal2
Contributor III

Hi nxf46116,

Shouldn't the matchConfig.enableInterrupt be true since the ADC is triggered by ctimer?

Is BUS_CLK_FREQ 32KHz or 32MHz?

Thanks,

Sandeep

0 件の賞賛
返信
1,507件の閲覧回数
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Sandeep Mittal,

   

In this case I didn't enable the interrupt for the CTimer, only the ADC one. The ADC trigger is configured in the structure and this is enough to link the ADC with the CTimer. In case you want to call the CTimer Callback you should change that register.

BUS_CLK_FREQ is the APB bus clock = 16MHz

Best Regards,

Alexis Andalon

1,507件の閲覧回数
smittal2
Contributor III

nxf46116‌,

So the matchConfig.matchvalue in the data structure for ctimer will need to be BUS_CLK_FREQ/40000 to get a frequency of 400Hz, correct?

Thanks,

Sandeep

0 件の賞賛
返信
1,507件の閲覧回数
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Sandeep Mittal,

Have in count that the matchValue is the value where the counter is gonna trigger the interruption. Doesn't really matter what is your Bus Clock, if you divide it by the desired frequency that should work.

Best Regards,

Alexis Andalon

1,506件の閲覧回数
smittal2
Contributor III

Ok, got it. Thanks a lot for your help Alexis.

- Sandeep

0 件の賞賛
返信