Hi,
I am trying to implement 12-bit ADC using FRDM K22F board to sample a DC voltage. I have used auto-calibration function to calibrate ADC during initialization and the ADC gets calibrated successfully as indicated by CALF flag in SC3 register. I have observed that the total fluctuation in ADC Conversion results for 500 samples is more (6-7 counts). But when I add a long delay (intentional) after the auto calibration function is called, the fluctuation decreases to 4 counts. Does ADC take some more time before it is ready to sample the input signal accurately? If yes, then how can I ensure that ADC has completed auto calibration and is ready to sample the signal accurately?
The ripple in ADC input signal is very low.
The ADC initialization sequence is as follows:
adc16_config_t adc_config;
EnableIRQ(ADC0_IRQn);
ADC16_GetDefaultConfig(&adc_config);
adc_config.clockSource = kADC16_ClockSourceAlt0;/*Bus clock 60 Mhz*/
adc_config.clockDivider = kADC16_ClockDivider4;/*Divided by 4*/
adc_config.longSampleMode = kADC16_LongSampleDisabled;
ADC16_Init(ADC0, &adc_config);
while(kStatus_Success != ADC16_DoAutoCalibration((ADC0))
{
}
if(ADC16_GetStatusFlags((ADC0))
{
printf("failed");
}
/*
for (uint32_t p=0, p < 0xFFFFFFF, p++)
{
} /* intentional delay */
*/
ADC16_EnableHardwareTrigger((ADC0, false); /* Make sure the software trigger is used. */
ADC16_EnableDMA((ADC0, true);
Please help in resolving the issue.
Thanks and Best Regards,
Vaibhavi