2024-05-03 07:23 AM
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.
Solved! Go to Solution.
2024-05-06 12:10 AM
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 ?
2024-05-03 08:05 AM - edited 2024-05-03 08:14 AM
Hi,
from ds :
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 :
>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 ;
then see:
>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.
What you get then ?
2024-05-06 12:03 AM
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.
2024-05-06 12:10 AM
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 ?
2024-07-24 01:38 AM
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?
2024-07-24 01:51 AM
Sure... :)
see ds:
here TEMP -> 30° and 110° given , where the CAL values are related to .
2024-07-24 01:52 AM
aha so (130 degrees - 30 degrees) / (TS_CAL2 - TS_CAL1) will do it.
2024-07-24 02:01 AM
110° - 30° .... :)
2024-07-24 02:03 AM
I'm using the stm32h747 so the values are bit differend i think.
2024-07-24 02:15 AM
On H747 ... 130 - 30° , your right.
Or misspelled (i assume) , because:
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.