correct use of GPIO_Analog
Hello. I have a question about the correct use of GIPO_Analog.
wanted to read this value.
I also want to know if the value can vary between 0 to 4095 as when the ADC is used.
am I using an MCU that I use Nuclo-F446RE?
Hello. I have a question about the correct use of GIPO_Analog.
wanted to read this value.
I also want to know if the value can vary between 0 to 4095 as when the ADC is used.
am I using an MCU that I use Nuclo-F446RE?
Hola Breno,
well, I guess by value you mean the value of the ADC reading one of its analog channels which in turn is connected to a GPIO, right?
The ADC can be set to different resolutions between 6...12bit, corresponding to values between 0...63 (6bit) to 0...4095 (12bit). So yes, you will get an ADC value between 0...4095 if you set the ADC to 12bit.
But what does this value stand for?
Well, the ADC needs a reference to compare the measured voltage to it. Due to pin count limitation on your NUCLEO-F446RE, which uses a LQFP-64 package, this reference voltage is connected to the supply voltage of your NUCLEO, i.e. to about 3.3V. Therefore, in your case and with 12bit resolution, the ADC value corresponds to a voltage of: Vgpio = (VALUEadc / (2^12-1)) * VDD
The exact value of VDD is unfortunately unknown or is only estimated, which is why a so-called ratiometric measurement is often carried out. To do this, you need at least a second measurement of a known reference voltage - either the built-in or a high-precision external one.
I'd really recommend to read section 13 of the Reference Manual of the STM32F446, where you will find a detailed decription of the three ADCs of that microcontroller.
In addition you could have a look at some of our video tutorials, e.g.
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
Good luck!
/Peter
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.