Skip to main content
Associate II
September 28, 2026
Question

STM32L4, voltage breakdown on high-impedance ADC input after MX_ADCx_Init

  • September 28, 2026
  • 3 replies
  • 19 views

Hello everyone,

I measure a voltage on a STM32L496 using the internal ADC and found the following issue:

Setup:

The voltage is scaled down via a high-impedance voltage divider (2 x 470kOhm). To avoid distortion by sampling, the voltage divider has a 100nF capacitor. Thus, the capacitive load while sampling is low and the breakdown is 1/20000 → i.e. way lower than the ADC’s resolution. So I do not have to care about source impedance limitations as described in the datasheet (Maximum ADC RAIN).

Other data:

  • VREF=VDDA=3.3V (stable)
  • Voltage range of ADC input signal: 0 - 3V (never >3.3V)

Effect:

I experience a large voltage breakdown when I configure the ADC, via CubeMX generated function MX_ADC3_Init (same happens when I use ADC1). I found, that within MX_ADC3_Init the channel gets configured and the ADC sequencer register ADC_SQR1 is set (I only sample that one channel with the high-impedance voltage divider). As soon as ADC_SQR1 is set, the voltage breaks down, from anything >2.5V to approx. 2.5V. When I enable the ADC (ADC_CR.ADEN=1) the breakdown disappears, and there is no more breakdown during sampling (due to high 100nF capacitor). I experience again a breakdown when calling HAL_ADC_DeInit() → ADC is disabled before ADC_SQR1 register is cleared.

Explanation:

Explanation for the above effect is that with ADC_SQR1 being set the external signal is connected to the ADC. Since the ADC is off (ADC_CR.ADEN=0) its state is undefined causing the clipping on the external signal. As soon as the ADC is on everything is defined and ok.

Question:

Is this behavior intended, do you want to fix it, offer a second init-function?

I understand that CubeL4-codes idea is to configure and then to measure. But in case of high impedance sources I find the behavior critical. Anybody experienced the same issue?

 

3 replies

TDK
September 28, 2026

What is a voltage breakdown in this context?

the breakdown is 1/20000

??

As soon as ADC_SQR1 is set, the voltage breaks down, from anything >2.5V to approx. 2.5V. When I enable the ADC (ADC_CR.ADEN=1) the breakdown disappears

So the “breakdown” is the voltage on the ADC pin drops from 2.5 V - 3.0 V to 2.5 V when setting SQR1? Is the upstream signal low-impedance?

Adding a capacitor will not eliminate the limitations from RAIN, but a voltage divider of 2x470kOhm should be doable at max sampling cycles.

"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
Super User
September 28, 2026

> breakdown

maybe “voltage drop”?

2.5V as a limiting value sounds strange in a mcu powered by 3.3V

> When I enable the ADC (ADC_CR.ADEN=1) the breakdown disappears

Are you sure that the described effect is directly related to this bit? You may want to single-step the mcu while observing the registers, or even manually write to the registers in debugger, to observe which operation results in what effect, exactly.

JW

Associate II
September 28, 2026

I think the ADC input has a weak pull down resistor internally.  If the port is configured as an input it will float , very high impedance, but when software turns it to ADC alternate function the weak pull down resistor will affect your readings.

The high-impedance voltage divider (2 x 470kOhm) you explain about is very high - the weak pull down will cause a shift.

Can you use lower value resistors in the voltage divider or use an Opamp?