Skip to main content
Associate
Jan 25, 2026 7:14 AM UTC
Solved

STM32 ADC VREFINT / TEMP reads maximal value 4095

Hi,

I’m trying to read internal temperature sensor on ADC1, but the ADC result is always 4095.

I use STM32L471, and I know that the problem is not HW related, when I run a different bin it reads the temp ok.

Tried to read VREFINT, raw value is also 4095.

Attached below screenshots with clock tree configuration and code.

Screenshot 2026-01-20 152910.pngScreenshot 2026-01-20 153102.pngScreenshot 2026-01-20 155308.png

p.s. also tested with different clock speeds and sample cycles with no luck.

 

 

 

 

waclawek.jan
waclawek.janBest answer
Super User
Jan 26, 2026 11:30 AM UTC

If you don't have any external voltage reference connected to VREF+, the only way to measure ADC values is to provide voltage to VREF+ internally, and that's what VREFBUF is for.

Read the ADC and VREFBUF chapter in RM, and review the VREF+ connections described in Datasheet.

JW

4 replies

waclawek.jan
Super User
Jan 25, 2026 11:15 AM UTC

What is "different bin"?

How is VREF+ pin connected?

JW

TDK
Jan 25, 2026 2:26 PM UTC

All data presented is consistent with VREF+ not supplied or configured properly.

"If you feel a post has answered your question, please click ""Accept as Solution""."
FufiFlupiAuthor
Associate
Jan 26, 2026 9:00 AM UTC

hi waclawek.jan, TDK,

Thank you for your replies.

The vref+ pin is connected to 2 capacitors 1uf, 0.1uf in parallel, than to AGND.

I think that the missing part was to enable the internal voltage reference buffer (via HAL_SYSCFG_EnableVREFBUF)
Once I configured and enabled  it I started reading values that made sense.

Although I'm unsure if it is the correct way to measure ADC values.

 

waclawek.jan
waclawek.janBest answer
Super User
Jan 26, 2026 11:30 AM UTC

If you don't have any external voltage reference connected to VREF+, the only way to measure ADC values is to provide voltage to VREF+ internally, and that's what VREFBUF is for.

Read the ADC and VREFBUF chapter in RM, and review the VREF+ connections described in Datasheet.

JW