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.

MSPM0G3507: Variations and deviations in temperature measurement

Part Number: MSPM0G3507

Hi,

this is a follow up thread to this one, where I was not able to calculate a plausible temperature value.

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1320544/mspm0g3507-unable-to-calulate-internal-temperature

I now have tested multiple pieces of hardware and these are the results:

  1. ADC Value: 1920
    Temp Value: 6.8°C
    Memory:
  2. ADC Value: 1905
    Temp Value: 12.1°C
    Memory:
  3. ADC Value: 1909
    Temp Value: 8.3°C
    Memory:
  4. ADC Value: 1889
    Temp Value: 12.4°C
    Memory:
  5. ADC Value: 1907
    Temp Value: 7.4°C
    Memory:

The calculation is done according to the reference manual:

V_SAMPLE = ADC_VALUE * 1.4V / 4096
V_TRIM = 3.3V * DL_SYSCTL_getTempCalibrationConstant() / 4096
T_SAMPLE = (1/-0,002044) * (V_SAMPLE - V_TRIM) + 30°C


The measurement was taken at room temperature. So as you see all measured temperature values are too low. And there are variations from min to max of 6°C. My application depends on a stable and transferable measurement process. It is not possible to add another layer of calibration.

So is there something wrong with my calculation or what can I do to improve my temperature calulcation.

Best Regards,
Sebastian


  • Hi Sebastian, 

    Can you give the  DL_SYSCTL_getTempCalibrationConstant() return value?

    B.R.

    Zoey

  • Here are the calibration values:

    1. 756
    2. 763
    3. 755
    4. 757
    5. 752

    Best Regards,

    Sebastian

  •  Hi Sebastian,

    The trim value seems to be correct. 

    Have you tried to use demo code in SDK to have a try? ...\ti\mspm0_sdk_1_30_00_03\examples\nortos\LP_MSPM0G3507\driverlib\adc12_internal_temp_sensor_mathacl

  • Hi,

    I just tried the example code you mentioned. I copied the code in my application and it looked like this:

        uint32_t       adcResult;
        _iq15          qVSample, qTsample, qVTrim;
        volatile float gTemperatureDegC;
    
        // store value for debug purpose
        m_AdcTemp = AdcTemp;
    
        adcResult = m_AdcTemp;
    
        /*
         * Convert TEMP_SENSE0 result to equivalent voltage:
         * Vtrim = (3.3*(TEMP_SENSE0 -0.5))/(2^12)
         */
    
        qVTrim = _IQ15div(
            _IQ15mpy((_IQ15(DL_SYSCTL_getTempCalibrationConstant()) - _IQ15(0.5)), _IQ15(3.45)), ((uint32_t)(1) << 27));
    
        /*
         * Convert ADC result to equivalent voltage:
         * Vsample = (VREF_VOLTAGE_MV*(adcResult -0.5))/(2^ADC_BIT_RESOLUTION)
         */
    
        qVSample = _IQ15div(_IQ15mpy((adcResult << 15) - _IQ15(0.5), _IQ15(ADC_VREF_VOLTAGE)), _IQ15(ADC_BIT_RESOLUTION));
    
        /*
         * Apply temperature sensor calibration data
         * TSAMPLE = (TEMP_TS_COEF_mV_C) * (qAdcResultV - vTrim) + TEMP_TS_TRIM_C
         */
        qTsample = _IQ15mpy(_IQ15(TEMP_TS_COEF_mV_C), (qVSample - qVTrim)) + (TEMP_TS_TRIM_C << 15);
    
        gTemperatureDegC = _IQ15toF(qTsample);
    
        m_Temperature = static_cast<int32_t>(gTemperatureDegC * 10);

    This now runs on my hardware #5. And the result is 20.1°C.

    • The temperature of 20.1°C is better than before. Like yesterday I measure it at room temperature and therefore I would expect a chip temperature of 25°C to 30°C?
    • The calculation is based on a reference voltage for VTrim of 3.45V, which seems incorrect for me (see formula of qVTrim). If I change it to 3.3V I get a chip temperature of 3.2°C which is worse. What is right here?

    Thanks,

    Sebastian

  • Hi Sebastian,

    I also find this strange code there. I will write e-mail to ask our system and software team. Once I get information, i will tell you.

  • Hi Zoey,

    do you have any news for me regarding this issue?

    Thanks,

    Sebastian

  • Hi Sebastian.

    1.Our system team said the 3.45 is a typo, it should be 3.3.

    2.There is a slight deviation for older launchpad trim value.

       And I just apply for a new Launchpad, which I have a tested. The result is right as I changed to 3.3.

    For your information:

    New one trim value: 0x31E

    Old one trim value:0x2FE

    B.R.

    Zoey