RM0091
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.
8.3.2
I/O pin alternate function multiplexer and mapping
The device I/O pins are connected to onboard peripherals/modules through a multiplexer
that allows only one peripheral's alternate function (AF) connected to an I/O pin at a time. In
this way, there can be no 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 GPIOx_AFRL (for pin 0 to 7) and GPIOx_AFRH (for pin 8 to
15) registers:
●
After reset all I/Os are connected to alternate function 0 (AF0)
●
The specific alternate function assignments for each pin are detailed in the device
datasheet.
In addition to this flexible I/O multiplexing architecture, each peripheral has alternate
functions mapped onto different I/O pins to optimize the number of peripherals available in
smaller packages.
To use an I/O in a given configuration, you have to proceed as follows:
●
Debug function: after each device reset these pins are assigned as alternate function
pins immediately usable by the debugger host
●
GPIO: configure the desired I/O as output, input or analog in the GPIOx_MODER
register.
●
Peripheral alternate function:
–
–
–
●
Additional functions:
–
–
Please refer to the "Alternate function mapping" table in the device datasheet for the
detailed mapping of the alternate function I/O pins.
Connect the I/O to the desired AFx in the GPIOx_AFRL or GPIOx_AFRH register
Select the type, pull-up/pull-down and output speed via the GPIOx_OTYPER,
GPIOx_PUPDR and GPIOx_OSPEEDER registers, respectively
Configure the desired I/O as an alternate function in the GPIOx_MODER register
For the ADC and DAC, configure the desired I/O in analog mode in the
GPIOx_MODER register and configure the required function in the ADC or DAC
registers.
For the additional functions like RTC, WKUPx and oscillators, configure the
required function in their in the related RTC, PWR and RCC registers. These
functions have priority over the configuration in the standard GPIO registers.
Doc ID 018940 Rev 1
General-purpose I/Os (GPIO)
121/742
Need help?
Do you have a question about the STM32F05 series and is the answer not in the manual?
Questions and answers