2026-01-24 11:14 PM
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.
p.s. also tested with different clock speeds and sample cycles with no luck.
Solved! Go to Solution.
2026-01-26 3:30 AM
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
2026-01-25 3:15 AM
What is "different bin"?
How is VREF+ pin connected?
JW
2026-01-25 6:26 AM
All data presented is consistent with VREF+ not supplied or configured properly.
2026-01-26 1:00 AM
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.
2026-01-26 3:30 AM
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