Output Mode Configuration - ST STM32 Application Note

Microcontroller gpio hardware settings and low-power consumption
Hide thumbs Also See for STM32:
Table of Contents

Advertisement

AN4899
Programmed as input, an I/O port exhibits the following characteristics:
The output buffer is disabled
The Schmitt trigger input is activated
The pull-up or pull-down resistors are activated depending on the value in the
GPIOx_PUPDR register
The data present on the I/O pin is sampled into the input data register at each AHB
clock cycle
The I/O state is obtained by reading the GPIOx_IDR input data register
4.3.2

Output mode configuration

When a STM32 device I/O pin is configured as output, one of two options
Push-pull output mode:
The push-pull output actually uses two transistors: one PMOS and one NMOS. Each
transistor is ON to drive the output to the appropriate level:
Open-drain output mode:
Open-drain output mode does not use the PMOS transistor and a pull-up resistor is
required.
When the output has to go high, the NMOS transistor must be turned off, pulling the
line high only by the pull-up resistor. This pull-up resistor could be internal with a typical
value of 40 kOhm and activated through GPIO port pull-up / pull-down register
(GPIOx_PUPDR).
Note:
It is important to note that it is not possible to activate pull-up and pull-down at the same
time on the same I/O pin.
It is also possible to use an external pull-up or pull-down resistor instead of the internal
resistor. In this case, the value must be adapted to be compliant with the GPIO output
voltage and current characteristics.
Programmed as output, an I/O port exhibits the following characteristics:
The output buffer can be configured in open-drain or push-pull mode
The Schmitt trigger input is activated
The internal pull-up and pull-down resistors are activated depending on the value in the
GPIOx_PUPDR register.
The written value into the output data register GPIOx_ODR sets the I/O pin state
The written data on GPIOx_ODR can be read from GPIOx_IDR register that is updated
every AHB clock cycle
Open-drain output is often used to control devices which operate at a different voltage
supply than the STM32. Open-drain mode is also used to drive one or several I
when specific pull-up resistors are required.
The top transistor (PMOS) is ON when the output has to drive HIGH state
The bottom transistor (NMOS) is ON when the output has to drive a LOW state
The control of the two transistors is done through the GPIO port output type
register (GPIOx_OTYPER).
Writing the related bit of the output register (GPIOx_ODR) to 0 activates the
NMOS transistor to force the I/O pin to ground.
Writing the related bit of the output register (GPIOx_ODR) to 1 activates the
PMOS transistor to force the I/O pin to V
.
DD
AN4899 Rev 3
GPIO functional description
must be selected:
2
C devices
11/31
30

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents