General-purpose and alternate-function I/Os (GPIOs and AFIOs)
Configuration mode
General purpose
output
Alternate Function
output
Input
7.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 that can be activated or not
when configured as input.
7.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, or
104/709
Table 16. Port bit configuration table
Push-pull
Open-drain
Push-pull
Open-drain
Analog
Input floating
Input pull-down
Input pull-up
Table 17. Output MODE bits
MODE[1:0]
00
01
10
11
RM0041 Rev 6
CNF1
CNF0
MODE1
0
0
1
0
1
see
1
0
0
1
1
0
Meaning
Reserved
Maximum output speed 10 MHz
Maximum output speed 2 MHz
Maximum output speed 50 MHz
RM0041
PxODR
MODE0
register
0 or 1
01
0 or 1
10
11
Don't care
Table 17
Don't care
Don't care
Don't care
00
0
1
Need help?
Do you have a question about the STM32F100 Series and is the answer not in the manual?
Questions and answers