General-purpose and alternate-function I/Os (GPIOs and AFIOs)
5.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: JNTRST 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 a internal weak pull-up and weak pull-down which can be activated or
not when configured as input.
5.1.2
Atomic bit set or bit 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 for
reset only GPIOx_BRR) to select the bits you want to modify. The unselected bits will not be
modified.
5.1.3
External interrupt/wakeup lines
All ports have external interrupt capability. To use external interrupt lines, the port must be
configured in input mode. For more information on external interrupts, refer to:
Section 6.2: External interrupt/event controller (EXTI) on page 101
Section 6.2.3: Wakeup event management on page
5.1.4
Alternate functions (AF)
It is necessary to program the Port Bit Configuration Register before using a default
alternate function.
For alternate function inputs, the port can be configured either:
–
–
For Alternate Function Outputs, the port must be configured in Alternate Function
Output mode (Push-Pull or Open-Drain).
For bidirectional Alternate Functions, the port bit must be configured in Alternate
Function Output mode (Push-Pull or Open-Drain). In this case the input driver is
configured in input floating mode
78/501
in Input mode (floating, pull-up or pull-down)
in Alternate Function Output mode. In this case the input driver is configured in
input floating mode
and
102.
RM0008
Need help?
Do you have a question about the STM32F101 Series and is the answer not in the manual?