Page 1 of 1

STM32F407 Disc: ADC value not reaching 4095

Posted: Thu Jan 04, 2018 8:43 am
by nikhiledutech
Hey ,

So i am currently interafacing with STM disc board. And below is my code.
import pyb
from pyb import ADC
from pyb import Pin

#Initalising ADC
pin = pyb.Pin('PA0',Pin.IN,Pin.PULL_DOWN)
adc = pyb.ADC(pin)

while True:
print(adc.read())


So it gives me max value around 3500. But as per my my ADC is 12 bit resolution, it should give 4095 as max. value .
Do anyone have any idea why its not giving me max ADC value ?

Re: STM32F407 Disc: ADC value not reaching 4095

Posted: Thu Jan 04, 2018 12:04 pm
by badi
Running your script on my STM32F407G-disc and connecting the PA0 to 3V works and gives me the value 4095. As VREF+ is - more or less - connected to VDD (~2.95V) I assume that you only connected 2.5 V to PA0?

Re: STM32F407 Disc: ADC value not reaching 4095

Posted: Fri Jan 05, 2018 5:10 am
by nikhiledutech
Yeah. Thanks. i got the value 4095 now. :)