UM0306 General purpose and alternate function I/O (GPIO and AFIO)
75/519
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/wake-up 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 and
● Section 6.2.3: Wake-up event management on page 102.
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:
– 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
● 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
If you configure a port bit as Alternate Function Output, this disconnects the output register
and connects the pin to the output signal of an on-chip peripheral.
If software configures a GPIO pin as Alternate Function Output, but peripheral is not
activated, its output is not specified.