GD32VF103 User Manual
107
Vss
Output
Control
Vdd
Alternate Function Output
Alternate Function Input
Input driver
Output driver
I/O pin
Schmitt
trigger
ESD
protection
Vdd
Vss
7.3.8.
IO pin function selection
Each IO pin can implement many functions, each function selected by GPIO registers.
GPIO:
Each IO pin can be used for GPIO input function by configuring MDy bits to 0b00 in
GPIOx_CTL0/GPIOx_CTL1 registers. And set output function by configuring MDy bits to 0b01,
0b10, or 0b11 and configuring CTLy bits of corresponding port in GPIOx_CTL0/GPIOx_CTL1
register to 0b00 (for GPIO push-pull output) or 0b01 (for GPIO open-drain output).
Alternate function:
Each IO pin can be used for AF input function by configuring MDy bits to 0b00 in
GPIOx_CTL0/GPIOx_CTL1 registers. And set output function by configuring MDy bits to 0b01,
0b10, or 0b11 and configuring CTLy bits of corresponding port in GPIOx_CTL0/GPIOx_CTL1
register to 0b10 (for AF push-pull output) or 0b11 (for AF open-drain output).
7.3.9.
GPIO locking function
The locking mechanism allows the IO configuration to be protected.
The protected registers are GPIOx_CTL0, GPIOx_CTL1. It allows the I/O configuration to be
frozen by the 32-bit locking register (GPIOx_LOCK). When the special LOCK sequence has
been occurred on LKK bit in GPIOx_LOCK register and the LKy bit is set in GPIOx_LOCK
register, the corresponding port is locked and the corresponding port configuration cannot be
modified until the next reset. It should be recommended to be used in the configuration of
driving a power module.