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.

Temperature Sensor Calibration

Other Parts Discussed in Thread: MSP430F5419A

We are using MSP430F5419A rev E in an application that will provide temperature to our customers. We want to use the internal temperature sensor and the calibration stored in the TLV area. We find however that the counts read from the sensor at room temperature is generally greater than the 85 degree calibration value. Are there issues with the calibration in the MSP430F5419A rev E?

  • Weird. Are you sure you correctly read right ADC channel using correct reference, it's buffer (if needed) and use correct TLV data?

  • I checked over my code for the things you mentioned and everything checked out, except that I'm not sure what buffer you are refering to. I am using the TLV's at 01A22h and 01A24h as the calibration at 2.5 volts. I attached a file that has a routines I am using to read temperature. I have tried a lot of variations of this with the same results.

    /*--------------------------------ReadA2D------------------------------*/
    uint16_t ReadA2D(uint8_t Channel)
    {
    	uint32_t Level;
    	uint16_t i;
    	const uint16_t Samples = 100;
    
    	ADC12CTL0 &= ~(ADC12ENC | ADC12ON);
    	if (Channel <= 7) P6SEL |= (0x01 << Channel);
    	else if (Channel >= 12)	P7SEL |= (1 << (Channel - 8));
    
    	while (REFCTL0 & REFGENBUSY);
    	if (Channel == 10) REFCTL0 = REFMSTR + REFVSEL_2 + REFON;
    	else REFCTL0 = REFMSTR + REFVSEL_2 + REFON + REFTCOFF;
    
    	//REFCTL0 &= ~REFMSTR;
    	//ADC12CTL0 = ADC12REF2_5V + ADC12REFON + ADC12SHT0_8 + ADC12ON;   // Sampling time, ADC12 on
    	ADC12CTL0 = ADC12SHT0_8 + ADC12ON;   // Sampling time, ADC12 on
    	ADC12CTL1 = ADC12DIV_1 + ADC12SHP;   // Do not run sample timer as at full speed
    	ADC12CTL2 |= ADC12REFBURST;
    	ADC12MCTL0 = ADC12SREF_1 + Channel;
    	ADC12CTL0 |= ADC12ENC;               // ENable Conversion ?
    	__delay_cycles(10000); //	WaitCentiSeconds(2);
    	//WaitCentiSeconds(2);
    
    	Level = 0;
    	for (i = 0; i < Samples; i++)
    	{
    		ADC12IFG = 0;
    		ADC12CTL0 |= ADC12SC;                     // Start sampling/conversion
    		//ADC12CTL0 |= ADC12ENC | ADC12SC;          // Start sampling/conversion
    	    while ((ADC12IFG & 0x01) == 0);
    		Level += ADC12MEM0;
    	    //while (ADC12CTL1 & ADC12BUSY);
    		//if (i != Samples - 1) WaitCentiSeconds(2);
    	}
    
    	ADC12CTL0 &= ~(ADC12ENC | ADC12ON);
    	REFCTL0 &= ~REFON;
    
    	return Level / Samples;
    }
    
    

  • Dwight Diener said:
    We find however that the counts read from the sensor at room temperature is generally greater than the 85 degree calibration value. Are there issues with the calibration

    This sounds familiar.

    Please check this thread with similar problem.

    It is about a different MSP, but it really sounds like there is a problem with the TLV data generation for the temperature sensor. I don't know how TI does the temperature calibration, but maybe there is a (newly introduced) bug somewhere in the process.

  • Thanks. I believe I am reading the calibration values correctly. They seem reasonble. On one unit I read the numbers 2316, 2640, 1748, 1989, 1387, 1578 starting at address 01A1Ah. This unit reads around 1586 counts on channel 10 at room temperature with 2.5 volt reference. It appears that either I am reading temperature incorrectly or the calibration is wrong.

     

  • Dwight Diener said:
    On one unit I read the numbers 2316, 2640, 1748, 1989, 1387, 1578 starting at address 01A1Ah.

    Yes, looks good.

    Dwight Diener said:
    This unit reads around 1586 counts on channel 10 at room temperature with 2.5 volt reference.

    Doesn't look good. Let's take a look at your code.

    Higher than expected readings usually happen when the reference is lowe than expected. However, since temperature sensor and ADC are sourced by the same reference, insufficient reference settling time can't be the reason. Also, if you accidentally selected VCC for the ADC, the reading would be lower than expected.
    A too-short sampling time would also result in a lower than expected reading.

    What is your VCC? is it high enough for 2.5V reference? Your init code for reference and ADC would be worth a second look too. It looks like a setup problem.

  • Our VCC is 3 volts, might that be the problem? I tried reading temperature with a 1.5 volt reference and got 2294 counts. That is consistant with the 2316, 2640 cal values for 1.5 volts.

    I included a code file in an earlier post on this topic.

  • Jens-Michael Gross said:

    However, since temperature sensor and ADC are sourced by the same reference, insufficient reference settling time can't be the reason.

    Just a heads up that the temperature sensor is "powered" by the band-gap reference, not by the REF module's selectable reference voltage (1.5 / 2.0 / 2.5), which is the output of an amplifier.  So the temperature sensor does not necessarily provide a ratiometric measurement.

    Can you try the measurements without REFBURST?

    Jeff

  • Jeff Tenney said:
    the temperature sensor is "powered" by the band-gap reference, not by the REF module's selectable reference voltage (1.5 / 2.0 / 2.5), which is the output of an amplifier.

    Where did you get this info from? The users guide only tells

    "For the MSP430F54xx (non-A) devices, which do not include the REF module, selecting the temperature sensor by configuring INCHx = 1010 automatically enables the reference generator required for the temperature sensor."

    Which means that the temperature sensore is powered by the reference. Whether it is done by the band-gap itself or by the amplified output, is untold. However, it is likely that the amplified output is used. Because the temperature sensor draws a significant current, which would influence the band-gap voltage if directly drawn. (and the reference voltage would be different for sensor on and sensor off) So it is likely taken after a buffer (the amplifier).
    Now the temperature sensor is current-driven. The shrinking values for higher reference voltage indicate that its output voltage is (more or less) the same, independently of the selected reference voltage. This might indicate a constant supply voltage. However, this may as well have been done by matching the current driver to the different reference voltages. In any case, the reference needs to be enabled, and its settling time needs to be met. Also, the required sampling time.

    Jeff Tenney said:
    the temperature sensor does not necessarily provide a ratiometric measurement.

    Not regarding its supply voltage. But regarding supply current. Because it is constant-current driven. Either supply ccurrent is supply-voltage independent (which is unlikely because then you could use VCC for the sensor too, and wouldn't need to switch the reference on) or each reference settign as a specifically tailored constant current generator that provides the same current for the different reference voltages. Which is way more likely.

  • Jens-Michael Gross said:
    Where did you get this info from?

    From 26.2 in the user manual. "Lastly, the REFGEN subsystem also includes the temperature sensor circuitry, because it is derived from the bandgap."  I didn't mean to imply an un-buffered bandgap.  As you say that wouldn't really work.

    Don't forget that there is a buffered version of the band gap reference available to the system. This fixed band-gap reference is ideal perfect for powering the temperature sensor (including its integrated current source).

    Jeff

  • You're right, Jeff. The REF module seems to produce an additional 1.2V reference directly form the bandgap. For the SD and the COMP modules. So at least on 5x family, the temperature sensor could be sourced by it. And the temp calibration values seem to fit for an 1.2V signal range for the different reference voltages.

    However, if you look at the ADC12 schematics (Fig. 28.1), the temp sensor is source by Ref_x, which is the output of the selectable reference. Since this is the only appearance of the temp sensor, either 28.1 is wrong/misleading or your assumption is wrong. I can't tell what's the truth :)

    Now the 54xx (non-A) as well as the other MSP families don't have a REF module. I wonder how it was done there.

**Attention** This is a public forum