Spanish Italian
22379 Users    

Calibrating the eQADC module of the Freescale MCP5510 Microcontroller Family 2/2

  Download PDF version of the Article

The calibration revolves around the MAC (Multiply and Accumulate) unit of the eQADC which is used to implement the following transfer function which transforms a raw (uncalibrated) result into a calibrated one:
CAL_RES=GCC*RAW_RES+OCC+2 (EQ1)
where:
CAL_RES – the calibrated result corresponding to a particular input voltage
RAW_RES – the uncalibrated result corresponding to the same input voltage
GCC – gain calibration constant (determined during the calibration routine, performed once during start-up)
OCC – offset calibration constant (determined during the calibration routine, performed once during start-up)
The purpose of adding the 2 in the end of the formula is to reduce the maximum quantization error of the ADC.

The calibration routine is performed by taking two samples of known reference voltages and by using these two samples to calculate the values of GCC and OCC. The resulting values for these constants are stored in appropriate registers from where they are automatically fed to the MAC when needed. The OCC will always be a 14-bit unsigned value, while the GCC is a 15-bit fixed point unsigned value, and its decimal equivalent ranges between 0 and 1.999938. The absolute values of the two constants may be computed from the equation mentioned above, by taking two samples of know reference voltages for which, obviously, the ideal result is known.

These two known reference voltage levels are 25%VREF and 75%VREF, which can be brought to the input of the ADC module by selecting channels 43 and 44 respectively. Channels 43 and 44 do no have corresponding physical pins, and they are internally connected to dividers which generate 0.25VREF and 0.75VREF.

The raw, uncalibrated results for these input voltages are obtained by converting these channels with conversion commands that have the CAL bit negated.
The transfer equations for when sampling these reference voltages are:
CAL_RES75%VREF = GCC * RAW_RES75%VREF + OCC +2;
CAL_RES25%VREF = GCC * RAW_RES25%VREF + OCC +2;
CAL_RES75%VREF and CAL_RES25%VREF represent known values, corresponding to the ideal transfer function (the green line in the graph illustrated before).
The two equations above allow us to obtain the values of the two constants:
GCC = (CAL_RES75%VREF - CAL_RES25%VREF ) / (RAW_RES75%VREF - RAW_RES25%VREF );
OCC = CAL_RES75%VREF - GCC*RAW_RES75%VREF – 2 ;
Once calculated, the two constants have to be written in the appropriate registers and after that, the eQADC module will always apply (EQ1) to all raw results obtained from the conversion, in case this is requested through the CAL bit in the conversion command.
Below, there is a step by step initialization procedure indicated in the microcontroller family reference manual:
1. Convert channel 44 with a command that has its CAL bit negated and obtain the raw, uncalibrated result for 25%VREF (RAW_RES25%VREF).
2. Convert channel 43 with a command that has its CAL bit negated and obtain the raw, uncalibrated result for 75%VREF (RAW_RES75%VREF).
3. Because the expected values for the conversion of these voltages are known (CAL_RES25%VREF and CAL_RES75%VREF), GCC and OCC values can be calculated using these values and the results determined in steps 1 and 2.
4. Reformat GCC and OCC to the proper data formats; GCC is an unsigned 15-bit fixed point value and OCC is a signed 14-bit value.
5. Write the GCC value to ADC0 gain calibration register (see Section 31.3.4.4, “ADC0 Gain Calibration Constant Register (ADC0_GCCR)”) and the OCC value to ADC0 offset calibration constant register (see Section 31.3.4.5, “ADC0 Offset Calibration Constant Register (ADC0_OCCR)”) using write configuration commands.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Who's new

  • spiiel
  • juands
  • mariuqs
  • dennis612b
  • marcosperez
  • saran
  • yfchen58
  • kolas
  • seban
  • cqtsm

Who's online

There are currently 1 user and 62 guests online.

Online users

  • suresh1953