I try to test ADC calibration function, but when calibration over, the ADC_CALBISTREG.TEST_FAIL is set.
I don't know why. The following is source code.
p_ADC->MCR.B.PWDN = 1;
while(p_ADC->MSR.B.ADCSTATUS != 1); /* wait for powerdown */
p_ADC->MCR.B.ADCLKSEL = 0; /* ADC clock frequency is half of bus clock */
p_ADC->CALBISTREG.R = CAL_HIGH_ACCURACY_MODE | CAL_22_CYCLES | CAL_512_SAMPLES | CAL_AVAG_EN | CAL_TEST_FAIL_CLEAR;
p_ADC->MCR.B.PWDN = 0; /* power up */
while(p_ADC->MSR.B.ADCSTATUS != 0); /* wait for power up */
p_ADC->CALBISTREG.B.TEST_EN = 1; /* enable calibration */
/* wait for calibration complete, MSR.ADCSTATUS or CALBISTREG.C_T_BUSY */
/* get calibration result */
cal_result = p_ADC->CALBISTREG.B.TEST_FAIL;