Skip to main content
Associate
May 6, 2024 8:32 AM UTC
Question

STM32H743 Internal CPU Temperature

 

Hello, I am trying to calculate the internal CPU temperature on an STM32H743, When reading the internal CPU temperature sensor using ADC3 IN18 (internal temperature), I get a very high value (~731C)
The formula I'm using is the following :

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

Here is the algorithm to read the temp :

  1. Initialise ADC3 
  2. Calibrate ADC3
  3. ADC3 Start DMA "Reading ADC3 values via DMA, Temperature sensor values are inside ADC_CHANNEL_TEMPSENSOR rank 11"
  4. Start TIM6 (PSC = 10, ARR=59999) for the sampling frequency of the ADC3,  and the samplingTime is  810.5
  5. Calculate TS_CAL1, TS_CAL2 
  6. Convert ADC value to C°

Here is the code :

MX_ADC3_Init();
HAL_ADCEx_Calibration_Start(&hadc3,ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED);
HAL_ADC_Start_DMA(&hadc3, (uint32_t *)&DMABuff[0], 11);
HAL_TIM_Base_Start_IT(&htim6);

const uint16_t* ADC_TEMP_3V3_30C = (uint16_t*)(0x1FF1E820);
const uint16_t* ADC_TEMP_3V3_110C = (uint16_t*)(0x1FF1E840);

float adcCalTemp30C = (float) (*ADC_TEMP_3V3_30C);
float adcCalTemp110C = (float) (*ADC_TEMP_3V3_110C);

float32_t Temperature = (110  – 30 ) / (adcCalTemp110C – adcCalTemp30C ) * (DMABuff[10] – adcCalTemp30C ) + 30;
I don't know if I missed something that has to be included?
Kind regards
Anas,


This topic has been closed for replies.

13 replies

AScha.3
Super User
May 6, 2024 8:47 AM UTC

Hi,

did you set Tsen ?

AScha3_0-1714985219896.png

 

If you feel a post has answered your question, please click on " Best Answer ".
anasbaAuthor
Associate
May 6, 2024 9:18 AM UTC

Hello, thanks for the reply 
Yes indeed I set the TSEN with the following : 
ADC3_COMMON->CCR |= ADC_CCR_TSEN;
And then I run the calibration 

anasbaAuthor
Associate
May 6, 2024 1:01 PM UTC

@AScha.3 It is still showing the same output even thought I enabled TSEN 

ADC3_COMMON->CCR |= ADC_CCR_TSEN;
HAL_ADCEx_Calibration_Start(&hadc3,ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED);

Any ideas ? 
many thanks

Billy OWEN
ST Employee
May 7, 2024 6:39 PM UTC

Hi @anasba 

 

This post has been escalated to the ST Online Support Team for additional assistance.  We'll contact you directly.

 

Regards,

Billy

Associate III
May 9, 2024 1:11 AM UTC

Hey, 

I'm facing similar issue on H743VIT6. Internal temperature is almost 10 times. Even the 3.3V sensing is wrong. I'm using the H743VIT6 rev V. 

1000035341.png

1000035340.png