Hi fan xy,
From my own opinion, I think this problem may relate to the printf code in the interrupt:
void ADC_1_IRQHANDLER()
{
if (kADC_ConvSeqAInterruptFlag == (kADC_ConvSeqAInterruptFlag & ADC_GetStatusFlags(ADC_1_PERIPHERAL)))
{
ADC_GetConvSeqAGlobalConversionResult(ADC_1_PERIPHERAL, gAdcResultInfoPtr);
gAdcConvSeqAIntFlag = true;
PRINTF("gAdcResultInfoStruct.result = %d\r\n", gAdcResultInfoStruct.result);
PRINTF("gAdcResultInfoStruct.channelNumber = %d\r\n", gAdcResultInfoStruct.channelNumber);
PRINTF("cnt = %d\r\n", cnt);
}
#if defined __CORTEX_M && (__CORTEX_M == 4U)
__DSB();
#endif
}
As you know, the PRINTF will consume lot of time, if in the printf code, another ADC channel already finished the ADC conversion, but this time ADC interrupt still not exit, then you will lost one Channel ADC interrupt. So, you must make sure your ADC interrupt code time smaller than the two ADC conversion time, then the test will be correct.
So, you can try to save the channel number and the result in the variable list, then printf it together in the main code, or you also can extend the ADC conversion time.
Wish it helps you!
If you still have question about it, please kindly let me know.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------