3.1 Gain Compensation Scheme

The gain error compensation is based on a two-point linear correction scheme. Given that the ADC has already automatically performed offset calibration, the zero point is used in conjunction with a near full-scale reference voltage. An internal 15/16 * AVDD calibration reference (CalrefH) is provided on one of the ADC inputs. It is recommended to use oversampling when measuring CalrefH to improve accuracy. Only one ADC instance can be connected to CalrefH at a time. The sampling time requirement for the CalrefH source is defined in the Electrical Characteristics section of the device-specific data sheet. Once converted, the compensation coefficient can be computed and stored in RAM. The compensation coefficient is then applied to the ADC results for the application. In summary, the procedure is as follows:

For each ADC instance:

  1. Verify that the automatic calibration is complete by reading the ADRDY bit.
  2. Select any ADC channel and configure the input for the CalrefH source.
  3. Measure the CalrefH voltage using oversampling.
  4. Compute the compensation coefficient and store it in RAM.
  5. Apply the associated ADC compensation coefficient to the result data.

If an offset calibration is subsequently performed, the gain error calibration remains valid and does not need to be redone. However, if the device resets or the ADC is reset, the gain error procedure needs to be performed again.