Can I modify the ADC configuration in an ADC interrupt ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can I modify the ADC configuration in an ADC interrupt ?

Jump to solution
897 Views
Jerry_xie
Contributor II

Dear sir,

I am using the S32K116 sample and convert the 4 channel ADC0 by PDB back-to-back mode. From ADC0_CH3 to ADC0_CH6.

I want to use compare value function only in ADC0_CH4 & ADC0_CH5. 

Can I set the Compare Value function for ADC0_CH4 & ADC0_CH5 iADC interruptn an  before the ADC0_CH4 conversion and unset the compare Value function after the ADC0_CH5 conversion? 

( for example : set ADC0->CV[0] ,ADC0->CV[1], ADC_SC2_ACFE(x), ADC_SC2_ACFGT(x), ADC_SC2_ACREN(x) )     

 If not, could you give me some suggestions to realize this requirement?

Thanks & BRs,

XIECLOCKCLOCKADC_handleADC_handlePDB_initPDB_init

0 Kudos
Reply
1 Solution
872 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Jerry,

The CS2 register cannot be modified while there is a conversion in progress, the conversion would be aborted.

danielmartynek_0-1607612334384.png

So, it is not possible in the PDB back-to-back mode.
But you can use PDB with a separate delay for each channel instead of the back-to-back mode.
And change the CS2 register within a delay.

Best regards,
Daniel

View solution in original post

1 Reply
873 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Jerry,

The CS2 register cannot be modified while there is a conversion in progress, the conversion would be aborted.

danielmartynek_0-1607612334384.png

So, it is not possible in the PDB back-to-back mode.
But you can use PDB with a separate delay for each channel instead of the back-to-back mode.
And change the CS2 register within a delay.

Best regards,
Daniel