AnsweredAssumed Answered

ADC_ETC results register not immediately ready in Done interrupt?

Question asked by Jack King on Aug 13, 2018
Latest reply on Aug 15, 2018 by jamesbone

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?

Outcomes