Gpio Initialization Function; External Interrupts; Multiplexing Functions; Gpio Module Input Configuration Structure Block Diagram - WCH CH32V003 Series Reference Manual

Table of Contents

Advertisement

CH32V003 Reference Manual

7.2.2 GPIO initialization function

Just after reset, the GPIO ports run in the initial state, when most I/O ports are running in the floating input
state, but there are also peripheral related pins such as HSE that are running on the peripheral multiplexing
function. Please refer to the chapter related to pin description for the specific initialization function.

7.2.3 External Interrupts

All GPIO ports can be configured with external interrupt input channels, but an external interrupt input channel
can only be mapped to at most one GPIO pin, and the serial number of the external interrupt channel must be
the same as the bit number of the GPIO port, for example, PA1 (or PC1, PD1, etc.) can only be mapped to
EXTI1, and EXTI1 can only accept one of PA1, PC1 or PD1, etc. The mapping of both parties is one-to-one.

7.2.4 Multiplexing functions

It is important to note that using the multiplexing function.
l
To use the multiplexing function in the input direction, the port must be configured in multiplexed input
mode, and the pull-down settings can be set according to actual needs.
l
Using the multiplexing function in the output direction, the port must be configured in multiplexed output
mode, push-pull or open-drain can be set according to the actual situation.
l
For bidirectional multiplexing, the port must be configured in multiplexed output mode, when the driver
is configured in floating input mode
The same I/O port may have multiple peripherals multiplexed to this pin, so in order to maximize the space
for each peripheral, the multiplexed pins of peripherals can be remapped to other pins in addition to the default
multiplexed pins, avoiding the occupied pins.
7.2.5 Locking mechanism
The locking mechanism locks the configuration of the I/O port. After a specific write sequence, the selected
I/O pin configuration will be locked and cannot be changed until the next reset.
7.2.6 Input configuration
Figure 7-2 GPIO module input configuration structure block diagram
Read
Bit set / reset
Write
registers
Read/write
from on-chip peripheral
When the I/O port is configured in input mode, the output driver is disconnected, the input pull-up and pull-
down are selectable, and no multiplexed functions or analog inputs are connected. The data on each I/O port
is sampled into the input data register at each APB2 clock, and the level status of the corresponding pin is
obtained by reading the corresponding bit of the input data register.
V1.3
on
Input data
register
TTL Schmitt
trigger
Input driver
Output data
register
Output driver
52
V
DD
on/off
V
DD
Protection
diode
on/off
V
SS
Protection
diode
V
SS
http://wch.cn
I/ O pin

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents