cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H750 internal temperature sensor wrong reading

Serge76
Associate II

Dear community,

 

on the ADC3 IN18 (internal temperature), I have an unconsistancy between the output of the ADC (reflecting the value of the temperature and the reference value TS_CAL1 and TS_CAL2 (0x3114 and 0x40C0).

the ADC is in 16 bits and I got a value from the ADC 0xA152.

When using the formulae converting the value from ADC to temperature, the result give 685 °C !!!!

I change the conversion scale to 12 bit, and now the result is -163°C.

it seems the reference value are fix whatever the ADC scale range. but nowhere I found a formulae explaining the influence of the conversion scale neither the influence of Vref.

we extend the sampling time to comply with the minimum 9 µs.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

the HAL_Delay(15) is just my idea , only once after init (set Tsense ) , just to have everything not at some "starting state". No need at all, if you using the adc temp data anyway some time later in program.

 

And - now get better result ?

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

11 REPLIES 11
AScha.3
Chief III

Hi,

from ds :

AScha3_0-1714747884974.png

You got : TS_CAL1  0x3114  (= 0,62V ) , so VDD 3,3V -> 0xFxxx <- 16 bit value ; so ADC in 16bit mode.

You should get something around : 0x3xxx .

Did you :

run ADC calibration first ?

HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);

then :

AScha3_1-1714748387915.png

>nowhere I found a formulae explaining the influence of the conversion scale neither the influence of Vref.

Vref is 3v3 ; if your VDDA=VREF is different, it just scales linear, no hidden secrets here ;

AScha3_4-1714749258168.png

 

then see:

AScha3_2-1714748435211.png

>we extend the sampling time to comply with the minimum 9 µs.

ok, set TSEN, but then wait a little ( HAL_Delay(15)) , before reading the ADC->temp input.

AScha3_3-1714748817101.png

What you get then ?

If you feel a post has answered your question, please click "Accept as Solution".

Hi AScha.3

Thanks a lot for your answer.

You confirm all points I asked (the verification of the reference temp as 0X3..., the ratio for the Vref).

I did the calibration.

But one point I did not mentioned in my question => We are using a DMA to read 11 input of the ADC3 (continous loop reading the 11 input, internal temp is the last input read). The Tsense bit is set to 1 at the init of the ADC, never put to 0 during the execution of the firmware.

As DMA is used, we cannot use HAL_Delay(15), but we are using TIM6 (PSC = 10, ARR=59999) for the sampling frequency of the ADC3,  and the parameter samplingTime of each input of the ADC3 is set to 810.5.

  

Hi,

the HAL_Delay(15) is just my idea , only once after init (set Tsense ) , just to have everything not at some "starting state". No need at all, if you using the adc temp data anyway some time later in program.

 

And - now get better result ?

If you feel a post has answered your question, please click "Accept as Solution".

May i ask where did you get the TS_CAL2_TEMP - TS_CAL1_TEMP from?
I know how to get TS_CAL2 and TS_CAL1 but how do you get TS_CAL2_TEMP and TS_CAL1_TEMP what do those stand for?

Sure... :)

see ds:

AScha3_0-1721810841182.png

here TEMP -> 30°  and 110° given , where the CAL values are related to .

 

If you feel a post has answered your question, please click "Accept as Solution".

aha so (130 degrees - 30 degrees) / (TS_CAL2 - TS_CAL1) will do it.

110° - 30° ....  :)

If you feel a post has answered your question, please click "Accept as Solution".

I'm using the stm32h747 so the values are bit differend i think.

MarkvdBurg_0-1721811826176.png

 

On H747 ... 130 - 30° ,  your right.

Or misspelled (i assume) , because:

AScha3_0-1721812302021.png

So how/why should they give a reference value at a temperature - thats nor allowed for the chip ???

+ On all others (H743, H750, H7A3 ..) 110° + 30°  are given.

 

If you feel a post has answered your question, please click "Accept as Solution".