
CH32V003
Reference Manual
V1.3
34
pending bit.
l
Enabling an EXTI channel as an event channel eliminates the need for the CPU to clear the interrupt flag
bit and the PFIC pending bit after waking up from the WFE.
6.4.3 Description
Using an external interrupt requires configuring the corresponding external interrupt channel, i.e. selecting the
corresponding trigger edge and enabling the corresponding interrupt. When the set trigger edge appears on the
external interrupt channel, an interrupt request will be generated and the corresponding interrupt flag bit will
be set. The flag bit can be cleared by writing 1 to the flag bit.
Steps for using external hardware interrupts.
1)
Configuration of GPIO operations.
2)
Configure the interrupt enable bit (EXTI_INTENR) for the corresponding external interrupt channel.
3)
Configuring the trigger edge (EXTI_RTENR or EXTI_FTENR) to select rising edge trigger, falling edge
trigger or double edge trigger.
4)
Configure EXTI interrupts in the core's PFIC to ensure they can respond correctly.
Steps for using external hardware events.
1)
Configuration of GPIO operations.
2)
Configure the event enable bit (EXTI_EVENR) for the corresponding external interrupt channel.
3)
Configure the trigger edge (EXTI_RTENR or EXTI_FTENR) to select rising edge trigger, falling edge
trigger, or double edge trigger.
Using the software interrupt/event steps.
1)
Enabling external interrupts (EXTI_INTENR) or external events (EXTI_EVENR).
2)
If using interrupt service functions, the EXTI interrupt needs to be set in the core's PFIC.
3)
Set the software interrupt trigger (EXTI_SWIEVR), that is, an interrupt will be generated.
6.4.4 External event mapping
Table 6-2 EXTI Interrupt Mapping
External interrupt/
Event lines
Mapping Event Description
EXTI0
~
EXTI7
Px0 to Px7 (x=A/C/D), any IO port can enable external
interrupt/event function, configured by AFIO_EXTICRx
register.
EXTI8
PVD event: voltage monitoring threshold value exceeded
EXTI9
Auto-wakeup events
6.5 Register description
6.5.1 EXTI registers
Table 6-3 EXTI-related registers list
Name
Access address
Description
Reset value
R32_EXTI_INTENR
0x40010400
Interrupt enable register
0x00000000
R32_EXTI_EVENR
0x40010404
Event enable register
0x00000000
R32_EXTI_RTENR
0x40010408
Rising edge trigger enable register
0x00000000
R32_EXTI_FTENR
0x4001040C
Falling edge trigger enable register
0x00000000
R32_EXTI_SWIEVR
0x40010410
Soft interrupt event register
0x00000000
R32_EXTI_INTFR
0x40010414
Interrupt flag register
0x0000XXXX