GD32F20x User Manual
136
7.3.1.
GPIO pin configuration
During or just after the reset period, the alternative functions are all inactive, and the GPIO
ports are configured in input floating mode, which disables Pull-Up (PU)/Pull-Down (PD)
resistors. But the JTAG/Serial-Wired Debug pins are in input PU/PD mode after reset:
PA15: JTDI in PU mode.
PA14: JTCK / SWCLK in PD mode.
PA13: JTMS / SWDIO in PU mode.
PB4: NJTRST in PU mode.
The GPIO pins can be configured as inputs or outputs. When the GPIO pins are configured
as input pins, all GPIO pins have an internal weak pull-up and weak pull-down which can be
chosen. And the data on the external pins can be captured at every APB2 clock cycle to the
port input status register (GPIOx_ISTAT).
When the GPIO pins are configured as output pins, user can configure the speed of the ports.
And chooses the output driver mode: Push-Pull or Open-Drain mode. The value of the port
output control register (GPIOx_OCTL) is output on the I/O pin.
There is no need to read-then-write when programming the GPIOx_OCTL at bit level, user
can modify only one or several bits in a single atomic APB2
write access by programming ‘1’
to the bit operate register (GPIOx_BOP, or for clearing only GPIOx_BC). The other bits will
not be affected.
7.3.2.
External interrupt/event lines
All ports have external interrupt capability. To use external interrupt lines, the port must be
configured in input mode.
7.3.3.
Alternate functions (AF)
When the port is configured as AFIO (set CTLy
bits to “0b10” or “0b11”, and set MDy bits to
“0b01”, “0b10”, or “0b11”, which is in GPIOx_CTL0/GPIOx_CTL1 registers), the port is used
as peripheral alternate functions. The detail alternate function assignments for each port are
in the device datasheet.
7.3.4.
Input configuration
When GPIO pin is configured as Input:
The schmitt trigger input is enabled.
The weak pull-up and pull-down resistors could be chosen.
Every APB2 clock cycle the data present on the I/O pin is got to the port input status
Register.
The output buffer is disabled.
Summary of Contents for GD32F20 Series
Page 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Page 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Page 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Page 385: ...GD32F20x User Manual 385 ...
Page 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...