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.

[FAQ] PGA900: Questions Regarding the Coefficients Used in the PGA900, PGA300, PGA302, and PGA305 Devices

Part Number: PGA900
Other Parts Discussed in Thread: PGA300, , PGA305

Tool/software:

I'm trying to understand the polynomial used for the linearization and temperature compensation.  How do I calculate the coefficients and how are they used?

  • PGA900 is programmable and the example firmware project uses a 2nd order polynomial.  All PGA300, 302 and 305 devices use a 3rd order polynomial.  See the appropriate device datasheets for the structure used.

    The 3rd order polynomial will be used for this discussion which allows for 16 possible coefficients to be used. 

    • How the coefficients used?
      • A total combination of 16 coefficients can be used, and all 16 are used in a 4P4T calibration.  The simplest combination would be 2P1T, where the two pressure measurements would determine the gain slope for the measurement and outcome is the equation of a line where Y = mX + B.  Y is the DAC output, m is the measured slope of the two pressure points which becomes the G0 coefficient.  B is the offset value which is the H0 coefficient.  Adding more Pressure and Temperature readings for the calibration increases the number of coefficients used.  See the device datasheet for more details on the coefficients and how they make up the 3rd order polynomial.
    • How are the coefficients computed?
      • This is accomplished by linear regression.  Solve by using a system of equations which is accomplished using the two independent variables to solve for the dependent variable.  The system of equations utilize the same math as would be used when actually computing the values when solving the polynomial.  The total number of coefficients used is determined by multiplying the number of pressure values taken times the number of temperature values taken.  3P1T is 3, 3P2T is 6, 3P3T is 9, and 4P4T is all 16.  Other combinations would be calculated in a similar way.
    • What is the range of the coefficient values?
      • The coefficients will range up to  +/- 2, but in most cases you will see values much less than that.  The reason that the coefficients are of these values is the computation is normalized to 14-bits for 16-bit ADCs and 22-bits for 24-bit ADCs.  The PGA uses the coefficients multiplied to integer values and they are stored in the PGA EEPROM.  The values used for the EEPROM are integers instead of floating point as binary 2’s complement values.  The M0 processor does not have a floating point hardware engine, so keeping the values as integers allows for multiplication and division to be accomplished with right and left shifts of the computational result.
    • Is it possible to overflow the coefficient values when normalizing?
      • It is possible to create an overflow condition due to inaccurately adjusting the coefficients to binary 2’s complement integer values.  There can also be an overflow if the coefficient is multiplied by a factor greater than the normalization factor.
    • How are the coefficients stored?
      • The values of the coefficients are normalized to 22-bits for the PGA305 (as the ADC data is 24-bit).  For the other devices the normalization is 14-bit (as the ADC data is 16-bit).  The maximum range of the coefficients generated will be in the range of +/-2.  In most cases the outcomes will be fractional, but the storage of the coefficients themselves must become integer values so that they will be in range for the 24-bit EEPROM for the PGA305 and for the other devices it is 16-bit EEPROM that is space designated for this purpose.  The fractional coefficient values are first multiplied by 2^22 (or 2^14 for the non-PGA305 devices), but before storing to the EEPROM.  For the PGA305 an additional multiplication of 2^8 is required (or total of 2^30) so that the computation allows for the 24-bit values to be considered as the final outcome. 

    If you have selected the proper coefficient values, then entering the calibration points as pressure and temperature data into the polynomial should also show the desired DAC outcome.  If the result of the polynomial expression does not match the DAC result of the calibration data, make sure you have a non-zero value for ‘g0’ as this is the gain value for the most basic case.  Also verify the values used for temperature digital offset and gain, and also the pressure digital offset and gain are appropriately applied prior to the polynomial computation.

    Linear regression is best accomplished using matrix math either in Excel or Matlab.