
Rev. 1.00
106 of 486
July 31, 2018
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F50231/HT32F50241
8 General Purpose I/O (GPIO)
8 General Purpose I/O (GPIO)
Features
▄
Input / output direction 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.
▄
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 ~ C). 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 and reset control register PxSRR or the port output
reset control 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.