2022-03-06 05:23 AM
Is there a step-by-step example anywhere, known to work? I have followed numerous examples from several forums, but still no luck. The ADC value I get from the internal temperature sensor is always around 880. This equates to around 1 degree celcius when using the calibration values inside the chip. I do not see frost on my STM32L452 Nucleo board, so I know it is plain wrong. I have measured the power supply with a multimeter and vrefint using the ADC;both are 3.3v, so that is not the problem.
2022-03-06 08:04 AM
Be aware the cal values are taken with VREF=3.0 V, so some conversion is necessary. Also ensure the sampling time is maximized.
2022-03-06 10:36 AM
I am using the HAL macro to do the calculation, so I would assume the 3.3/3.0 issue would be taken account of. I also have an insanely long sampling time; it made very very little difference.
temp = __HAL_ADC_CALC_TEMPERATURE(3300, val, ADC_RESOLUTION_12B);