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.

MSP430FR5969 internal temperature sensor

Other Parts Discussed in Thread: MSP430FR5969

Hi everybody,

I am using MSP430FR5969's internal temperature sensor and what I've reached so far is getting a value which increases when I put my finger on the microcontroller, which looks alright. The value that I read is not right at all though.

My conversion formula is:

temp in deg celsius = (adc reading - ADC20T30) * (85.0 - 30.0) / (ADC20T85 - ADC20T30) + 30.0

where ADC20Txx are the values relative to my reference positive voltage I use for the conversion (I use the 2.0V internal reference) from the TLV structure.

I also tried to imagine the temperature in degrees celsius is.

     alpha * adc reading + a constant

and computed alpha and constant in code from the calibration values at 30 and 85 degrees celsius, but I still get meaningless values.

So, does anybody know what is the correct formula for getting the temperature (in degrees celsius or another temperature scale)?


Thanks in advance.

  • Lorenzo,

    did you have a look at msp430fr59xx_adc12_10.c from the code-examples?

    #define CALADC12_12V_30C  *((unsigned int *)0x1A1A)   // Temperature Sensor Calibration-30 C
                                                          // See device datasheet for TLV table memory mapping
    #define CALADC12_12V_85C  *((unsigned int *)0x1A1C)   // Temperature Sensor Calibration-85 C
    
    ...
    
    // Temperature in Celsius. See the Device Descriptor Table section in the
    // System Resets, Interrupts, and Operating Modes, System Control Module
    // chapter in the device user's guide for background information on the
    // used formula.
    temperatureDegC = (float)(((long)temp - CALADC12_12V_30C) * (85 - 30)) /
                      (CALADC12_12V_85C - CALADC12_12V_30C) + 30.0f;
    
    // Temperature in Fahrenheit Tf = (9/5)*Tc + 32
    temperatureDegF = temperatureDegC * 9.0f / 5.0f + 32.0f;

    This is the formula that is used there.

    Dennis

  • Thank you for your reply.

    I am using that formula now, but I still get readings which are unexpected: about 6°C at room temperature, but I would be really cold if it was that cold there and I don't think the microcontroller unit is colder than the room...

  • Then I would try to run only the example and see if that produces reliable values.
  • Did you make ‘adc reading’ a long ((long)adc_reading)?
    Are you sure you got the right and valid TLV value’s?

    And to get a precise temperature you need also to calibrate first the reference voltage as well the ADC result (but this will not give you your big difference).
  • I have not calibrated the reference voltage. I am using the right calibration values for the temperature sensor, I don't know if they are valid. I use the 2.0V reference and I have calibration values (decimal) 1605 @30°C and 1900 @85°C. I use the same formula as in the example code. In my program, the temp variable is of type uint16_t and in the formula it undergoes the same cast to long. The example code gives plausible readings though, like about 25°C, there is something I am missing.
  • It looked like the sampling time was too short, because in fact I am using MODOSC which on the device datasheet is said to be 4.8Mhz, but I was adjusting the sampling timer for the wrong family of ADC channels. Results look aligned with the example program now.
  • When sampling the data, do you meet the minimum sampling time requirement? The temperature sensor is basically a temperature-dependent resistor (well, not exactly, but lose enough) fed by a constant current source. During charging the sampling capacitor, less current flows through the sensor reducing the reading. So it needs time to settle until the capacitor is charged, the current into the capacitor reaches zero and therefore all current goes through the sensor again.

    Be sure to have the adc reading in a signed variable, else you will get a huge result for temperatures below 30°C.
  • Thank you very much, I had solved this for some time now, but I was not able to post my solution for interested peers.
    It was exactly what you are saying, that is the minimum sampling time requirement + I missed to call the driverlib function to *enable* the ADC12B, which is normally disabled for power-saving reasons I believe.
    Thank you again anyway.

**Attention** This is a public forum