Skip to main content
Visitor II
May 3, 2024
Solved

STM32H750 internal temperature sensor wrong reading

  • May 3, 2024
  • 1 reply
  • 3047 views

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.

 

 

    This topic has been closed for replies.
    Best answer by AScha.3

    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 ?

    1 reply

    Super User
    May 3, 2024

    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 ?

    Serge76Author
    Visitor II
    May 6, 2024

    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.

      

    AScha.3Answer
    Super User
    May 6, 2024

    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 ?