cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 ADC Scan Mode – Getting Unrealistically Values from Multiple NTC Channels

durna
Associate II

Hello,

I’m trying to measure temperature using NTC sensors on four different ADC channels of my STM32 Nucleo‑H7 board. I could previously connect potentiometers to the same pins and get flawless ADC readings with the same code and CubeMX settings. I only added a function to convert NTC readings to temperature and didn’t change any other configuration.

I connected the NTCs to PA6, PA7, PC4, and PC5. In my loop, I call HAL_ADC_Start(), then four times HAL_ADC_PollForConversion() and HAL_ADC_GetValue() to retrieve the raw ADC values. When I measure the sensor output directly with a multimeter, I see about 1.65 V, but the ADC reads ~0.03 V, resulting in completely unrealistic temperatures.

I never had this issue with potentiometers on the same pins and code. Why am I getting such low readings with the NTCs? Is my channel assignment wrong, the pin mode incorrect, or could hardware jumpers/shielding be affecting it?

Has anyone experienced something similar or have suggestions? Thanks!

6 REPLIES 6
Saket_Om
ST Employee

Hello @durna 

Did you performe ADC calibration before measuring the temperature? 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om

Hello @Saket_Om 

yes as it appears in the code

Ozone
Principal

Input impedances and sample times play an important role as well.
What impedances and currents/voltages we are talking about here ?

durna
Associate II

Everything seems to be correct both hardware and software wise, but the temperature readings are really ridiculous. I've been trying for 2 days and still can't figure it out

durna_0-1752576959593.png

 

The following values are valid in my setup:

Divider impedance (Thevenin): 10 kΩ (NTC) ∥ 10 kΩ (fixed) ≈ 5 kΩ

Divider current I = 3.3 V / (10 k + 10 k) ≈ 165 µA

Node voltage (multimeter): ~1.67 V ⇒ ADC raw value ≈1.67/3.3-65535 ≈ 33 000

Sampling circuit time constant:

S/H capacitor ≈ 4 pF, switch R_ON ≈ 100 Ω ⇒ τ = R-C ≈ 5 kΩ-4 pF ≈ 20 ns

ADC sampling times:

I actually ran the ADC at a 15 MHz clock with a ÷10 prescaler, so the ADC clock is 1.5Mhz


so the S/H capacitor must be fully charged. Despite this, the raw reading is ~600 (≈ 0.03 V)

TDK
Super User

Do values change if you increase sampling time to max?

Use DMA to convert multiple channels, but maybe get a single channel working first.

If you feel a post has answered your question, please click "Accept as Solution".