
General-purpose and alternate-function I/Os (GPIOs and AFIOs)
RM0008
156/1096
Doc ID 13902 Rev 12
9.1.1 General-purpose
I/O
(GPIO)
During and just after reset, the alternate functions are not active and the I/O ports are
configured in Input Floating mode (CNFx[1:0]=01b, MODEx[1:0]=00b).
The JTAG pins are in input PU/PD after reset:
PA15: JTDI in PU
PA14: JTCK in PD
PA13: JTMS in PU
PB4: NJTRST in PU
When 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 N-MOS is activated when outputting 0).
The Input Data register (GPIOx_IDR) captures the data present on the I/O pin at every
APB2 clock cycle.
All GPIO pins have an internal weak pull-up and weak pull-down which can be activated or
not when configured as input.
9.1.2
Atomic bit set or reset
There is no need for the software to disable interrupts when programming the GPIOx_ODR
at bit level: it is possible to modify only one or several bits in a single atomic APB2 write
access. This is achieved by programming to ‘1’ the Bit Set/Reset Register (GPIOx_BSRR,
Table 20.
Port bit configuration table
Configuration mode
CNF1
CNF0
MODE1
MODE0
PxODR
register
General purpose
output
Push-pull
0
0
01
10
11
see
0 or 1
Open-drain
1
0 or 1
Alternate Function
output
Push-pull
1
0
don’t care
Open-drain
1
don’t care
Input
Analog
0
0
00
don’t care
Input floating
1
don’t care
Input pull-down
1
0
0
Input pull-up
1
Table 21.
Output MODE bits
MODE[1:0]
Meaning
00
Reserved
01
Max. output speed 10 MHz
10
Max. output speed 2 MHz
11
Max. output speed 50 MHz