RM0453
Specific alternate function assignments for each pin are detailed in the product datasheet.
In addition to this flexible I/O multiplexing architecture, each peripheral has alternate
functions mapped on different I/O pins to optimize the number of peripherals available in
smaller packages.
To use an I/O in a given configuration, the user must 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
–
–
Refer to the "Alternate function mapping" table in the product datasheet for the detailed
mapping of the alternate function I/O pins.
10.3.3
I/O port control registers
Each of the GPIO ports has four 32-bit memory-mapped control registers (GPIOx_MODER,
GPIOx_OTYPER, GPIOx_OSPEEDR and GPIOx_PUPDR) to configure up to sixteen I/Os.
GPIOx_MODER is used to select the I/O mode (input, output, AF or analog).
GPIOx_OTYPER and GPIOx_OSPEEDR are used to select the output type (push-pull or
open-drain) and speed.
GPIOx_PUPDR is used to select the pull-up/pull-down whatever the I/O direction.
10.3.4
I/O port data registers
Each GPIO has two 16-bit memory-mapped input and output data registers: GPIOx_IDR
and GPIOx_ODR.
GPIOx_ODR stores the data to be output, it is read/write accessible.
Data input through the I/O are stored into GPIOx_IDR, it is a read-only register.
10.3.5
I/O data bitwise handling
The bit set reset register (GPIOx_BSRR) is a 32-bit register that allows the application to set
and reset each individual bit in the output data register (GPIOx_ODR). GPIOx_BSRR has
twice the size of GPIOx_ODR.
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_OSPEEDR registers, respectively.
Configure the desired I/O as an alternate function in the GPIOx_MODER register.
For ADC, DAC and COMP, configure the desired I/O in analog mode in the
GPIOx_MODER register and configure the required function in the ADC, DAC and
COMP registers.
For the additional functions like RTC, WKUPx and oscillators, configure the
required function in the related RTC, PWR and RCC registers. These functions
have priority over the configuration in the standard GPIO registers.
RM0453 Rev 1
General-purpose I/Os (GPIO)
397/1461
427
Need help?
Do you have a question about the STM32WL5 Series and is the answer not in the manual?
Questions and answers