PINMUX
Introduction
In modern SoC design, the number of peripherals continues to grow while the number of physical pins is constrained by package cost and size. The chip integrates a PINMUX (Pin Multiplexing) feature that allows a single physical pin to be connected to different peripheral modules through software configuration. PINMUX technology enables maximum system functionality within limited pin resources through flexible assignment of pin functions.
When a peripheral (such as UART, SPI, I2C, etc.) needs to be used, the user must first configure the PINMUX to map the corresponding physical pin to the peripheral, routing the signals to the I/O pins.
Functional Description
Each I/O pin on the chip is equipped with an independent Multiplexer to connect to various peripheral modules. Through the multiplexing mechanism, the multiplexer ensures that only one peripheral signal can occupy a designated I/O pin at any given time, effectively preventing signal conflicts that would arise from multiple peripherals simultaneously accessing the same pin.
A Function ID is the configuration value written to the pin multiplexing register to specify the peripheral function connected to that pin. Each I/O pin has a corresponding Function ID field; writing different values to this field switches the pin to the corresponding peripheral signal (such as UART1_RXD, SPI0_CLK, GPIO, etc.).
Based on the Function ID, pin function groups are divided into two categories: Dedicated Pin Function Group and Full-Matrix Pin Function Group — lower Function ID values correspond to the Dedicated Pin Function Group, and higher values correspond to the Full-Matrix Pin Function Group.
Note
The specific Function ID values and their corresponding signal mappings can be found in the Pin Multiplexing Table.
Warning
For the use of special pins such as TrapPin, WakePin, SWDpin, and SpecialPin, be sure to read the relevant precautions in the Hardware Design Guide to avoid functional abnormalities caused by improper configuration.
Dedicated Pin Function Group
In the Dedicated Pin Function Group, each pin can only connect to specific peripheral modules and can only be mapped to fixed signals of those modules. Although the configurable functions are relatively limited, this dedicated design fully exploits the performance of each IP module to meet requirements such as high transfer rates.
The Function ID range for the dedicated pin function group is 0~{{IC_PARAM_FUNCID_DEDICATE_END}}.
Taking PB30 as an example, it can be connected to several peripheral signals as shown in the diagram below. If its Function ID is configured to 16, the pin will be directly connected to the TIM9_TRIG signal of TIM9 via pin multiplexing.
Schematic Diagram of Pin Multiplexing Connection
The Function ID range for the dedicated pin function group is 0~{{IC_PARAM_FUNCID_DEDICATE_END}}.
Taking PB5 as an example, it can be connected to several peripheral signals as shown in the diagram below. If its Function ID is configured to 6, the pin will be directly connected to the SPI1_CS signal of SPI1 via pin multiplexing.
Schematic Diagram of Pin Multiplexing Connection
The Function ID range for the dedicated pin function group is 0~{{IC_PARAM_FUNCID_DEDICATE_END}}.
Taking PB5 as an example, it can be connected to several peripheral signals as shown in the diagram below. If its Function ID is configured to 6, the pin will be directly connected to the SPI1_CS signal of SPI1 via pin multiplexing.
Schematic Diagram of Pin Multiplexing Connection
The Function ID range for the dedicated pin function group is 0~{{IC_PARAM_FUNCID_DEDICATE_END}}.
Taking PB5 as an example, it can be connected to several peripheral signals as shown in the diagram below. If its Function ID is configured to 6, the pin will be directly connected to the SPI1_CS signal of SPI1 via pin multiplexing.
Schematic Diagram of Pin Multiplexing Connection
The Function ID range for the dedicated pin function group is 0~{{IC_PARAM_FUNCID_DEDICATE_END}}.
Taking PB5 as an example, it can be connected to several peripheral signals as shown in the diagram below. If its Function ID is configured to 6, the pin will be directly connected to the SPI1_CS signal of SPI1 via pin multiplexing.
Schematic Diagram of Pin Multiplexing Connection
The Function ID range for the dedicated pin function group is 0~{{IC_PARAM_FUNCID_DEDICATE_END}}.
Taking PA0 as an example, it can be connected to several peripheral signals as shown in the diagram below. If its Function ID is configured to 1, the pin will be directly connected to the UART2_RXD signal of UART2 via pin multiplexing.
Schematic Diagram of Pin Multiplexing Connection
The Function ID range for the dedicated pin function group is 0~{{IC_PARAM_FUNCID_DEDICATE_END}}.
Taking PB16 as an example, it can be connected to several peripheral signals as shown in the diagram below. If its Function ID is configured to 10, the pin will be directly connected to the SPI1_CS signal of SPI1 via pin multiplexing.
Schematic Diagram of Pin Multiplexing Connection
Note
Dedicated pins are typically organized into function groups, where each function group contains a set of related pins. For optimal performance, it is recommended to select pins within the same function group and avoid mixing pins across different function groups.
For detailed information on function group assignments, refer to the
Group-related descriptions in the annotations of the Pin Multiplexing Table.
Full-Matrix Pin Function Group
In the Full-Matrix Pin Function Group, each pin can be flexibly mapped to almost all signals of all peripheral modules within the function group by configuring different Function IDs. This design provides greater configuration freedom and is suitable for applications where pin resources are tight and flexible allocation is required.
Note
The flexibility of the Full-Matrix Pin Function Group comes at a certain performance cost: the maximum transfer rate of some IP modules when using full-matrix pins may be lower than the theoretical limit when using dedicated pins. Users should weigh their choices based on actual requirements.
A small number of pins in the Full-Matrix Pin Function Group may not support certain peripherals; these are marked with
0in the Pin Multiplexing Table.
According to the Pin Multiplexing Table, the Function ID range for the full-matrix pin function group is {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}.
Taking PB30 as an example:
When the Function ID of
PB30is configured to19,PB30can be connected to theUART0_TXDsignal of UART0;When the Function ID of
PB30is configured to20, it can be connected to theUART0_RXDsignal of UART0.By analogy,
PB30can be configured with any Function ID in the full-matrix pin function group.
Schematic Diagram of Pin Multiplexing Connection
According to the Pin Multiplexing Table, the Function ID range for the full-matrix pin function group is {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}.
Taking PA11 as an example:
When the Function ID of
PA11is configured to20,PA11can be connected to theUART0_TXDsignal of UART0;When the Function ID of
PA11is configured to21, it can be connected to theUART0_RXDsignal of UART0.By analogy,
PA11can be configured with any Function ID in the full-matrix pin function group.
Schematic Diagram of Pin Multiplexing Connection
According to the Pin Multiplexing Table, the Function ID range for the full-matrix pin function group is {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}.
Taking PA11 as an example:
When the Function ID of
PA11is configured to20,PA11can be connected to theUART0_TXDsignal of UART0;When the Function ID of
PA11is configured to21, it can be connected to theUART0_RXDsignal of UART0.By analogy,
PA11can be configured with any Function ID in the full-matrix pin function group.
Schematic Diagram of Pin Multiplexing Connection
According to the Pin Multiplexing Table, the Function ID range for the full-matrix pin function group is {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}.
Taking PA11 as an example:
When the Function ID of
PA11is configured to20,PA11can be connected to theUART0_TXDsignal of UART0;When the Function ID of
PA11is configured to21, it can be connected to theUART0_RXDsignal of UART0.By analogy,
PA11can be configured with any Function ID in the full-matrix pin function group.
Schematic Diagram of Pin Multiplexing Connection
According to the Pin Multiplexing Table, the Function ID range for the full-matrix pin function group is {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}.
Taking PA11 as an example:
When the Function ID of
PA11is configured to20,PA11can be connected to theUART0_TXDsignal of UART0;When the Function ID of
PA11is configured to21, it can be connected to theUART0_RXDsignal of UART0.By analogy,
PA11can be configured with any Function ID in the full-matrix pin function group.
Schematic Diagram of Pin Multiplexing Connection
Not supported.
According to the Pin Multiplexing Table, the Function ID range for the full-matrix pin function group is {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}.
Taking PB16 as an example:
When the Function ID of
PB16is configured to95,PB16can be connected to theUART0_TXDsignal of UART0;When the Function ID of
PB16is configured to96, it can be connected to theUART0_RXDsignal of UART0.By analogy,
PB16can be configured with any Function ID in the full-matrix pin function group.
Schematic Diagram of Pin Multiplexing Connection