cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 ADC VREFINT / TEMP reads maximal value 4095

FufiFlupi
Associate

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.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

4 REPLIES 4
waclawek.jan
Super User

What is "different bin"?

How is VREF+ pin connected?

JW

TDK
Super User

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".
FufiFlupi
Associate

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.

 

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