Have a few general questions about ADC calibration for S32K and KE18F. S32K ADC Calibration seems to very similar to what is done in the KE18F, but still some things are unclear:
- Should the resulting CLPx values be range-checked as described in AN5314 4.3 Table 2?
- In S32K_SDK_S32K1xx_RTM_4.0.3.zip, platform\drivers\src\adc\adc_driver.c:ADC_DRV_AutoCalibration() the poll for calibration complete is based on ADC_GetCalibrationActiveFlag() which checks SC3[CAL] rather than SC1A[COCO], as described in the S32K Reference Manual 44.5.6
- In KE18F MCUXpresso SDK devices\MKE18F16\drivers\fsl_adc12.c: ADC12_GetCalibrationStatus() some of the range-checks use unsigned values that could be susceptible to rollover
The CLPS range-check prevents underflow for the CLP0 check, which prevents it for the CLP1 check, but the CLP2 check seems susceptible to it.
Both CLP0 and CLP1 have to be >= 16, but Type1 can be as small as 6, so Typ1 – 20U could be negative …