
Rev. 1.00
124 of 576
January 28, 2022
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F54231/HT32F54241/HT32F54243/HT32F54253
8 General Purpose I/O (GPIO)
Features
▆
Input/output direction control
▆
Schmitt Trigger Input function enable control
▆
Input weak pull-up/pull-down control
▆
Output push-pull/open-drain enable control
▆
Output set/reset control
▆
Output drive current selection
▆
External interrupt with programmable trigger edge – using EXTI configuration registers
▆
Analog input/output configurations – using AFIO configuration registers
▆
Alternate function input/output configurations – using AFIO configuration registers
▆
Port configuration lock
Functional Descriptions
Default GPIO Pin Configuration
During or just after the reset period, the alternative functions are all inactive and the GPIO ports
are configured into the input disable floating mode, i.e. input disabled without pull-up/pull-down
resistors. Only the boot and Serial-Wired Debug pins which are pin-shared with the I/O pins are
active after a device reset.
▆
PA9_BOOT: Input enable with internal pull-up
▆
SWCLK: Input enable with internal pull-up
▆
SWDIO: Input enable with internal pull-up
General Purpose I/O – GPIO
The GPIO pins can be configured as inputs or outputs via the data direction control registers
PxDIRCR (where x = A ~ D). When the GPIO pins are configured as input pins, the data on the
external pads can be read if the enable bits in the input enable function register PxINER are set.
The GPIO pull-up/pull-down registers PxPUR/PxPDR can be configured to fit specific applications.
When the pull-up and pull-down functions are both enabled, the pull-up function has the higher
priority while the pull-down function will be blocked until the pull-up function is released.
The GPIO pins can be configured as output pins where the output data is latched into the data
register PxDOUTR. The output type can be setup to be either push-pull or open-drain by the open-
drain selection register PxODR. Only one or several specific bits of the output data will be set
or reset by configuring the port output set/reset control register PxSRR or the port output reset
register PxRR without affecting the unselected bits. As the port output set and reset functions are
both enabled, the port output set function has the higher priority and the port output reset function
will be blocked. The output driving current of the GPIO pins can be selected by configuring the
drive current selection register PxDRVR.