read adc without interrupt in s32k312,

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

read adc without interrupt in s32k312,

Jump to solution
1,317 Views
vasanth-sr
Contributor II

Hi 

i am using the s32k312 ev board. In that adc read example code was interrupt based code.

how to read the ADC value without interrupt?

how to enable AdcWithoutInterrupts flag in s32k312 .

please share the steps and examples.

 

Regards,

vasanth sr.

0 Kudos
1 Solution
1,285 Views
cuongnguyenphu
NXP Employee
NXP Employee

Hi @vasanth-sr 
To use Adc read without interrupt, you need to enable this feature in Group configurations array container

cuongnguyenphu_0-1673341950417.png

Then disable Interrupt EOC in AdcInterrupt container:

cuongnguyenphu_1-1673341988069.png


When using this feature, you don't need to config interrupt after conversions, instead, only Adc_ReadGroup() can be used to get conversion results. 
So the sequence in implementation should be:
Adc_SetupResultBuffer();
Adc_StartGroupConversion();
Adc_ReadGroup();

Please see my example in attachment, it's modified from S32K344 ADC example, but you can use the same sequence for S32K312

View solution in original post

0 Kudos
5 Replies
1,280 Views
vasanth-sr
Contributor II

Hi,

I m using S32design studio 3.5.

I don't have this enable option.

I attached the screen short , please find the attachment.

 

Regards,

vasanth

0 Kudos
1,269 Views
cuongnguyenphu
NXP Employee
NXP Employee

Let's follow this to enable Adc without interrupt:

cuongnguyenphu_0-1673408057843.pngcuongnguyenphu_1-1673408076919.pngcuongnguyenphu_2-1673408086674.png


Because we cannot check Interrupt notification to notify the conversion finished, then we need to use timer and polling function ReadGroup() to get Adc results

0 Kudos
1,274 Views
Nanettebreaux
Contributor I

According to the approach in your codes, inside the while (1) loop, you are just polling the timer overflow interrupt flag and simply get the ADC result after timer, so timer and ADC interrupts are not required to enable and hence global interrupt is not required to enable.   MyGeorgiaSouthern

0 Kudos
1,286 Views
cuongnguyenphu
NXP Employee
NXP Employee

Hi @vasanth-sr 
To use Adc read without interrupt, you need to enable this feature in Group configurations array container

cuongnguyenphu_0-1673341950417.png

Then disable Interrupt EOC in AdcInterrupt container:

cuongnguyenphu_1-1673341988069.png


When using this feature, you don't need to config interrupt after conversions, instead, only Adc_ReadGroup() can be used to get conversion results. 
So the sequence in implementation should be:
Adc_SetupResultBuffer();
Adc_StartGroupConversion();
Adc_ReadGroup();

Please see my example in attachment, it's modified from S32K344 ADC example, but you can use the same sequence for S32K312

0 Kudos
580 Views
shunyizhang
Contributor III

@cuongnguyenphu Hi,

Why is the ADC initialization interface in this example "NULL_PTR" so that the ADC can be used normally after initialization?

 

#define ADC_PRECOMPILE_SUPPORT (STD_ON)

#if (ADC_PRECOMPILE_SUPPORT == STD_ON)
Adc_Init(NULL_PTR);
#else
Adc_Init(&Adc_Config_VS_0);
#endif /* (ADC_PRECOMPILE_SUPPORT == STD_ON) */

0 Kudos