Skip to main content
SLevi.1
Associate III
March 6, 2022
Question

How to measure STM32L452 internal temperature using HAL and DMA?

  • March 6, 2022
  • 2 replies
  • 854 views

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.

This topic has been closed for replies.

2 replies

TDK
March 6, 2022

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
SLevi.1Author
Associate III
March 6, 2022

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