PINMUX & PAD
Pin Multiplexing
Overview
Due to limited pin resources, the chip provides pin multiplexing (PINMUX) functionality to enhance design flexibility. Each pin can be configured to connect to different internal IP circuits. For the specific mapping between pins and IP circuits, please refer to Pinmux Table.
The pin multiplexing table provides the following key information:
Pin distribution under different Part numbers
On-chip peripheral signals supported by each pin
Distribution of power-up latch pins (Trap Pin)
Default pin allocation for J-Link Debug Interface (SWD)
Default pin allocation for firmware download, command interaction, and log functions via serial port (LOGUART)
Power supply information for each I/O pin, etc.
Function Multiplexing
Usage Method
Developers can connect pins to specified on-chip peripheral signals by calling the programming interface Pinmux_Config(PinName, PinFuncID).
Parameter description:
- PinName:
Pin identifier
- PinFuncID:
Specified signal ID of the on-chip peripheral controller
Based on the configured function-id, pins can either output internal chip signals to external devices or receive signals input from external devices to internal chip modules.
For specific pin to function-id mappings, refer to Pinmux Table.
Function ID
Function ID 0~{{IC_PARAM_FUNCID_DEDICATE_END}}
When Function ID is
0~{{IC_PARAM_FUNCID_DEDICATE_END}}, each pin can only connect to fixed signals of specific IPs. These pins have limited configurable functions, but dedicated designs can maximize the performance of each IP module.Note
For example, both Function ID {{IC_PARAM_FUNCID_DEDICATE_END}} and Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} represent SPI functions.
Function ID {{IC_PARAM_FUNCID_DEDICATE_END}} uses dedicated pins, enabling SPI function to achieve maximum rate of 50MHz (master mode).
Function ID {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} (full-cross pins) can only achieve maximum rate of 12.5MHz (master mode).
Take
PB30as an example: When configured with Function ID1, this pin will be directly connected to theUART1_RXDsignal of UART1 through pin multiplexing.PB30 pin multiplexing connection diagram
Refer to the Pinmux Table for specific function assignments supported by each pin.
Function ID {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}
When Function ID is
{{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}, each pin can connect to different signals of specific IPs. This design provides greater configuration flexibility, but with limitations in application scope and performance (e.g., maximum transmission rate) of some IP modules.Take
PA27as an example:When configuring Function ID of
PA27as19, it connects toUART0_TXDsignal of UART0;When configuring Function ID of
PA27as20, it connects toUART0_RXDsignal of UART0.
PA27 pin multiplexing connection diagram
Refer to the Pinmux Table for specific configurations.
Usage Method
Developers can connect pins to specified on-chip peripheral signals by calling the programming interface Pinmux_Config(PinName, PinFuncID).
Parameter description:
- PinName:
Pin identifier
- PinFuncID:
Specified signal ID of the on-chip peripheral controller
Based on the configured function-id, pins can either output internal chip signals to external devices or receive signals input from external devices to internal chip modules.
For specific pin to function-id mappings, please refer to Pinmux Table.
Function ID
Function ID 0~{{IC_PARAM_FUNCID_DEDICATE_END}}
When Function ID is
0~{{IC_PARAM_FUNCID_DEDICATE_END}}, each pin can only connect to fixed signals of specific IPs. These pins have limited configurable functions, but dedicated designs can maximize the performance of each IP module.Note
For example, both Function ID {{IC_PARAM_FUNCID_DEDICATE_SPI0}} and Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} represent SPI functions.
Function ID {{IC_PARAM_FUNCID_DEDICATE_SPI0}} uses dedicated pins, enabling SPI function to achieve maximum rate of 50MHz (master mode);
Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} (full-cross pins) can only achieve maximum rate of 12.5MHz (master mode).
Take
PB5as an example: When configured with Function ID6, this pin will be directly connected to theSPI1_CSsignal of SPI through pin multiplexing.PB5 pin multiplexing connection diagram
Refer to the Pinmux Table for specific function assignments supported by each pin.
Function ID {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}
When Function ID is
{{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}, each pin can connect to different signals of specific IPs. This design provides greater configuration flexibility, but with limitations in application scope and performance (e.g., maximum transmission rate) of some IP modules.Take
PA11as an example:When configuring Function ID of
PA11as20, it connects toUART0_TXDsignal of UART0;When configuring Function ID of
PA11as21, it connects toUART0_RXDsignal of UART0.
PA11 pin multiplexing connection diagram
Refer to the Pinmux Table for specific configurations.
Note
When using
PA23~PA31andPB0~PB10pins, I/O voltage can be set to 1.8V or 3.3V. By default,PB11~PB19are dedicated to Audio functions.If
PB11~PB19pins are used for other functions, note that their I/O voltage can only be set to 1.8V. For more information about I/O voltage, refer to Pinmux Table.
Audio Function
PB11~PB19are Audio function pins. If spare pins are available, it is not recommended to usePB11~PB19for general digital functions to avoid interference with Audio functionality.If multiplexing
PB11~PB19for both Audio and digital functions, ensure proper layout design to keep digital signal traces away from Audio signal traces, thereby reducing interference risks.
ADC/Cap-Touch Function
When using
PA28~PA31andPB1~PB5pins for ADC or Cap-Touch functions, call the programming interfacePAD_InputCtrl(PinName, DISABLE)to disable the digital input path.Cap-Touch performance is closely related to parasitic capacitance. Pay special attention to layout design. For details, refer to the ADC/CTC Layout Guide.
Usage Method
Developers can connect pins to specified on-chip peripheral signals by calling the programming interface Pinmux_Config(PinName, PinFuncID).
Parameter description:
- PinName:
Pin identifier
- PinFuncID:
Specified signal ID of the on-chip peripheral controller
Based on the configured function-id, pins can either output internal chip signals to external devices or receive signals input from external devices to internal chip modules.
For specific pin to function-id mappings, please refer to Pinmux Table.
Function ID
Function ID 0~{{IC_PARAM_FUNCID_DEDICATE_END}}
When Function ID is
0~{{IC_PARAM_FUNCID_DEDICATE_END}}, each pin can only connect to fixed signals of specific IPs. These pins have limited configurable functions, but dedicated designs can maximize the performance of each IP module.Note
For example, both Function ID {{IC_PARAM_FUNCID_DEDICATE_SPI0}} and Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} represent SPI functions.
Function ID {{IC_PARAM_FUNCID_DEDICATE_SPI0}} uses dedicated pins, enabling SPI function to achieve maximum rate of 50MHz (master mode);
Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} (full-cross pins) can only achieve maximum rate of 12.5MHz (master mode).
Take
PB5as an example: When configured with Function ID6, this pin will be directly connected to theSPI1_CSsignal of SPI through pin multiplexing.PB5 pin multiplexing connection diagram
Refer to the Pinmux Table for specific function assignments supported by each pin.
Function ID {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}
When Function ID is
{{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}, each pin can connect to different signals of specific IPs. This design provides greater configuration flexibility, but with limitations in application scope and performance (e.g., maximum transmission rate) of some IP modules.Take
PA11as an example:When configuring Function ID of
PA11as20, it connects toUART0_TXDsignal of UART0;When configuring Function ID of
PA11as21, it connects toUART0_RXDsignal of UART0.
PA11 pin multiplexing connection diagram
Refer to the Pinmux Table for specific configurations.
Note
When using
PA23~PA31andPB0~PB10pins, I/O voltage can be set to 1.8V or 3.3V. By default,PB11~PB19are dedicated to Audio functions.If
PB11~PB19pins are used for other functions, note that their I/O voltage can only be set to 1.8V. For more information about I/O voltage, refer to Pinmux Table.
Audio Function
PB11~PB19are Audio function pins. If spare pins are available, it is not recommended to usePB11~PB19for general digital functions to avoid interference with Audio functionality.If multiplexing
PB11~PB19for both Audio and digital functions, ensure proper layout design to keep digital signal traces away from Audio signal traces, thereby reducing interference risks.
ADC/Cap-Touch Function
When using
PA28~PA31andPB1~PB5pins for ADC or Cap-Touch functions, call the programming interfacePAD_InputCtrl(PinName, DISABLE)to disable the digital input path.Cap-Touch performance is closely related to parasitic capacitance. Pay special attention to layout design. For details, refer to the ADC/CTC Layout Guide.
Usage Method
Developers can connect pins to specified on-chip peripheral signals by calling the programming interface Pinmux_Config(PinName, PinFuncID).
Parameter description:
- PinName:
Pin identifier
- PinFuncID:
Specified signal ID of the on-chip peripheral controller
Based on the configured function-id, pins can either output internal chip signals to external devices or receive signals input from external devices to internal chip modules.
For specific pin to function-id mappings, please refer to Pinmux Table.
Function ID
Function ID 0~{{IC_PARAM_FUNCID_DEDICATE_END}}
When Function ID is
0~{{IC_PARAM_FUNCID_DEDICATE_END}}, each pin can only connect to fixed signals of specific IPs. These pins have limited configurable functions, but dedicated designs can maximize the performance of each IP module.Note
For example, both Function ID {{IC_PARAM_FUNCID_DEDICATE_SPI0}} and Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} represent SPI functions.
Function ID {{IC_PARAM_FUNCID_DEDICATE_SPI0}} uses dedicated pins, enabling SPI function to achieve maximum rate of 50MHz (master mode);
Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} (full-cross pins) can only achieve maximum rate of 12.5MHz (master mode).
Take
PB5as an example: When configured with Function ID6, this pin will be directly connected to theSPI1_CSsignal of SPI through pin multiplexing.PB5 pin multiplexing connection diagram
Refer to the Pinmux Table for specific function assignments supported by each pin.
Function ID {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}
When Function ID is
{{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}, each pin can connect to different signals of specific IPs. This design provides greater configuration flexibility, but with limitations in application scope and performance (e.g., maximum transmission rate) of some IP modules.Take
PA11as an example:When configuring Function ID of
PA11as20, it connects toUART0_TXDsignal of UART0;When configuring Function ID of
PA11as21, it connects toUART0_RXDsignal of UART0.
PA11 pin multiplexing connection diagram
Refer to the Pinmux Table for specific configurations.
Note
When using
PA23~PA31andPB0~PB10pins, I/O voltage can be set to 1.8V or 3.3V. By default,PB11~PB19are dedicated to Audio functions.If
PB11~PB19pins are used for other functions, note that their I/O voltage can only be set to 1.8V. For more information about I/O voltage, refer to Pinmux Table.
Audio Function
PB11~PB19are Audio function pins. If spare pins are available, it is not recommended to usePB11~PB19for general digital functions to avoid interference with Audio functionality.If multiplexing
PB11~PB19for both Audio and digital functions, ensure proper layout design to keep digital signal traces away from Audio signal traces, thereby reducing interference risks.
ADC/Cap-Touch Function
When using
PA28~PA31andPB1~PB5pins for ADC or Cap-Touch functions, call the programming interfacePAD_InputCtrl(PinName, DISABLE)to disable the digital input path.Cap-Touch performance is closely related to parasitic capacitance. Pay special attention to layout design. For details, refer to the ADC/CTC Layout Guide.
Usage Method
Developers can connect pins to specified on-chip peripheral signals by calling the programming interface Pinmux_Config(PinName, PinFuncID).
Parameter description:
- PinName:
Pin identifier
- PinFuncID:
Specified signal ID of the on-chip peripheral controller
Based on the configured function-id, pins can either output internal chip signals to external devices or receive signals input from external devices to internal chip modules.
For specific pin to function-id mappings, please refer to Pinmux Table.
Function ID
Function ID 0~{{IC_PARAM_FUNCID_DEDICATE_END}}
When Function ID is
0~{{IC_PARAM_FUNCID_DEDICATE_END}}, each pin can only connect to fixed signals of specific IPs. These pins have limited configurable functions, but dedicated designs can maximize the performance of each IP module.Note
For example, both Function ID {{IC_PARAM_FUNCID_DEDICATE_SPI0}} and Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} represent SPI functions.
Function ID {{IC_PARAM_FUNCID_DEDICATE_SPI0}} uses dedicated pins, enabling SPI function to achieve maximum rate of 50MHz (master mode);
Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} (full-cross pins) can only achieve maximum rate of 12.5MHz (master mode).
Take
PB5as an example: When configured with Function ID6, this pin will be directly connected to theSPI1_CSsignal of SPI through pin multiplexing.PB5 pin multiplexing connection diagram
Refer to the Pinmux Table for specific function assignments supported by each pin.
Function ID {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}
When Function ID is
{{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}, each pin can connect to different signals of specific IPs. This design provides greater configuration flexibility, but with limitations in application scope and performance (e.g., maximum transmission rate) of some IP modules.Take
PA11as an example:When configuring Function ID of
PA11as20, it connects toUART0_TXDsignal of UART0;When configuring Function ID of
PA11as21, it connects toUART0_RXDsignal of UART0.
PA11 pin multiplexing connection diagram
Refer to the Pinmux Table for specific configurations.
Note
When using
PA23~PA31andPB0~PB10pins, I/O voltage can be set to 1.8V or 3.3V. By default,PB11~PB19are dedicated to Audio functions.If
PB11~PB19pins are used for other functions, note that their I/O voltage can only be set to 1.8V. For more information about I/O voltage, refer to Pinmux Table.
Audio Function
PB11~PB19are Audio function pins. If spare pins are available, it is not recommended to usePB11~PB19for general digital functions to avoid interference with Audio functionality.If multiplexing
PB11~PB19for both Audio and digital functions, ensure proper layout design to keep digital signal traces away from Audio signal traces, thereby reducing interference risks.
ADC/Cap-Touch Function
When using
PA28~PA31andPB1~PB5pins for ADC or Cap-Touch functions, call the programming interfacePAD_InputCtrl(PinName, DISABLE)to disable the digital input path.Cap-Touch performance is closely related to parasitic capacitance. Pay special attention to layout design. For details, refer to the ADC/CTC Layout Guide.
Usage Method
Developers can connect pins to specified on-chip peripheral signals by calling the programming interface Pinmux_Config(PinName, PinFuncID).
Parameter description:
- PinName:
Pin identifier
- PinFuncID:
Specified signal ID of the on-chip peripheral controller
Based on the configured function-id, pins can either output internal chip signals to external devices or receive signals input from external devices to internal chip modules.
For specific pin to function-id mappings, please refer to Pinmux Table.
Function ID
Function ID 0~{{IC_PARAM_FUNCID_DEDICATE_END}}
Each pin can only connect to fixed signals of specific IPs.
Take
PA0as an example: When configured with Function ID1, this pin will be directly connected to theUART2_RXDsignal of UART2 through pin multiplexing.PA0 pin multiplexing connection diagram
Refer to the Pinmux Table for specific function assignments supported by each pin.
Note
When using
PA9~PA16andPB25~PB31pins, I/O voltage can be set to 1.8V or 3.3V. By default,PA18~PB6are dedicated to Audio functions.If
PA18~PB6pins are used for other functions, note that their I/O voltage can only be set to 1.8V. For more information about I/O voltage, refer to Pinmux Table.
Audio Function
PA18~PB6are Audio function pins. If spare pins are available, it is not recommended to usePA18~PB6for general digital functions to avoid interference with Audio functionality.If multiplexing
PA18~PB6for both Audio and digital functions, ensure proper layout design to keep digital signal traces away from Audio signal traces, thereby reducing interference risks.
ADC/Cap-Touch Function
When using
PA0~PA8pins for ADC or Cap-Touch functions, call the programming interfacePAD_InputCtrl(PinName, DISABLE)to disable the digital input path.Cap-Touch performance is closely related to parasitic capacitance. Pay special attention to layout design. For details, refer to the ADC/CTC Layout Guide.
Usage Method
Developers can connect pins to specified on-chip peripheral signals by calling the programming interface Pinmux_Config(PinName, PinFuncID).
Parameter description:
- PinName:
Pin identifier
- PinFuncID:
Specified signal ID of the on-chip peripheral controller
Based on the configured function-id, pins can either output internal chip signals to external devices or receive signals input from external devices to internal chip modules.
For specific pin to function-id mappings, refer to Pinmux Table.
Function ID
Function ID 0~{{IC_PARAM_FUNCID_DEDICATE_END}}
When Function ID is
0~{{IC_PARAM_FUNCID_DEDICATE_END}}, each pin can only connect to fixed signals of specific IPs. These pins have limited configurable functions, but dedicated designs can maximize the performance of each IP module.Note
For example, both Function ID {{IC_PARAM_FUNCID_DEDICATE_END}} and Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} represent SPI functions.
Function ID {{IC_PARAM_FUNCID_DEDICATE_END}} uses dedicated pins, enabling SPI function to achieve maximum rate of 50MHz (master mode);
Function IDs {{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CLK}}~{{IC_PARAM_FUNCID_FULL_MATRIX_SPI1_CS}} (full-cross pins) can only achieve maximum rate of 12.5MHz (master mode).
Take
PB16as an example: When configured with Function ID10, this pin will be directly connected to theSPI1_CSsignal of UART1 through pin multiplexing.PB16 pin multiplexing connection diagram
Refer to Pinmux Table for specific function assignments supported by each pin.
Function ID {{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}
When Function ID is
{{IC_PARAM_FUNCID_FULL_MATRIX_START}}~{{IC_PARAM_FUNCID_FULL_MATRIX_END}}, each pin can connect to different signals of specific IPs. This design provides greater configuration flexibility, but with limitations in application scope and performance (e.g., maximum transmission rate) of some IP modules.Take
PB19as an example:When configuring Function ID of
PB19as95, it connects toUART0_TXDsignal of UART0;When configuring Function ID of
PB19as96, it connects toUART0_RXDsignal of UART0.
PB19 pin multiplexing connection diagram
Refer to Pinmux Table for specific configurations..
Usage Method
Developers can connect pins to specified on-chip peripheral signals by calling the programming interface Pinmux_Config(PinName, PinFuncID).
Parameter description:
- PinName:
Pin identifier
- PinFuncID:
Specified signal ID of the on-chip peripheral controller
Based on the configured function-id, pins can either output internal chip signals to external devices or receive signals input from external devices to internal chip modules.
For specific pin to function-id mappings, please refer to Pinmux Table.
Function ID
Function ID 0-15
Each pin can only connect to fixed signals of specific IPs.
Take
PA0as an example: When configured with Function ID0, this pin will be directly connected toADC0through pin multiplexing.Refer to the Pinmux Table for specific function assignments supported by each pin.
Trap Pins
Caution
Before development, please pay attention to the following pin multiplexing related matters to avoid usage issues due to accidental behavior.
During chip power-up, certain pins are latched by internal circuits to determine whether to enter different modes.
The table below lists all Trap pins and their descriptions.
Pin name |
Symbol |
Active level |
Description |
|---|---|---|---|
PB31 |
TM_DIS |
Low |
|
PB5 |
UD_DIS |
Low |
|
Pin name |
Symbol |
Active level |
Description |
|---|---|---|---|
PB31 |
TM_DIS |
Low |
|
PB5 |
UD_DIS |
Low |
|
PA22 |
PSO_SEL |
- |
|
Pin name |
Symbol |
Active level |
Description |
|---|---|---|---|
PB31 |
TM_DIS |
Low |
|
PB5 |
UD_DIS |
Low |
|
PA22 |
PSO_SEL |
- |
|
Pin name |
Symbol |
Active level |
Description |
|---|---|---|---|
PB31 |
TM_DIS |
Low |
|
PB5 |
UD_DIS |
Low |
|
PA22 |
PSO_SEL |
- |
|
Pin name |
Symbol |
Active level |
Description |
|---|---|---|---|
PB31 |
TM_DIS |
Low |
|
PB5 |
UD_DIS |
Low |
|
PA22 |
PSO_SEL |
- |
|
Pin name |
Symbol |
Active level |
Description |
|---|---|---|---|
PB22 |
TM_DIS |
Low |
|
PB24 |
UD_DIS |
Low |
|
PB21 |
BOOT_SEL |
- |
Note When OTP fields are programmed, priority is given to the programmed OTP status. |
Pin name |
Symbol |
Active level |
Description |
|---|---|---|---|
PA3 |
TM_DIS |
Low |
|
PB20 |
UD_DIS |
Low |
|
PB18 |
BOOT_SEL |
- |
Note When OTP fields are programmed, priority is given to the programmed OTP status. |
Pin name |
Symbol |
Active level |
Description |
|---|---|---|---|
PA4 |
OTPBYP |
High |
|
PA5 |
TEST_MODE_SEL |
High |
|
PE16 |
PG_MODE_SEL |
High |
|
PE2 |
BOOT_SOURCE |
- |
|
PE0 |
TEST_MODE_ID_0 |
- |
|
PE13 |
TEST_MODE_ID_1 |
- |
|
PE14 |
TEST_MODE_ID_2 |
- |
|
Note
When OTP fields are programmed, priority is given to the programmed OTP status.
Note
Trap pins require external pull-up or pull-down voltage according to the I/O power supply selection.
Wake Pins
General GPIO pins support waking the system from
CGandPGsleep modes.Wake-up pins (
PB30andPB31) are directly connected to wake-up circuits, and can wake the system fromDSLPmode in addition toCGandPGmodes.
Warning
Disable wake-up functionality before multiplexing these two pins.
Wake-up pins may be multiplexed with Trap pins.
When multiplexing, ensure the Trap pin’s signal level after wake-up does not cause the system to enter unexpected modes.
General GPIO pins support waking the system from
CGandPGsleep modes.Wake-up pins (
PA0andPA1) are directly connected to wake-up circuits, and can wake the system fromDSLPmode in addition toCGandPGmodes.
Warning
Disable wake-up functionality before multiplexing these two pins.
Wake-up pins may be multiplexed with Trap pins.
When multiplexing, ensure the Trap pin’s signal level after wake-up does not cause the system to enter unexpected modes.
General GPIO pins support waking the system from
CGandPGsleep modes.Wake-up pins (
PA0andPA1) are directly connected to wake-up circuits, and can wake the system fromDSLPmode in addition toCGandPGmodes.
Warning
Disable wake-up functionality before multiplexing these two pins.
Wake-up pins may be multiplexed with Trap pins.
When multiplexing, ensure the Trap pin’s signal level after wake-up does not cause the system to enter unexpected modes.
General GPIO pins support waking the system from
CGandPGsleep modes.Wake-up pins (
PA0andPA1) are directly connected to wake-up circuits, and can wake the system fromDSLPmode in addition toCGandPGmodes.
Warning
Disable wake-up functionality before multiplexing these two pins.
Wake-up pins may be multiplexed with Trap pins.
When multiplexing, ensure the Trap pin’s signal level after wake-up does not cause the system to enter unexpected modes.
General GPIO pins support waking the system from
CGandPGsleep modes.Wake-up pins (
PA0andPA1) are directly connected to wake-up circuits, and can wake the system fromDSLPmode in addition toCGandPGmodes.
Warning
Disable wake-up functionality before multiplexing these two pins.
Wake-up pins may be multiplexed with Trap pins.
When multiplexing, ensure the Trap pin’s signal level after wake-up does not cause the system to enter unexpected modes.
General GPIO pins support waking the system from
CGandPGsleep modes.Wake-up pins (
PB21~PB24) are directly connected to wake-up circuits, and can wake the system fromDSLPmode in addition toCGandPGmodes.
Warning
Disable wake-up functionality before multiplexing these two pins.
Wake-up pins may be multiplexed with Trap pins.
When multiplexing, ensure the Trap pin’s signal level after wake-up does not cause the system to enter unexpected modes.
General GPIO pins support waking the system from
CGandPGsleep modes.Wake-up pins (
PA0~PA3) are directly connected to wake-up circuits, and can wake the system fromDSLPmode in addition toCGandPGmodes.
Warning
Disable wake-up functionality before multiplexing these two pins.
Wake-up pins may be multiplexed with Trap pins.
When multiplexing, ensure the Trap pin’s signal level after wake-up does not cause the system to enter unexpected modes.
Wake-up pins (
PA0~PA3) are directly connected to wake-up circuits, and can wake the system fromDSLPandPGmodes.Wake-up pins (
PF0~PF17) are directly connected to wake-up circuits, and can wake the system fromPGmode.
Warning
Disable wake-up functionality before multiplexing these two pins.
Wake-up pins may be multiplexed with Trap pins.
When multiplexing, ensure the Trap pin’s signal level after wake-up does not cause the system to enter unexpected modes.
SWD Pins
Pins {{IC_PARAM_SWD_CLK_PIN}} and {{IC_PARAM_SWD_DATA_PIN}} are forcibly locked to the SWD function by default.
If you want to multiplex these two pins, you must first disable the SWD function, which is already handled by the programming interface Pinmux_Config().
Note
When the following log message appears, it indicates that {{IC_PARAM_SWD_CLK_PIN}} or {{IC_PARAM_SWD_DATA_PIN}} has been connected to another module, and you can no longer connect the debugger via that pin.
If you still need to connect the debugger, please refer to Function Multiplexing to reconfigure the pins for the SWD signals.
SWD PAD PortX_PinYY is configured to funcIDZZ
Pins {{IC_PARAM_SWD_CLK_PIN}} and {{IC_PARAM_SWD_DATA_PIN}} are forcibly locked to the SWD function by default.
If you want to multiplex these two pins, you must first disable the SWD function, which is already handled by the programming interface Pinmux_Config().
Note
When the following log message appears, it indicates that {{IC_PARAM_SWD_CLK_PIN}} or {{IC_PARAM_SWD_DATA_PIN}} has been connected to another module, and you can no longer connect the debugger via that pin.
If you still need to connect the debugger, please refer to Function Multiplexing to reconfigure the pins for the SWD signals.
SWD PAD PortX_PinYY is configured to funcIDZZ
Pins {{IC_PARAM_SWD_CLK_PIN}} and {{IC_PARAM_SWD_DATA_PIN}} are forcibly locked to the SWD function by default.
If you want to multiplex these two pins, you must first disable the SWD function, which is already handled by the programming interface Pinmux_Config().
Note
When the following log message appears, it indicates that {{IC_PARAM_SWD_CLK_PIN}} or {{IC_PARAM_SWD_DATA_PIN}} has been connected to another module, and you can no longer connect the debugger via that pin.
If you still need to connect the debugger, please refer to Function Multiplexing to reconfigure the pins for the SWD signals.
SWD PAD PortX_PinYY is configured to funcIDZZ
Pins {{IC_PARAM_SWD_CLK_PIN}} and {{IC_PARAM_SWD_DATA_PIN}} are forcibly locked to the SWD function by default.
If you want to multiplex these two pins, you must first disable the SWD function, which is already handled by the programming interface Pinmux_Config().
Note
When the following log message appears, it indicates that {{IC_PARAM_SWD_CLK_PIN}} or {{IC_PARAM_SWD_DATA_PIN}} has been connected to another module, and you can no longer connect the debugger via that pin.
If you still need to connect the debugger, please refer to Function Multiplexing to reconfigure the pins for the SWD signals.
SWD PAD PortX_PinYY is configured to funcIDZZ
Pins {{IC_PARAM_SWD_CLK_PIN}} and {{IC_PARAM_SWD_DATA_PIN}} are forcibly locked to the SWD function by default.
If you want to multiplex these two pins, you must first disable the SWD function, which is already handled by the programming interface Pinmux_Config().
Note
When the following log message appears, it indicates that {{IC_PARAM_SWD_CLK_PIN}} or {{IC_PARAM_SWD_DATA_PIN}} has been connected to another module, and you can no longer connect the debugger via that pin.
If you still need to connect the debugger, please refer to Function Multiplexing to reconfigure the pins for the SWD signals.
SWD PAD PortX_PinYY is configured to funcIDZZ
Pins {{IC_PARAM_SWD_CLK_PIN}} and {{IC_PARAM_SWD_DATA_PIN}} are forcibly locked to the SWD function by default.
If you want to multiplex these two pins, you must first disable the SWD function, which is already handled by the programming interface Pinmux_Config().
Note
When the following log message appears, it indicates that {{IC_PARAM_SWD_CLK_PIN}} or {{IC_PARAM_SWD_DATA_PIN}} has been connected to another module, and you can no longer connect the debugger via that pin.
If you still need to connect the debugger, please refer to Function Multiplexing to reconfigure the pins for the SWD signals.
SWD PAD PortX_PinYY is configured to funcIDZZ
Pins {{IC_PARAM_SWD_CLK_PIN}} and {{IC_PARAM_SWD_DATA_PIN}} are forcibly locked to the SWD function by default.
If you want to multiplex these two pins, you must first disable the SWD function, which is already handled by the programming interface Pinmux_Config().
Note
When the following log message appears, it indicates that {{IC_PARAM_SWD_CLK_PIN}} or {{IC_PARAM_SWD_DATA_PIN}} has been connected to another module, and you can no longer connect the debugger via that pin.
If you still need to connect the debugger, please refer to Function Multiplexing to reconfigure the pins for the SWD signals.
SWD PAD PortX_PinYY is configured to funcIDZZ
Pins PE_1 and PE_2 are forcibly locked to the SWD function by default.
If you want to multiplex these two pins, you must first disable the SWD function, which is already handled by the programming interface Pinmux_Config().
Note
When the following log message appears, it indicates that PE_1 or PE_2 has been connected to another module, and you can no longer connect the debugger via that pin.
If you still need to connect the debugger, please refer to Function Multiplexing to reconfigure the pins for the SWD signals.
SWD PAD PortX_PinYY is configured to funcIDZZ
Raw API
PINMUX Exported Constants
PINMUX Peripheral Location Definitions
/* Peripheral pinmux location selection 0. */
#define PINMUX_S0 (0)
/* Peripheral pinmux location selection 1. */
#define PINMUX_S1 (1)
/* Peripheral pinmux location selection 2. */
#define PINMUX_S2 (2)
/* Peripheral pinmux location selection 3. */
#define PINMUX_S3 (3)
/* Peripheral pinmux location selection 4. */
#define PINMUX_S4 (4)
/* Peripheral pinmux location selection 5. */
#define PINMUX_S5 (5)
PINMUX Port and Pin Definitions
/* Extract port number from pin name. */
#define PORT_NUM ((pin>>5) & 0x03)
/* Extract pin number from pin name. */
#define PIN_NUM (pin & 0x1f)
PINMUX Exported Functions
-
void Pinmux_Config(u8 PinName, u32 PinFunc)
Set the function type of one pin.
- Parameters:
PinName – Target pin. This parameter must be one of the values defined in PINMUX_Pin_Name_definitions.
PinFunc – The function type for the pin, value of PINMUX_Function_definitions.
-
u32 Pinmux_ConfigGet(u8 PinName)
Get the function type of one pin.
- Parameters:
PinName – Target pin. This parameter must be one of the values defined in PINMUX_Pin_Name_definitions.
- Returns:
The function type for the pin, value of PINMUX_Function_definitions.
-
void Pinmux_Swdoff(void)
Turn off pinmux SWD function.
Note
When multiplexing shared SWD pins to other functions, this function must be called.
Pin Control
Overview
Ameba series I/Os provide flexible connectivity options, supporting interfaces with on-chip analog and digital circuits. For details, see I/O Block Diagram. Methods for configuring PAD connections to on-chip signals can be found in the Pin Multiplexing section. This section mainly introduces the functions and programming methods supported by PAD.
Note
For PAD feature parameters, such as pull-up/down resistor information, drive strength, voltage characteristics, and signal edge rate performance indicators, please refer to the chip datasheet.
I/O Block Diagram
Features
The pin control module supports flexible I/O electrical characteristics control:
Internal Pull-up/Pull-down Resistors
Configurable on-chip resistor network supporting pull-up/pull-down/high-impedance control
Adjustable resistor values for pull-up/pull-down on certain pins
Programmable Driving Strength Levels
Programmable drive capability with multiple selectable levels
Programmable Slew Rate Control
Adjustable signal edge rate, supporting fast/slow mode switching
LP Mode Pin State Management
In Active and Low power modes, the PAD’s PU/PD functions are controlled by different registers. This design allows for independent configuration of internal pull-up or pull-down resistors for each pin in low power mode.
PAD Input States
Normal Sleep Mode (PG or CG)
The PU/PD functions of all PADs are effective.
Deep Sleep Mode
The PU/PD functions of most PADs remain effective;
The power supply to certain PADs will be turned off, causing the PU/PD on these pins to fail, thus they may float.
If circuits connected to these PADs need to be pulled high or low, external resistors must be used on the PCB.
Note
For PADs where the PU/PD function is ineffective in deep sleep mode, please refer to the chip datasheet.
PAD Output States
Normal Sleep Mode (PG or CG)
The PAD output states will remain the same as before sleep.
For example, if an I/O is set to output 1 before sleep, when the system enters PG or CG, this I/O will still maintain output 1.
Deep Sleep Mode
The 1/0 output states set in Active will be invalid.
For example, if an I/O is set to output 1 before sleep, once the system enters deep sleep, this I/O will not maintain the output 1 state.
Raw API
PAD Exported Constants
PAD Drive Strength Definitions
/* PAD drive strength lowest level. */
#define PAD_DRV_ABILITITY_LOW (0)
/* PAD drive strength mid-low level. */
#define PAD_DRV_ABILITITY_MID_LOW (1)
/* PAD drive strength mid-high level. */
#define PAD_DRV_ABILITITY_MID_HIGH (2)
/* PAD drive strength highest level. */
#define PAD_DRV_ABILITITY_HIGH (3)
PAD Pull Resistor Definitions
/* PAD large pull resistor. */
#define PAD_Resistor_LARGE 0x00
/* PAD small pull resistor. */
#define PAD_Resistor_SMALL 0x01
PAD Slew Rate Definitions
/* PAD output slew rate fast. */
#define PAD_SlewRate_Fast (0)
/* PAD output slew rate slow. */
#define PAD_SlewRate_Slow (1)
PAD Exported Functions
-
void PAD_CMD(u8 PinName, u8 NewStatus)
Set the Internal pad shutdown or enable mode.
- Parameters:
PinName – Target pin. This parameter must be one of the values defined in PINMUX_Pin_Name_definitions.
NewStatus – Enable or disable (shutdown)
-
void PAD_DrvStrength(u8 PinName, u32 DrvStrength)
Set the driving strength of the specified PAD.
- Parameters:
PinName – Target pin. This parameter must be one of the values defined in PINMUX_Pin_Name_definitions.
DrvStrength – PAD driving strength. This parameter can be a value of PAD Drive Strength Definitions.
-
void PAD_InputCtrl(u8 PinName, u32 NewState)
Control digital path input.
- Parameters:
PinName – Target pin. This parameter must be one of the values defined in PINMUX_Pin_Name_definitions.
NewState –
Digital path input status.
ENABLE: Enable digital path input.
DISABLE: Disable digital path input.
-
void PAD_PullCtrl(u8 PinName, u8 PullType)
Set the internal PAD pull type.
- Parameters:
PinName – Target pin. This parameter must be one of the values defined in PINMUX_Pin_Name_definitions.
PullType –
Pull type for the pin. This parameter can be one of the following values:
GPIO_PuPd_NOPULL
GPIO_PuPd_DOWN
GPIO_PuPd_UP
-
void PAD_ResistorCtrl(u8 PinName, u8 RType)
Set the internal PAD resistor type.
- Parameters:
PinName – Target pin. This parameter must be one of the values defined in PINMUX_Pin_Name_definitions.
RType –
Resistor type for the pin. This parameter can be one of the following values:
PAD_Resistor_LARGE
PAD_Resistor_SMALL
-
void PAD_SchmitCtrl(u8 PinName, u32 NewState)
Set the PAD Schmitt trigger control status.
- Parameters:
PinName – Target pin. This parameter must be one of the values defined in PINMUX_Pin_Name_definitions.
NewState – Specify the control status. Refer to the datasheet for detail informations. This parameter can be: ENABLE or DISABLE.
-
void PAD_SleepPullCtrl(u8 PinName, u8 PullType)
Set the internal PAD pull type in sleep and deepsleep mode. The hardware will automatically switch to the sleep pull control when the system enters sleep or deepsleep mode. The hardware will automatically switch to the function pull control when the system wakes up from sleep mode.
- Parameters:
PinName – Target pin. This parameter must be one of the values defined in PINMUX_Pin_Name_definitions.
PullType –
Pull type for the pin. This parameter can be one of the following values:
GPIO_PuPd_NOPULL
GPIO_PuPd_DOWN
GPIO_PuPd_UP
-
void PAD_SlewRateCtrl(u8 PinName, u32 NewState)
Set the PAD slew rate control status.
- Parameters:
PinName – Target pin. This parameter must be one of the values defined in PINMUX_Pin_Name_definitions.
NewState –
Specify the slew rate control status. Refer to the datasheet for detail informations. This parameter can be one of the following values:
PAD_SlewRate_Slow
PAD_SlewRate_Fast
Not supported.
-
void APAD_InputCtrl(u8 PinName, u32 NewState)
Control digital path input for Audio share PAD.
- Parameters:
PinName – Pin of Audio share PAD or 0xFF.
NewState –
Digital path input status.
ENABLE: Enable digital path input.
DISABLE: Disable digital path input.
Note
Only valid for Audio share PADs.
If PinName is 0xFF, all the pins of Audio share PAD will be controlled.
FUNCTION_REF=APAD_InputCtrl
FUNCTION_REF=APAD_InputCtrl
FUNCTION_REF=APAD_InputCtrl
FUNCTION_REF=APAD_InputCtrl
Not supported.
Not supported.