STM32F407 Disc: ADC value not reaching 4095

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
nikhiledutech
Posts: 118
Joined: Wed Dec 27, 2017 8:52 am

STM32F407 Disc: ADC value not reaching 4095

Post by nikhiledutech » Thu Jan 04, 2018 8:43 am

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 ?

User avatar
badi
Posts: 51
Joined: Mon Aug 10, 2015 2:18 pm
Location: Bern, Switzerland

Re: STM32F407 Disc: ADC value not reaching 4095

Post by badi » Thu Jan 04, 2018 12:04 pm

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?
badi

nikhiledutech
Posts: 118
Joined: Wed Dec 27, 2017 8:52 am

Re: STM32F407 Disc: ADC value not reaching 4095

Post by nikhiledutech » Fri Jan 05, 2018 5:10 am

Yeah. Thanks. i got the value 4095 now. :)

Post Reply