Skip to main content
Associate II
November 29, 2025
Question

STM32L031C6 reading vdda & temperature

  • November 29, 2025
  • 2 replies
  • 221 views

Hi,
I have a custom board with an STM32L031C6 and I'm trying to read the internal temperature. The board is battery powered at about 2.6V and the vdda is the same.
If I read the ADC channel with vrefint, it returns a value of about 850, which, when passed to the function __LL_ADC_CALC_VREFANALOG_VOLTAGE(adcVal[4], LL_ADC_RESOLUTION_12B), returns a calculated VDDA of 6V, which is obviously incorrect.
Using this vref to calculate the internal temperature obviously results in a value that's out of range.
The same thing works correctly on a NUCLEO-C031.
What am I doing wrong?

Thanks!

2 replies

TDK
Super User
November 29, 2025

 

Make sure you're sampling for at least 10 us. Increasing sampling time to max will satisfy this.

TDK_0-1764438022607.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
TDK
Super User
November 29, 2025


> custom board with an STM32L031C6

Ensure VDDA is directly connected to VDD and has appropriate decoupling caps (0.1 uF + 1 uF) at the pin.

*Getting started with STM32L0xx hardware development

"If you feel a post has answered your question, please click ""Accept as Solution""."
UfoitAuthor
Associate II
December 2, 2025

Now I tried again on a new NUCLEO-L031K6 and the result is that on the C031 the values ​​read are 1035 temp and 1647 vref, while on the L031 they are 1516 temp and 602 vref, which work if inverted.
The channels are initialized the same way in the main (from CUBE .ioc) ADC_CHANNEL_TEMPSENSOR and then ADC_CHANNEL_VREFINT.
What am I doing wrong?
Or maybe it's an IDE problem?

Thanks!

KnarfB
Super User
December 2, 2025

which work if inverted.

What are you going to say here, please explain.

hth

KnarfB