
GD32L23x User Manual
141
7.3.8.
Alternate function (AF) configuration
To suit for different device packages, the GPIO supports some alternate functions mapped to
some other pins by software.
When be configured as alternate function:
The output buffer is enabled in open-drain or push-pull configuration.
The output buffer is driven by the peripheral.
The schmitt trigger input is enabled.
The weak pull-up and pull-down resistors could be chosen.
The I/O pin data is stored into the port input status register every AHB clock.
A read access to the port input status register gets the I/O state.
A read access to the port output control register gets the last written value.
Figure 7-5. Alternate function configuration
shows the alternate function configuration.
Figure 7-5. Alternate function configuration
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.9.
GPIO locking function
The locking mechanism allows the IO configuration to be protected.
The protected registers are GPIOx_CTL, GPIOx_OMODE, GPIOx_OSPD, GPIOx_PUD and
GPIOx_AFSELy (y=0, 1). It allows the I/O configuration to be frozen by the 32-bit locking
register (GPIOx_LOCK). When the special LOCK sequence has 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
recommended to be used in the configuration of driving a power module.