ADC interrupt not working on S32K144

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

ADC interrupt not working on S32K144

3,228件の閲覧回数
mrajanna
Contributor V

Hi,

I registered ADC interrupt, but it is never getting triggered.

I have battery input connected to ADC1 with channel 2, I am able to see battery value is changing but there is no ADC interrupt triggered.

ADC1 is the device and channel is 2.

Code Snippet:

ADC_DRV_ConfigConverter(1, &adConv1_ConvConfig0);
adConv1_ChnConfig0.channel = 2;

/* Configure ADC channel and software trigger a conversion */
ADC_DRV_ConfigChan(1, 0U, &adConv1_ChnConfig0);
/* Wait for the conversion to be done */
ADC_DRV_WaitConvDone(1);
/* Store the channel result into a local variable */
ADC_DRV_GetChanResult(1, 0U, &adcRawValue);

*************************************************************************

from S32k144.h

ADC0_IRQn = 39u, /**< ADC0 interrupt request. */
ADC1_IRQn = 40u, /**< ADC1 interrupt request. */

*************************************************************************

/* Install ADC ISR */
INT_SYS_InstallHandler(ADC1_IRQn, &ADCISR, NULL);

/* Enable ADC interrupt */
INT_SYS_EnableIRQ(ADC1_IRQn);

void ADCISR(void)
{

}

Can someone please review this and guide me.

Thanks

Mohan

ラベル(1)
タグ(1)
0 件の賞賛
返信
5 返答(返信)

2,516件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

Did you enable interrupts in the ADC driver?

pastedImage_1.png

Regards,

Daniel

2,516件の閲覧回数
mrajanna
Contributor V

Hi Daniel,

On every ADC conversion, it seems interrupt is getting triggered.

Can you please guide me to trigger the interrupt only on certain value change.

Thanks

Mohan

0 件の賞賛
返信

2,516件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Mohan,

 

The compare function is described in Chapter 39.5.5 of the RM. There are six compare modes configurable in SC2 register. And the result is compared to CV1-2 values.

S32K_ADC_Compare.png

 

Regards,

Daniel

0 件の賞賛
返信

2,516件の閲覧回数
mrajanna
Contributor V

Thanks Daniel.

Interrupt is now triggering for that particular ADC channel.

2,228件の閲覧回数
Rwaghmare
Contributor I

Hi mrajanna,

Can you elaborate how you used hardware compare function and how you configured particular ADC channels and it's values?

0 件の賞賛
返信