I am using FRDM-KL25Z development board. I found to read multi channel ADC, I have to read it twice to get the correct data. Seems like the result register didn't get updated for the first read. The issues cannot be exposed when reading single channel.
Here is the example,
ADC0_SC1A = ADC_SC1_ADCH(8);
rd1 = ADC0_RA;
while (ADC0_SC2 & ADC_SC2_ADACT_MASK);
while(!(ADC0_SC1A & ADC_SC1_COCO_MASK));
ADC0_SC1A = ADC_SC1_ADCH(8);
rd1 = ADC0_RA;
while (ADC0_SC2 & ADC_SC2_ADACT_MASK);
while(!(ADC0_SC1A & ADC_SC1_COCO_MASK));
I have to do the same algorithm twice. Anybody else got the same issue?
Did I miss anything here?
Btw, I am using Keil uVision as IDE. Thanks.