Internal Temperature sensor delivers too high result
I am trying to get the internal CPU temperature on an STM32H743. Source is generated with STM32CubeMX V. 5.0.
When reading the internal temperature sensor (ADC3) I get different and too high values depending on the setting of the sampling time.
When set to
810.5 = 68.1 °C
367.5 = 66.9
64.5 = 88.74
I took the calculation formula from the manual which says:
Temperature (in °C) = (110 °C – 30 °C) / (TS_CAL2 – TS_CAL1) * (TS_DATA – TS_CAL1) + 30 °C
Here is my source code for reading the temp:
called in main: HAL_ADC_Start(&hadc3);
#define TEMP110_CAL_ADDR ((uint16_t*)((uint32_t)0x1FF1E840))
#define TEMP30_CAL_ADDR ((uint16_t*)((uint32_t)0x1FF1E820))
double adc_ReadInternalTemp(void)
{
static double dTemp;
static uint32_t raw_value;
static uint32_t T1_30;
static uint32_t T2_110;
raw_value = HAL_ADC_GetValue(&hadc3); // 0x39F3 at 64.5 sampling time
T1_30 = (int32_t)*TEMP30_CAL_ADDR; // reads 0x3073
T2_110 = (int32_t)*TEMP110_CAL_ADDR; // reads 0x3D63
dTemp = (double)(110 - 30) / (double)(T2_110 - T1_30);
dTemp *= (double)(raw_value - T1_30);
dTemp += 30;
return dTemp;
}
I don't know if I missed a factor which has to be included?
