
Rev. 1.00
126 of 576
January 28, 2022
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F54231/HT32F54241/HT32F54243/HT32F54253
8 General Purpose I/O (GPIO)
GPIO Locking Mechanism
The GPIO also offers a lock function to lock the port until a reset event occurs. The PxLOCKR
(x = A ~ D) registers are used to lock the port x and lock control options. The value 0x5FA0 is
written into the PxLKEY field in the PxLOCKR registers to freeze the PxDIRCR, PxINER,
PxPUR, PxPDR, PxODR, PxDRVR control and AFIO mode configuration (GPxCFGHR or
GPxCFGLR, where x = A ~ D). If the value in the PxLOCKR register is 0x5FA0_0001, it means
that the Port x Lock function is enabled and the Port x pin 0 is frozen.
Register Map
The following table shows the GPIO registers and reset values of the Port A ~ D. The port D related
registers are only available for the HT32F54243/HT32F54253 devices.
Table 22. GPIO Register Map
Register
Offset
Description
Reset Value
GPIO A Base Address = 0x400B_0000
PADIRCR
0x000
Port A Data Direction Control Register
0x0000_0000
PAINER
0x004
Port A Input Function Enable Control Register
0x0000_0200
PAPUR
0x008
Port A Pull-Up Selection Register
0x0000_3200
PAPDR
0x00C
Port A Pull-Down Selection Register
0x0000_0000
PAODR
0x010
Port A Open-Drain Selection Register
0x0000_0000
PADRVR
0x014
Port A Drive Current Selection Register
0x0000_0000
PALOCKR
0x018
Port A Lock Register
0x0000_0000
PADINR
0x01C
Port A Data Input Register
0x0000_3200
PADOUTR
0x020
Port A Data Output Register
0x0000_0000
PASRR
0x024
Port A Output Set/Reset Control Register
0x0000_0000
PARR
0x028
Port A Output Reset Control Register
0x0000_0000
GPIO B Base Address = 0x400B_2000
PBDIRCR
0x000
Port B Data Direction Control Register
0x0000_0000
PBINER
0x004
Port B Input Function Enable Control Register
0x0000_0000
PBPUR
0x008
Port B Pull-Up Selection Register
0x0000_0000
PBPDR
0x00C
Port B Pull-Down Selection Register
0x0000_0000
PBODR
0x010
Port B Open-Drain Selection Register
0x0000_0000
PBDRVR
0x014
Port B Drive Current Selection Register
0x0000_0000
PBLOCKR
0x018
Port B Lock Register
0x0000_0000
PBDINR
0x01C
Port B Data Input Register
0x0000_0000
PBDOUTR
0x020
Port B Data Output Register
0x0000_0000
PBSRR
0x024
Port B Output Set/Reset Control Register
0x0000_0000
PBRR
0x028
Port B Output Reset Control Register
0x0000_0000
GPIO C Base Address = 0x400B_4000
PCDIRCR
0x000
Port C Data Direction Control Register
0x0000_0000
PCINER
0x004
Port C Input Function Enable Control Register
0x0000_0000
PCPUR
0x008
Port C Pull-Up Selection Register
0x0000_0000
PCPDR
0x00C
Port C Pull-Down Selection Register
0x0000_0000
PCODR
0x010
Port C Open-Drain Selection Register
0x0000_0000
PCDRVR
0x014
Port C Drive Current Selection Register
0x0000_0000
PCLOCKR
0x018
Port C Lock Register
0x0000_0000