cancel
Showing results for 
Search instead for 
Did you mean: 

ADC outputs 3.5volt!

Ala
Senior

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?

11 REPLIES 11
LCE
Principal

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.

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!

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.

I did exactly as you said: I used a 10K/1K divider and connected it to a 20V source to get 0~2V as ADC input, and the result is unexpected:

the ADC count that I get is always higher than expected! I repeated the test for 11value within above range, and in every test the count was around +1300 higher than expected! this much count for a 12bit MCU is like +1V is given to ADC. I'm confused!

Can you help?

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

Dear @Community member​ 

where can I find the GPIO_PUPDR content you mentioned?

LCE
Principal

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
Guru

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

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?