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.

CC430 Temperature Reading

Other Parts Discussed in Thread: CC430F5137

Hi @ all,

I have a problem with the temperature sensor of the cc430F5137

I use the code of the example package but on different temperatures (-20°C to +60°C) the mesured temperature is still different.

After that i add an offset to the value (calibrated on 23°C). No success. e.g. on -20°C the temperature sensor shows -5°C.

The CC430 is a "final" version (not a XC430). May there are no ore bad calibration data in the TLV?

What can I do to get a correct working temperature sensor?

Thanks for help

Rest rgs

Thomas

  • The offset and gain values stray significantly between different devices. Also, the formula isn't that simple. If you do not carefully order the operations, you can easily hit the value range limit of the used variables and truncate the result in th emiddle of the formula. Then you're hosed and you won't notice why.

    If the calibraton values do not work, then you should do a 2-point calibration (e.g. at 20° and 40°C) to get offset and gain. It's also better to work with °K, so you can cope with negative °C values when calculating. Then subtract 273.16 from the result.

    You can also go and try with my own formula for the 5438. It gives the result in 1/10°C.

    At device startup calculate the following:

    unsigned long tOffset;
    unsigned int tFactor;

      // calculate tFactor/tOffset for temp channel
      tFactor = (((550UL)<<12)+150)
                /(
                    (*((unsigned int *)(0x1a1e + ((_SYSTEM_AD_REF & 1)?6:0))))
                   -(*((unsigned int *)(0x1a1c + ((_SYSTEM_AD_REF & 1)?6:0))))
                  ); // 550 is ref temp diff (1/10°), +150 is added for cheap rounding (calibration points are ~300 apart)
      tOffset = ((unsigned long)(*((unsigned int *)(0x1a1c +((_SYSTEM_AD_REF & 1)?6:0))))*tFactor)-(300UL<<12);

    When actually measuring the temperature, the result will be

    int temperature =((((long)ADC12MEM[x]*tFactor)-tOffset)>>12);

    where 'x' is the ADC12 channel which converted the temperature reading, _SYSTEM_AD_REF is either 1 or 0, depending on the used reference voltage.
    The above formula reduces the actual calculation to  simple operations: multiplication, subrtraction and a shift. The shifts are necessary to keep the result inside the 32bit range while keeping as many significant digits as possible before truncating to the final value.
    For an environment temperature (including self-heating of the MSP) of 24°C, the result would be 240.

    I have never tested this code for accuracy (the MSP5438 is still a 'new' device for me and not in an actual project), but the results seemed to be reliable depending on room temperature, cooling spray and my hot finger :)

**Attention** This is a public forum