Skip to main content
Ala
Senior
March 9, 2022
Question

ADC outputs 3.5volt!

hey there

I have a STM32f030C8t6 which I wish to read 2 Analog values by it. I use ADC DMA for this. but as soon as I use command

HAL_ADC_Start_DMA(&hadc,(uint32_t *)ADC_SEN,2); //Starting ADC1

I can see my ADC pins' volt are as high as 3.5volts!

why is that?

This topic has been closed for replies.

11 replies

LCE
Principal III
March 9, 2022

How do you measure these 3.5V ?

Anything connected to the GPIOs?

Configured as ADC inputs?

Anyway, it it is an open input, a lot of things can occur, and measurements of the GPIO with a DMM might not make sense (leakage currents, rectified high frequencies, ...).

So check your configuration and start connecting low voltages, for example take a 10k / 10k voltage divider to measure half VCC. For other voltages make sure these are within the limits, better always use a serial resistor (+ small cap for filtering) between signal and ADC input. I don't know about the ADC's input impedance, check the datasheet if you can use 10k or should use a lower value, but I wouldn't start below 1k.

Ala
AlaAuthor
Senior
March 9, 2022

I measure this 3.5V using a multimeter.

my ADC pins are now open, meaning nothing is connected to them.

I just generated the code using my configuration in CubeMx, but I did not add any code just to make sure my configuration itself is OK. then I built it in Keil and Loaded it to my board. it was OK. but as soon as I ran

HAL_ADC_Start_DMA(&hadc,(uint32_t *)ADC_SEN,2); //Starting ADC1

piece of code, my ADC values became 3.5V!

LCE
Principal III
March 9, 2022

DMM = Digital MultiMeter, might get you strange results.

So try what I mentioned above, don't leave inputs open, but start with just reading single ADC values, for the beginning without DMA - except you are perfectly sure how to handle it and can access the ADC results.

waclawek.jan
Super User
March 9, 2022

Try longer sampling time - 10k/1k divider may represent a relatively high input impedance.

Also make sure you don't have the pin's pullup switched on - read out the respective GPIO_PUPDR content and check.

JW

Ala
AlaAuthor
Senior
March 9, 2022

Dear @Community member​ 

where can I find the GPIO_PUPDR content you mentioned?

LCE
Principal III
March 9, 2022

GPIOx_PUPDR are part of the GPIO registers, check the reference manual.

10k / 1k divider and 1V above what it should be sounds like an active internal pull-up.

Depending on your needed bandwidth you could put a small x pF cap in parallel to the 1k.

TDK
March 9, 2022

If a pin is higher than VDD, it must be being driven externally through some channel. There are no charge pumps in the MCU which generate higher voltage.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Ala
AlaAuthor
Senior
March 10, 2022

seems so logical, but this ADC pin is not attached to anything, even in PCB itself. it's just a track.

anyways, I commented the ADC DMA start in above, and tried to read ADC values by polling. now I doesn't read anything! or reads some gibberish! though when I measure the volt on ADC pin, the volt is delivered right and no fluctualtions... any ideas?

TDK
March 10, 2022

What is VDDA/VREF+ on your board?

Measuring ADC pins with nothing connected to it is of limited use. What voltage do you think it should be?

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