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 …
Hi
Q:Should the resulting CLPx values be range-checked as described in AN5314 4.3 Table 2?
A: Yes. You'd better check calibration result. S32K1 SDK did not check calibration result, I think it is because it is optional, as mentioned in Figure 6. ADC calibration flow chart.
CAL is cleared when the calibration sequence is completed, so I think ADC_GetCalibrationActiveFlag is OK.
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Thank you @Robin_Shen ,
That clears things up for the first two. Do you have any insight about the range checking breakdown at the end of the question?