cancel
Showing results for 
Search instead for 
Did you mean: 

Internal Temperature sensor delivers too high result

GS1
Senior III

I am trying to get the internal CPU temperature on an STM32H743. Source is generated with STM32CubeMX V. 5.0.

When reading the internal temperature sensor (ADC3) I get different and too high values depending on the setting of the sampling time.

When set to

 810.5 = 68.1 °C

 367.5 = 66.9

 64.5 = 88.74

I took the calculation formula from the manual which says:

Temperature (in °C) = (110 °C – 30 °C) / (TS_CAL2 – TS_CAL1) * (TS_DATA – TS_CAL1) + 30 °C

Here is my source code for reading the temp:

called in main: HAL_ADC_Start(&hadc3);

#define TEMP110_CAL_ADDR   ((uint16_t*)((uint32_t)0x1FF1E840))

#define TEMP30_CAL_ADDR      ((uint16_t*)((uint32_t)0x1FF1E820))

double adc_ReadInternalTemp(void)

{

   static double dTemp;

   static uint32_t raw_value;

   static uint32_t T1_30;

   static uint32_t T2_110;

   raw_value = HAL_ADC_GetValue(&hadc3);   // 0x39F3 at 64.5 sampling time

   T1_30 = (int32_t)*TEMP30_CAL_ADDR;   // reads 0x3073

   T2_110 = (int32_t)*TEMP110_CAL_ADDR;   // reads 0x3D63

   dTemp = (double)(110 - 30) / (double)(T2_110 - T1_30);

   dTemp *= (double)(raw_value - T1_30);

   dTemp += 30;

   return dTemp;

}

I don't know if I missed a factor which has to be included?

1 ACCEPTED SOLUTION

Accepted Solutions
S.Ma
Principal

Did you run ADC calibration first?

Also you are measuring the die temperature, not the ambient, so it's normal to get higher temperature if the chip is consuming energy. You can get package temperature with IR temperature gun vs ambient for more clues.

View solution in original post

3 REPLIES 3
Geoffrey1
Associate III

What is the supply voltage ? You may have to compensate for that. I've never used the stm32H parts, but I believe that some parts are calibrated at 3V and others at 3.3V. You raw temperature reading may need to be adjusted. The stm32H743 reference manual has a section about this : Converting a supply-relative ADC measurement to an absolute voltage value

S.Ma
Principal

Did you run ADC calibration first?

Also you are measuring the die temperature, not the ambient, so it's normal to get higher temperature if the chip is consuming energy. You can get package temperature with IR temperature gun vs ambient for more clues.

Ok, thank you for your hint. Actually the calibration was missing - didn't know that this is necessary in addition to reading the calibrated values for the formula. As is seems it shows senseful values of 36 ... rising up now to 46 °C. The system is running at full speed for a while and 46 °C make sense.