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.

MSP430 Launchpad temperature sensor value

Other Parts Discussed in Thread: MSP430WARE, MSP430G2553

Hello All,

   I started the launchpad demo to check on the temperature value. I am getting 0x59 and 0x5A all the time. What does this mean? Is it the celsius reading? In that case it is too high!!!

Is there something else that is to be done to check the room temperature or it just measures CPU's heat?

Regards,

Vineet.

  • vineetrvce said:
    I am getting 0x59 and 0x5A all the time. What does this mean?

    AFAIK, it is in Fahrenheit, so 89/90°F which is ~32°C.

    vineetrvce said:
    Is there something else that is to be done to check the room temperature or it just measures CPU's heat?

    Well, the sensor is on the silicon, so how should it be able to read room temperature and ignore internal temperature?
    Hoeever, due to the very low poer consumption of the MSP, the sensor is still usable for a rough estimation of the room temperature. Usually, teh MSP is only one or two degrees above.

    The reading you get, is probably not properly calibrated, and the temperature sensor has a quite large variation across different devices. The values in the datasheet/users guide are just 'typical' values, but the real value significantly strays away from this.
    Soem MSPs have factory-provided, individual calibration values. The 2553 apparently doesn't.

  • Hi Vineet,

    There is an example code for using the temp sensor called msp430g2x33_adc10_temp.c (if you're using the G2553) found in MSP430Ware or in the code examples downloaded fromt the product page on ti.com - you have to do a little math on the value that comes out of the ADC to get degrees C or degrees F. You'll find the formula in the datasheet - for the G2553 (I'm assuming this is your part) this is on a footnote on the temp sensor specs on p. 40 of the datasheet - see footnote (2).

    Jens-Michael Gross said:

    Soem MSPs have factory-provided, individual calibration values. The 2553 apparently doesn't

    The G2553 does have temp sensor calibration constants. You'll find these listed in Table 11 of the MSP430G2553 datasheet.

    This is the best thing to use for your temperature calculation - you can do a two-point calibration as outlined in other threads on this forum using one of the two pairs of values depending on the internal reference that you use: CAL_ADC_15T85 and CAL_ADC_15T30 for the 1.5V ref, or CAL_ADC_25T85 and CAL_ADC_25T30 for the 2.5V internal reference.  Basically you'll be comparing the value from the ADC to these two measured reference points for 30C and 85C and determining your temperature relative to those points. This gives you the best temp sensor accuracy.

    Regards,

    Katie

  • Thanks for the feedback. Let me try this on my end first.

  • Katie Enderle said:
    The G2553 does have temp sensor calibration constants. You'll find these listed in Table 11 of the MSP430G2553 datasheet.

    Thanks for pointing this out. You see, even I am sometimes unable to locate every information in the datasheet. I looked in the ADC and temperature sensor sections (no info at all) and also searched for TLV structure (but no hit on 'TLV').

    The calibrated DCO frequencies are mentioned in a separate section, the ADC calibration values don't have any reference in the ADC section. If you don't know where it is, you don't know where to look for it :(

  • I am also trying to use the temperature calibration constants for the msp430g2553.

    The datasheet says it has them.

    but the msp430g2553.h header file does not have the definitions of any of the CAL_ADC_xxxxx variables.

    If I add them myself:

    SFR_16BIT( CAL_ADC_15T30 );

    SFR_16BIT( CAL_ADC_15T85 );

    I get them as undefined variables when I link, so the special linker file that patches these addresses up is also missing them.

    Once I get them, how are they to be used? What are the units? In other words, do you add or subtract them from the raw sensor reading, or are they voltages or something else that needs to be converted before being used?

    I found the datasheet for the part to be almost inexplicable. "Calibration data is stored for both the DCO and for ADC10 organized in a tag-length-value structure."

    It gives the address of the TAG_ADC10_1 as 0x10DA. It says the value is 0x10. When I look in memory at that address, I indeed see a 0x10 there.

    The datasheet says CAL_ADC_15T30 is at offset 8. So I look in memory at location 0x10DA+0x8 and say I want to look at signed 16 bit integers. The value is 754 on my chip. That looks suspiciously like a raw temperature sensor value for 30 degrees C.

    I do the same for the next word, and I get 890, which looks like a reasonable value for 85 degrees C.

    So I add these lines to my code:

    volatile unsigned int *CAL_ADC_15T30_PTR = (unsigned int *) 0x10DA+0x08;
    volatile unsigned int *CAL_ADC_15T85_PTR = (unsigned int *) 0x10DA+0x0A;

    ...and assume that the values are raw sensor values for those two temperatures.

    Now my problem is that I am getting a value of 756, which is just two points above the 754 value for 30 C. Now 30 C is 86 F. But when I measure the chip with a thermocouple attached to my multimeter, I only get 78 F. My infrared thermometer aimed at the top of the chip says 83 F, which is a lot closer, but still below the value the chip is sensing, by 3 degrees.

    So my question, besides the complaint that CAL_ADC_15T30 is not in the header file or the linker file, is: Should I expect a 3 degree difference between the surface of the chip and the sensor?

  • Katie,

    We are using a G2352 part which unfortueately doesn't have the ADC calibrations for temperature. We need to stay in this part for cost and size reasons. But we would still like to achive higher temperature accuracy than the sensor provdes unclaibrated. We have done some testing on some uCs and found that the slope of the ADC readings is very consistent and only the intercept varies from uC to uC. I guess this shouldn't come as a surprice as the user guide states this fact. We would like to do a one point calibration by appling a known temperature to the device (during manufacture) and have the uC do a temperature measurement. Then use this result to offset any variations in the part.

    What I am wondering is the following:

    1. Is this a reasonable approach, have you seen it done, do you have any documetation that would support our effort?

    2. What role does the tolerance of the 1.5 V volt reference play in the temperature measurement?

    3. What temperature characteistic does the voltage reference have?

       

     

  • because I got frustrated at the "half" calibration of the g2553 (only a value at 30 degrees c)

    "knowing" that the TCSENSOR ADC10ON = 1, INCHx = 0Ah (2) 3 V 3.55 mV/°C from the datasheet

    assuming that this is with the reference voltage 1.5V for the temp sensor and not an external 3V reference.

    Using the formula under the tabel where the tcsensor is defined I get to this for a "calibrated" temp sensor.

    VSensor,typ = TCSensor (273 + T [°C] ) + VOffset,sensor [mV]

    first rewriting formula to get VOffset,sensor with known data point.

    CAL_ADC_15T30/1024*1500 - 3.55 ( 273 + 30 ) =  VOffset,sensor

    second rewrite to get calibrated temperature with measured value

    ADC10MEM/1024*1500 = 3.55 ( 273 + tempcal ) +  CAL_ADC_15T30/1024*1500 - 3.55 ( 273 + 30 )

    3.55 ( 273 + tempcal )= ADC10MEM/1024*1500 - CAL_ADC_15T30/1024*1500 + 3.55 ( 273 + 30 )

    tempcal  = ( ( ADC10MEM/1024*1500 - CAL_ADC_15T30/1024*1500 + 3.55 ( 273 + 30 ) ) / 3.55 ) - 273

    However when I do this calculation I end up further away (25,5) from the air temp then the example 0 degree C  Offset voltage of 986mV

    Some extra info cal adc15t30 = 742

    raw adc value about 731

    example program MSP430G2x33/G2x53 Demo - ADC10, Sample A10 Temp and Convert to oC and oF

    says 23 and the air temp is that as well.

    Is the dy really 2.5 degrees warmer?

  • Hi Wouter,

    I'm unsure what you mean about "half" calibration and only having a value for 30 degrees C. According to the MSP430G2553 datasheet, Table 10 and 11, there should be temperature calibration values for 1.5V reference at both 30 and 85 degrees C, and 2.5V reference and both 30 and 85 degrees C. Were there not values at these locations for you?

    Regards,

    Katie

  • With half a calibration I mean that for the 15t30 (742) and 25t30(443) there is a reasonable value in the TLV register but for the 15T85 and 25T85 the value is 0000 and I am pretty sure that is not what the adc value was at 85 degrees C

  • Wouter,

    Could you post a small memory dump showing the TLV data from your part? The 20 bytes at 0x10DA for example.

    Regards,

    Katie

  • 0x10d4                       FFFF    FFFF    FFFF    1010    8017    0001    802D    02E6    0000    8096
    0x10e8                       01BB    0000    08FE    FFFF    FFFF    FFFF    FFFF    0801    8F8E    8E95

    And I am not the only one with this. see http://e2e.ti.com/support/microcontrollers/msp430/f/166/p/253954/890828.aspx  and the post of Jason Work

  • Hi Wouter,

    Thank you for posting this and the link to the other post - I will look into this. Could you please post what are the device markings from the top of your part as Jason did (this will help us have lot # information for tracking this down). If you don't want to post publicly you can send me a private message on the forum.

    Regards,

    Katie

     

  • Is there any "secret/privat" info in the chip markings?

    Anyway these are the numbers

    16CZ3KK A

    M430G2553

    p.s. the header files of the g2553 also do not include

    CAL_ADC_25T85
    CAL_ADC_25T30
    CAL_ADC_25VREF_FACTOR
    CAL_ADC_15T85
    CAL_ADC_15T30
    CAL_ADC_15VREF_FACTOR
    CAL_ADC_OFFSET
    CAL_ADC_GAIN_FACTOR

    Only these registers are available from the TLV

    CAL_BC1_1MHZ
    CAL_DCO_1MHZ
    CAL_BC1_8MHZ
    CAL_DCO_8MHZ
    CAL_BC1_12MHZ
    CAL_DCO_12MHZ
    CAL_BC1_16MHZ
    CAL_DCO_16MHZ


  • Wouter Portegijs said:

     Is there any "secret/privat" info in the chip markings?

    Nope, it's really just lot number information - it's there so we can track back to the specific fab, test facility, etc that this part came from (if we ever need to figure out if there's something in the process that went wrong). I only mentioned it because some people just get worried about posting things sometimes and prefer to be secretive. :-)

    Wouter Portegijs said:

     the header files of the g2553 also do not include

    CAL_ADC_25T85
    CAL_ADC_25T30
    CAL_ADC_25VREF_FACTOR
    CAL_ADC_15T85
    CAL_ADC_15T30
    CAL_ADC_15VREF_FACTOR
    CAL_ADC_OFFSET
    CAL_ADC_GAIN_FACTOR

    Only these registers are available from the TLV

    CAL_BC1_1MHZ
    CAL_DCO_1MHZ
    CAL_BC1_8MHZ
    CAL_DCO_8MHZ
    CAL_BC1_12MHZ
    CAL_DCO_12MHZ
    CAL_BC1_16MHZ
    CAL_DCO_16MHZ

    I will definitely file this against our header files as something that should be updated if possible, because it will make the calibration values easier to use.

    Regards,

    Katie

  • Wouter Portegijs said:
    first rewriting formula to get VOffset,sensor with known data point.
    CAL_ADC_15T30/1024*1500 - 3.55 ( 273 + 30 ) =  VOffset,sensor
    second rewrite to get calibrated temperature with measured value
    ADC10MEM/1024*1500 = 3.55 ( 273 + tempcal ) +  CAL_ADC_15T30/1024*1500 - 3.55 ( 273 + 30 )

    In your formula, you use the reference voltage and ADC resolution in both directions. You can optimize both out of the formula.

    After all, the calibration values are the reading in ADC10MEM at the given temperature.
    However, with only one calibration point you simply cannot calculate offset and gain. YOu have one two variables but only one formula. It gives an unlimited number of offset/gain combinations. The 'typical' value for the offset is pretty much useless. Without two calibraiton points, all you can do is to notice increase or decrease of temperature. everything else is unreliable.

    Wouter Portegijs said:
    Is the dy really 2.5 degrees warmer?

    2.5° isn't much. The case datasheet tells you the die/ambient temperature coefficient. Likely in teh range of 100°/W, so 25mW give 2.5° difference. And this is only an average value. Certain spots on the die can be much higher, near active components (especially near the port pin drivers).

  • Jens-Michael Gross said:

    first rewriting formula to get VOffset,sensor with known data point.
    CAL_ADC_15T30/1024*1500 - 3.55 ( 273 + 30 ) =  VOffset,sensor
    second rewrite to get calibrated temperature with measured value
    ADC10MEM/1024*1500 = 3.55 ( 273 + tempcal ) +  CAL_ADC_15T30/1024*1500 - 3.55 ( 273 + 30 )

    In your formula, you use the reference voltage and ADC resolution in both directions. You can optimize both out of the formula.

    [/quote]I know some more maths is needed to clean up and then some more to make it easy to calculate for the micro. It was more for me to remember that I did this and for others to be helped hopefully

    After all, the calibration values are the reading in ADC10MEM at the given temperature.
    However, with only one calibration point you simply cannot calculate offset and gain. YOu have one two variables but only one formula.

    I have one variable and I assume the 3.55 ;)
    It gives an unlimited number of offset/gain combinations. The 'typical' value for the offset is pretty much useless. Without two calibraiton points, all you can do is to notice increase or decrease of temperature. everything else is unreliable.
    Just making due with what the chip had to offer, hoping that the 3.55 was fairly constant over all the chips and using the one calibration point to get closer to the die temperature.

    Is the die really 2.5 degrees warmer?

    2.5° isn't much. The case datasheet tells you the die/ambient temperature coefficient. Likely in teh range of 100°/W, so 25mW give 2.5° difference. And this is only an average value. Certain spots on the die can be much higher, near active components (especially near the port pin drivers).

    [/quote]I was looking for the that value but could not find it quickly enough so I just figured .. does not matter that much to me.

  • Wouter Portegijs said:
    Just making due with what the chip had to offer, hoping that the 3.55 was fairly constant over all the chips and using the one calibration point to get closer to the die temperature

    Well, 3.55 is fairly average over all the MSPs. But very far from being constant. The calibraitons values are there because they are needed and cannot be replaced by a simple assumption. Or do you have any other explanation why TI should make a measurement at 85° and store it into the TLV if it isn't really needed?

    With a careful 2-point calibration (not using the TLV values at all) , the ADC12 gives me 0.2°C resolution and 0.5°C absolute precision at room temperature. (MSP inactive except for the ADC). With an external NTC, I got 0.01°C resolution and 0.2° absolute error in the interesting range. Since it was an external sensor, the die temperature and therefore the MSP's active state was unimportant. And the external circuit was stretching the sensor output so in the range of interest, it spans most of the MSPs ADC input range. (the application was regulating the temperature of a laser diode and the attached frequency doubler. 8W green light output pumped with 80W infrared diode -  with up to 30kHz output power modulation for a laser show.)

  • Jens-Michael,

    Could you please go into more detail as to how you archived "0.2°C resolution and 0.5°C absolute precision "

     

    I see you are using a 12 bit ADC, which MSP part are you using?   

  • Chris_CBC said:
    Could you please go into more detail as to how you archived "0.2°C resolution and 0.5°C absolute precision "

    Well, the temperature sensor roughly spans 0.6 to 0.9V for the operating range of 150°C. This roughly gives 2mV per °C.

    The ADC12 with 1.5V reference gives a resolution of 0.366mV per count, which results in 5.46 counts per °C. Or 0.18°C steps. With some averaging (temperature is a statistical value, so there's a lot of noise on the sensor), readings are quite stable. Of course the effective resolution is not exactly 0.20°C and varies slightly, depending on each different MSPs variation of the sensor output.

    The precision is directly derived from taking two measures at two different temperatures, assuming identical self-heating in both cases, and calculating offset and gain. Must be done for each MSP separately.

    Well, it is time consuming, to do such a calibration when the chip is already mounted, but for a $1000 device, one can spare a few minutes for calibration. Especially if one can do other things while the device is warming up.

  • Right, I understand the math, that is pretty much straight forward.

    I think I was more interested in issues like what calibration temperatures are you using? And your approach / process WRT allowing the board temperature to come to equilibrium.

    How far apart do you find is most effective for the calibration temperatures? Usually I would think that the further apart these values are, the better the calibration will be. Unfortunately the further apart they are, the more arduous the calibration process becomes. Did you find any sweet spot where you got a good calibration, while minimizing the time and effort required?

    I imagine that the self heating issue is due to the part predominately running in active mode rather than one of the LPMs? I would assume the self heating is minimal in LPMs like 3 and 4.

  • Chris_CBC said:
    I think I was more interested in issues like what calibration temperatures are you using?

    Well, the resolution is independent of the calibration temperatures.
    The precision might indeed depend on them. Mainly because of the limited precision of the calibration process itself. The larger the temperature difference, teh more the absolute error of the calibration process "thins out".
    For the application, we require precise data only in a small temperature range. Assuming a totally linear sensor reading, it is of course best to have the two points as far apart as possible. However, it is sufficient to use room temperature and 60-70°C in an oven. We attached a precision thermometer with digital output to the MSP and it just keeps reading the external thermomenter and making samples from the internal sensor until the readings are in the specified region and stable over some time.

    Since this device was done in very low numbers (about 30 or 50 per year), this simple approach was - despite of being a bit time-consuming - much cheaper than anything else.

    Chris_CBC said:
    I imagine that the self heating issue is due to the part predominately running in active mode rather than one of the LPMs? I would assume the self heating is minimal in LPMs like 3 and 4.

    Depends on what you do. If your driver an LED by the ports, you'll have siginficant self-heating even in LPM4. The additional power of a running CPU would be negligible.
    In fact, we have the CPU lighting all LEDs and operating all other parts (timers, ADC) like during normal operation. So while the temperature sensor then reports a higher temperature, the calibration process effectively cancels this out.

**Attention** This is a public forum