General-purpose I/Os (GPIO) RM0453
396/1461 RM0453 Rev 1
10.3.1 General purpose I/O (GPIO)
During and just after reset, the alternate functions are not active and most of the I/O ports
are configured in input analog mode.
The debug pins listed below are in AF pull-up/pull-down after reset:
• PA15: JTDI in input mode with pull-up
• PA14: JTCK/SWCLK in input mode with pull-down
• PA13: JTMS/SWDAT in input mode with pull-up
• PB4: NJTRST in input mode with pull-up
• PB3: JTDO in HI-Z mode no pulls.
PH3/BOOT0 is in input mode during the reset until at least the end of the option byte loading
phase (see Section 10.3.15: Using PH3 as GPIO).
When the I/O pin is configured as output, the value written to the output data register
GPIOx_ODR is output on the I/O pin. It is possible to use the output driver in push-pull mode
or open-drain mode (only the low level is driven, high level is HI-Z).
The input data register GPIOx_IDR captures the data present on the I/O pin at every AHB
clock cycle.
All GPIO pins have weak internal pull-up and pull-down resistors, which can be activated or
not depending on the value in the GPIOx_PUPDR register.
10.3.2 I/O pin alternate function multiplexer and mapping
The I/O pins are connected to on-board peripherals/modules through a multiplexer that
allows only one AF peripheral connected to each I/O pin at a time. This avoids conflict
between peripherals available on the same I/O pin.
Each I/O pin has a multiplexer with up to sixteen alternate function inputs (AF0 to AF15),
that can be configured through the registers GPIOx_AFRL (for pin 0 to 7) and GPIOx_AFRH
(for pin 8 to 15):
After reset, the multiplexer selection is alternate function 0 (AF0). I/Os are configured in
alternate function mode through GPIOx_MODER register.
00
X XX 00 Input Floating
X XX 01 Input PU
X XX 10 Input PD
X XX 11 Reserved (input floating)
11
X XX 00 Input/output Analog
XXX01
ReservedXXX10
XXX11
1. GP = general purpose, PP = push-pull, PU = pull-up, PD = pull-down, OD = open drain, AF = alternate function.
Table 70. Port bit configurations (continued)
MODE(i)[1:0] OTYPER(i) OSPEED(i)[1:0] PUPD(i)[1:0] I/O configuration
(1)