STM32 General Purpose Input Output
STM32 General Purpose Input Output
GPIO Modes
1. Input Configuration
When the I/O port is programmed as input:
(1) The output buffer is disabled (open circuit)
(2) The Schmitt trigger input is activated
(3) The pull-up and pull-down resistors are activated by programming
(4) The data present on the I/O pin are sampled into the input data register
(5) A read access to the input data register provides the I/O state
Floating Input: Its state is indeterminate, meaning that it is neither connected to VCC or to ground.
It’s used interchangeably to describe a pin which is in the high-impedance state
pull-up Input: Pull-up resistor is used to set a pin to a logical high state ( 30 k Ω≤RPU ≤50 k Ω )
pull-down Input: Pull-down resistor is used to set a pin to a logical low state
( 30 k Ω≤RPD≤50 k Ω )
2. Output configuration
Output Push Pull: In Push-Pull type there will be two switches (transistor/ MOSFET) inside the
micro-controller and one switch will be connected to Ground and the other will be connected to
Vcc/Vdd. If you make the output HIGH the pin will be connected to Vdd through the NPN switch
and if you make the Output pin LOW the pin will be connected to Ground thorough the PNP switch
Output Open Drain: There will be only one switch (transistor/MOSFET) inside the uC and this
switch is connected to Ground. If you make the output pin HIGH the pin will be connected to
ground through the switch and if you make the Output pin LOW the pin will be left floating since
the switch will be turned off. Since in the Open Drain type the pin is left as floating a pull-high or
pull-down resistor is usually added to the GPIO pin