read adc without interrupt in s32k312,

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

read adc without interrupt in s32k312,

跳至解决方案
2,245 次查看
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 项奖励
回复
1 解答
2,213 次查看
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 项奖励
回复
5 回复数
2,208 次查看
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 项奖励
回复
2,197 次查看
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 项奖励
回复
2,202 次查看
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 项奖励
回复
2,214 次查看
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 项奖励
回复
1,508 次查看
shunyizhang
Contributor IV

@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 项奖励
回复