cancel
Showing results for 
Search instead for 
Did you mean: 

How to measure STM32L452 internal temperature using HAL and DMA?

SLevi.1
Associate III

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.

2 REPLIES 2
TDK
Guru

Be aware the cal values are taken with VREF=3.0 V, so some conversion is necessary. Also ensure the sampling time is maximized.

If you feel a post has answered your question, please click "Accept as Solution".
SLevi.1
Associate III

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);