STM32G0 internal temperature invalid readout
Hello,
For some reason I'm unable to get valid readout of internal MCU temperature. Maybe someone have an ide why this might be happening? System is running on STM32G0B0 MCU. I init ADC over HAL generated code and enable only internal inputs (`ADC_CHANNEL_TEMPSENSOR`, `ADC_CHANNEL_VREFINT` and `ADC_CHANNEL_VBAT`), after init I run ADC calibration which reports that it did it's job. but when I start to read temperature periodically - every minute, I see following results (these are raw values domming from DMA so I assume it is `temp`, `Vref` and `Vbat`):
temp Vref Vbat
03B7 07E3 045B
050F 07E4 045D
0513 07E4 0460
0511 07E5 045B
0512 07E5 045B
0512 07E5 045A
0513 07E3 0457
0504 07E9 0481
0509 07E9 0488
0526 07EB 0497
0532 07ED 049C
051F 07EB 0499
0502 07E7 0482
0508 07E8 047B
050A 07E5 0475
0509 07E5 0470
050B 07E5 046F
050F 07E5 0470
050E 07E5 046D
050B 07E3 0467
0510 07E5 0466
0513 07E5 0465
0513 07E5 0466
050F 07E4 0467
0512 07E5 0464
050F 07E5 0463
0511 07E5 0464If I plot these values to a chart, I see following:
When using `__LL_ADC_CALC_TEMPERATURE()` function apart 1st read (shows -83, I assume *C), but later is calculated to ~ -16*C and high peak is -9*C.
This is when system starts at room temperature (~ 22*C) and is heated to ~ 65*C then left to cool down. this process is visible in char, but in terms of temperature is very inaccurate.
Any hints on where and what could be checked 1st? - particulat MCU factory calibrations are - TEMPSENSOR_CAL1(1037), TEMPSENSOR_CAL2(1386).
P.S. Some interesting notes - before calibration same device was reading values equal to ~23*C as base temperature, but when heating increase was around same magnitude. Other devices shows different base temperature - but increase, when changing is more or less same.
