This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
The offset error calculated using the method described in the TRM can be negative (conversion results lower than expected) or positive (results higher than expected). The contents of the ADCALR register get added to each conversion result output from the ADC core before they are stored in the results memory. The application must compute the 2's complement of the error value calculated and store it in the ADCALR register.
For the given example, the assumptions are that the VREFLO is 0V and VREFHI is 3.3V. Using the expected conversion result equation (EQ-1) on page 728 of the TRM, the mid-point conversion result must be 4096 * 0.5 = 2048.
If the calibration method calculates a mid-point of 2048.5, this means that the ADC has a positive offset. Let's round off the error to 1 count (mid-point of 2049). In that case, the application must subtract 1 from each conversion result to compensate for this error. The 2's complement of -1 is 0xFFF in a 12-bit representation. Therefore, the application must store 0xFFF in the ADCALR register.
Regards,
Sunil