Skip to main content
Associate
January 25, 2026
Solved

STM32 ADC VREFINT / TEMP reads maximal value 4095

  • January 25, 2026
  • 3 replies
  • 243 views

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.

 

 

 

 

Best answer by waclawek.jan

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

3 replies

waclawek.jan
Super User
January 25, 2026

What is "different bin"?

How is VREF+ pin connected?

JW

TDK
Super User
January 25, 2026

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
January 26, 2026

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
January 26, 2026

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