ADC_ETC results register not immediately ready in Done interrupt?

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

ADC_ETC results register not immediately ready in Done interrupt?

ソリューションへジャンプ
689件の閲覧回数
jackking
Senior Contributor I

I am testing the ADC and ADC_ETC (see my other threads).

During this testing I am seeing intermittently that the trigger result register isn't available immediately in the done interrupt.

In my test code, I am setting a variable to store the current result value in the done interrupt, but it is sometimes getting the previous value.  If I put a (1mS) delay in before setting the variable, it always gets the correct value from the result register.

Here is my example interrupt code that is not behaving as expected.

void ADC_ETC_IRQ0_IRQHandler(void)
{
     g_AdcConversionDoneFlag = true;
     g_AdcConversionValue = ADC_ETC_GetADCConversionValue(ADC_ETC, 0U, 0U); /* Get trigger0 chain0 result. */
     ADC_ETC_ClearInterruptStatusFlags(ADC_ETC, kADC_ETC_Trg0TriggerSource, kADC_ETC_Done0StatusFlagMask);
}

It seems that the result register is supposed to be updated *before* the interrupt fires?

タグ(1)
1 解決策
535件の閲覧回数
jamesbone
NXP TechSupport
NXP TechSupport

In your code, you first need to read the value of the ADC Result register, and then you need to clear the flag of the ADC to get next measurement.  This means that you get into the Interrupt once the Flag gets set,  read the data and clear the flag.

Have a nice day

元の投稿で解決策を見る

1 返信
536件の閲覧回数
jamesbone
NXP TechSupport
NXP TechSupport

In your code, you first need to read the value of the ADC Result register, and then you need to clear the flag of the ADC to get next measurement.  This means that you get into the Interrupt once the Flag gets set,  read the data and clear the flag.

Have a nice day