10. Interrupts and events
This section applies to the whole STM32L1xxxx family, unless otherwise specified.
10.1 Nested vectored interrupt controller (NVIC)
Features
- • 45 maskable interrupt channels in Cat.1 and Cat.2 devices (see Table 49 ), 54 maskable interrupt channels in Cat.3 devices (see Table 50 ) and 57 channels in Cat.4, Cat.5 and Cat.6 devices (see Table 51 ). These do not include the 16 interrupt lines of Cortex ® -M3.
- • 16 programmable priority levels (4 bits of interrupt priority are used)
- • Low-latency exception and interrupt handling
- • Power management control
- • Implementation of system control registers
The NVIC and the processor core interface are closely coupled, which enables low-latency interrupt processing and efficient processing of late arriving interrupts.
All interrupts including the core exceptions are managed by the NVIC. For more information on exceptions and NVIC programming, refer to the PM0056 programming manual.
10.1.1 SysTick calibration value register
The SysTick calibration value is fixed to 4000, which gives a reference time base of 1 ms with the SysTick clock set to 4 MHz (max HCLK/8).
10.1.2 Interrupt and exception vectors
Table 49 is the vector table for STM32L1xxxx devices.
Table 49. Vector table (Cat.1 and Cat.2 devices)
| Position | Priority | Type of priority | Acronym | Description | Address |
|---|---|---|---|---|---|
| - | - | - | - | Reserved | 0x0000_0000 |
| - | -3 | fixed | Reset | Reset | 0x0000_0004 |
| - | -2 | fixed | NMI_Handler | Non maskable interrupt. The RCC Clock Security System (CSS) is linked to the NMI vector. | 0x0000_0008 |
| - | -1 | fixed | HardFault_Handler | All class of fault | 0x0000_000C |
| - | 0 | settable | MemManage_Handler | Memory management | 0x0000_0010 |
| - | 1 | settable | BusFault_Handler | Pre-fetch fault, memory access fault | 0x0000_0014 |
| - | 2 | settable | UsageFault_Handler | Undefined instruction or illegal state | 0x0000_0018 |
| - | - | - | - | Reserved | 0x0000_001C - 0x0000_002B |
Table 49. Vector table (Cat.1 and Cat.2 devices) (continued)
| Position | Priority | Type of priority | Acronym | Description | Address |
|---|---|---|---|---|---|
| - | 3 | settable | SVC_Handler | System service call via SWI instruction | 0x0000_002C |
| - | 4 | settable | DebugMon_Handler | Debug Monitor | 0x0000_0030 |
| - | - | - | - | Reserved | 0x0000_0034 |
| - | 5 | settable | PendSV_Handler | Pendable request for system service | 0x0000_0038 |
| - | 6 | settable | SysTick_Handler | System tick timer | 0x0000_003C |
| 0 | 7 | settable | WWDG | Window Watchdog interrupt | 0x0000_0040 |
| 1 | 8 | settable | PVD | PVD through EXTI Line detection interrupt | 0x0000_0044 |
| 2 | 9 | settable | TAMPER_STAMP | Tamper and TimeStamp through EXTI line interrupts | 0x0000_0048 |
| 3 | 10 | settable | RTC_WKUP | RTC Wakeup through EXTI line interrupt | 0x0000_004C |
| 4 | 11 | settable | FLASH | Flash global interrupt | 0x0000_0050 |
| 5 | 12 | settable | RCC | RCC global interrupt | 0x0000_0054 |
| 6 | 13 | settable | EXTI0 | EXTI Line0 interrupt | 0x0000_0058 |
| 7 | 14 | settable | EXTI1 | EXTI Line1 interrupt | 0x0000_005C |
| 8 | 15 | settable | EXTI2 | EXTI Line2 interrupt | 0x0000_0060 |
| 9 | 16 | settable | EXTI3 | EXTI Line3 interrupt | 0x0000_0064 |
| 10 | 17 | settable | EXTI4 | EXTI Line4 interrupt | 0x0000_0068 |
| 11 | 18 | settable | DMA1_Channel1 | DMA1 Channel1 global interrupt | 0x0000_006C |
| 12 | 19 | settable | DMA1_Channel2 | DMA1 Channel2 global interrupt | 0x0000_0070 |
| 13 | 20 | settable | DMA1_Channel3 | DMA1 Channel3 global interrupt | 0x0000_0074 |
| 14 | 21 | settable | DMA1_Channel4 | DMA1 Channel4 global interrupt | 0x0000_0078 |
| 15 | 22 | settable | DMA1_Channel5 | DMA1 Channel5 global interrupt | 0x0000_007C |
| 16 | 23 | settable | DMA1_Channel6 | DMA1 Channel6 global interrupt | 0x0000_0080 |
| 17 | 24 | settable | DMA1_Channel7 | DMA1 Channel7 global interrupt | 0x0000_0084 |
| 18 | 25 | settable | ADC1 | ADC1 global interrupt | 0x0000_0088 |
| 19 | 26 | settable | USB_HP | USB High priority interrupt | 0x0000_008C |
| 20 | 27 | settable | USB_LP | USB Low priority interrupt | 0x0000_0090 |
| 21 | 28 | settable | DAC | DAC interrupt | 0x0000_0094 |
| 22 | 29 | settable | COMP, TSC (1) | Comparator wakeup through EXTI line (21 and 22) interrupt, touch sense interrupt (1) | 0x0000_0098 |
| 23 | 30 | settable | EXTI9_5 | EXTI Line[9:5] interrupts | 0x0000_009C |
| 24 | 31 | settable | LCD | LCD global interrupt | 0x0000_00A0 |
Table 49. Vector table (Cat.1 and Cat.2 devices) (continued)
| Position | Priority | Type of priority | Acronym | Description | Address |
|---|---|---|---|---|---|
| 25 | 32 | settable | TIM9 | TIM9 global interrupt | 0x0000_00A4 |
| 26 | 33 | settable | TIM10 | TIM10 global interrupt | 0x0000_00A8 |
| 27 | 34 | settable | TIM11 | TIM11 global interrupt | 0x0000_00AC |
| 28 | 35 | settable | TIM2 | TIM2 global interrupt | 0x0000_00B0 |
| 29 | 36 | settable | TIM3 | TIM3 global interrupt | 0x0000_00B4 |
| 30 | 37 | settable | TIM4 | TIM4 global interrupt | 0x0000_00B8 |
| 31 | 38 | settable | I2C1_EV | I 2 C1 event interrupt | 0x0000_00BC |
| 32 | 39 | settable | I2C1_ER | I 2 C1 error interrupt | 0x0000_00C0 |
| 33 | 40 | settable | I2C2_EV | I 2 C2 event interrupt | 0x0000_00C4 |
| 34 | 41 | settable | I2C2_ER | I 2 C2 error interrupt | 0x0000_00C8 |
| 35 | 42 | settable | SPI1 | SPI1 global interrupt | 0x0000_00CC |
| 36 | 43 | settable | SPI2 | SPI2 global interrupt | 0x0000_00D0 |
| 37 | 44 | settable | USART1 | USART1 global interrupt | 0x0000_00D4 |
| 38 | 45 | settable | USART2 | USART2 global interrupt | 0x0000_00D8 |
| 39 | 46 | settable | USART3 | USART3 global interrupt | 0x0000_00DC |
| 40 | 47 | settable | EXTI15_10 | EXTI Line[15:10] interrupts | 0x0000_00E0 |
| 41 | 48 | settable | RTC_Alarm | RTC Alarms (A and B) through EXTI line interrupt | 0x0000_00E4 |
| 42 | 49 | settable | USB_FS_WKUP | USB Device FS Wakeup through EXTI line interrupt | 0x0000_00E8 |
| 43 | 50 | settable | TIM6 | TIM6 global interrupt | 0x0000_00EC |
| 44 | 51 | settable | TIM7 | TIM7 global interrupt | 0x0000_00F0 |
1. Touch sense interrupt is only in Cat.2 devices.
Table 50. Vector table (Cat.3 devices)
| Position | Priority | Type of priority | Acronym | Description | Address |
|---|---|---|---|---|---|
| - | - | - | - | Reserved | 0x0000_0000 |
| - | -3 | fixed | Reset | Reset | 0x0000_0004 |
| - | -2 | fixed | NMI_Handler | Non maskable interrupt. The RCC Clock Security System (CSS) is linked to the NMI vector. | 0x0000_0008 |
| - | -1 | fixed | HardFault_Handler | All class of fault | 0x0000_000C |
| - | 0 | settable | MemManage_Handler | Memory management | 0x0000_0010 |
Table 50. Vector table (Cat.3 devices) (continued)
| Position | Priority | Type of priority | Acronym | Description | Address |
|---|---|---|---|---|---|
| - | 1 | settable | BusFault_Handler | Pre-fetch fault, memory access fault | 0x0000_0014 |
| - | 2 | settable | UsageFault_Handler | Undefined instruction or illegal state | 0x0000_0018 |
| - | - | - | - | Reserved | 0x0000_001C - 0x0000_002B |
| - | 3 | settable | SVC_Handler | System service call via SWI instruction | 0x0000_002C |
| - | 4 | settable | DebugMon_Handler | Debug Monitor | 0x0000_0030 |
| - | - | - | - | Reserved | 0x0000_0034 |
| - | 5 | settable | PendSV_Handler | Pendable request for system service | 0x0000_0038 |
| - | 6 | settable | SysTick_Handler | System tick timer | 0x0000_003C |
| 0 | 7 | settable | WWDG | Window Watchdog interrupt | 0x0000_0040 |
| 1 | 8 | settable | PVD | PVD through EXTI Line16 detection interrupt | 0x0000_0044 |
| 2 | 9 | settable | TAMPER_STAMP | Tamper, LSECSS and TimeStamp through EXTI line19 interrupts | 0x0000_0048 |
| 3 | 10 | settable | RTC_WKUP | RTC Wakeup through EXTI line20 interrupt | 0x0000_004C |
| 4 | 11 | settable | FLASH | Flash global interrupt | 0x0000_0050 |
| 5 | 12 | settable | RCC | RCC global interrupt | 0x0000_0054 |
| 6 | 13 | settable | EXTI0 | EXTI Line0 interrupt | 0x0000_0058 |
| 7 | 14 | settable | EXTI1 | EXTI Line1 interrupt | 0x0000_005C |
| 8 | 15 | settable | EXTI2 | EXTI Line2 interrupt | 0x0000_0060 |
| 9 | 16 | settable | EXTI3 | EXTI Line3 interrupt | 0x0000_0064 |
| 10 | 17 | settable | EXTI4 | EXTI Line4 interrupt | 0x0000_0068 |
| 11 | 18 | settable | DMA1_Channel1 | DMA1 Channel1 global interrupt | 0x0000_006C |
| 12 | 19 | settable | DMA1_Channel2 | DMA1 Channel2 global interrupt | 0x0000_0070 |
| 13 | 20 | settable | DMA1_Channel3 | DMA1 Channel3 global interrupt | 0x0000_0074 |
| 14 | 21 | settable | DMA1_Channel4 | DMA1 Channel4 global interrupt | 0x0000_0078 |
| 15 | 22 | settable | DMA1_Channel5 | DMA1 Channel5 global interrupt | 0x0000_007C |
| 16 | 23 | settable | DMA1_Channel6 | DMA1 Channel6 global interrupt | 0x0000_0080 |
| 17 | 24 | settable | DMA1_Channel7 | DMA1 Channel7 global interrupt | 0x0000_0084 |
| 18 | 25 | settable | ADC1 | ADC1 global interrupt | 0x0000_0088 |
| 19 | 26 | settable | USB_HP | USB High priority interrupt | 0x0000_008C |
| 20 | 27 | settable | USB_LP | USB Low priority interrupt | 0x0000_0090 |
| 21 | 28 | settable | DAC | DAC interrupt | 0x0000_0094 |
Table 50. Vector table (Cat.3 devices) (continued)
| Position | Priority | Type of priority | Acronym | Description | Address |
|---|---|---|---|---|---|
| 22 | 29 | settable | COMP/CA | Comparator wakeup through EXTI line (21 and 22) interrupt/Channel acquisition interrupt | 0x0000_0098 |
| 23 | 30 | settable | EXTI9_5 | EXTI Line[9:5] interrupts | 0x0000_009C |
| 24 | 31 | settable | LCD | LCD global interrupt | 0x0000_00A0 |
| 25 | 32 | settable | TIM9 | TIM10 global interrupt | 0x0000_00A4 |
| 26 | 33 | settable | TIM10 | TIM10 global interrupt | 0x0000_00A8 |
| 27 | 34 | settable | TIM11 | TIM11 global interrupt | 0x0000_00AC |
| 28 | 35 | settable | TIM2 | TIM2 global interrupt | 0x0000_00B0 |
| 29 | 36 | settable | TIM3 | TIM3 global interrupt | 0x0000_00B4 |
| 30 | 37 | settable | TIM4 | TIM4 global interrupt | 0x0000_00B8 |
| 31 | 38 | settable | I2C1_EV | I 2 C1 event interrupt | 0x0000_00BC |
| 32 | 39 | settable | I2C1_ER | I 2 C1 error interrupt | 0x0000_00C0 |
| 33 | 40 | settable | I2C2_EV | I 2 C2 event interrupt | 0x0000_00C4 |
| 34 | 41 | settable | I2C2_ER | I 2 C2 error interrupt | 0x0000_00C8 |
| 35 | 42 | settable | SPI1 | SPI1 global interrupt | 0x0000_00CC |
| 36 | 43 | settable | SPI2 | SPI2 global interrupt | 0x0000_00D0 |
| 37 | 44 | settable | USART1 | USART1 global interrupt | 0x0000_00D4 |
| 38 | 45 | settable | USART2 | USART2 global interrupt | 0x0000_00D8 |
| 39 | 46 | settable | USART3 | USART3 global interrupt | 0x0000_00DC |
| 40 | 47 | settable | EXTI15_10 | EXTI Line[15:10] interrupts | 0x0000_00E0 |
| 41 | 48 | settable | RTC_Alarm | RTC Alarms (A and B) through EXTI line17 interrupt | 0x0000_00E4 |
| 42 | 49 | settable | USB_FS_WKUP | USB Device FS Wakeup through EXTI line18 interrupt | 0x0000_00E8 |
| 43 | 50 | settable | TIM6 | TIM6 global interrupt | 0x0000_00EC |
| 44 | 51 | settable | TIM7 | TIM7 global interrupt | 0x0000_00F0 |
| 45 | 53 | settable | TIM5 | TIM5 Global interrupt | 0x0000_00F8 |
| 46 | 54 | settable | SPI3 | SPI3 Global interrupt | 0x0000_00FC |
| 47 | 57 | settable | DMA2_CH1 | DMA2 Channel 1 interrupt | 0x0000_0108 |
| 48 | 58 | settable | DMA2_CH2 | DMA2 Channel 2 interrupt | 0x0000_010C |
| 49 | 59 | settable | DMA2_CH3 | DMA2 Channel 3 interrupt | 0x0000_0110 |
| 50 | 60 | settable | DMA2_CH4 | DMA2 Channel 4 interrupt | 0x0000_0114 |
| 51 | 61 | settable | DMA2_CH5 | DMA2 Channel 5 interrupt | 0x0000_0118 |
Table 50. Vector table (Cat.3 devices) (continued)
| Position | Priority | Type of priority | Acronym | Description | Address |
|---|---|---|---|---|---|
| 52 | 62 | settable | AES | AES global interrupt | 0x0000_011C |
| 53 | 63 | settable | COMP_ACQ | Comparator Channel Acquisition Interrupt | 0x0000_0120 |
Table 51. Vector table (Cat.4, Cat.5 and Cat.6 devices)
| Position | Priority | Type of priority | Acronym | Description | Address |
|---|---|---|---|---|---|
| - | - | - | - | Reserved | 0x0000_0000 |
| - | -3 | fixed | Reset | Reset | 0x0000_0004 |
| - | -2 | fixed | NMI_Handler | Non maskable interrupt. The RCC Clock Security System (CSS) is linked to the NMI vector. | 0x0000_0008 |
| - | -1 | fixed | HardFault_Handler | All class of fault | 0x0000_000C |
| - | 0 | settable | MemManage_Handler | Memory management | 0x0000_0010 |
| - | 1 | settable | BusFault_Handler | Pre-fetch fault, memory access fault | 0x0000_0014 |
| - | 2 | settable | UsageFault_Handler | Undefined instruction or illegal state | 0x0000_0018 |
| - | - | - | - | Reserved | 0x0000_001C - 0x0000_002B |
| - | 3 | settable | SVC_Handler | System service call via SWI instruction | 0x0000_002C |
| - | 4 | settable | DebugMon_Handler | Debug Monitor | 0x0000_0030 |
| - | - | - | - | Reserved | 0x0000_0034 |
| - | 5 | settable | PendSV_Handler | Pendable request for system service | 0x0000_0038 |
| - | 6 | settable | SysTick_Handler | System tick timer | 0x0000_003C |
| 0 | 7 | settable | WWDG | Window Watchdog interrupt | 0x0000_0040 |
| 1 | 8 | settable | PVD | PVD through EXTI Line16 detection interrupt | 0x0000_0044 |
| 2 | 9 | settable | TAMPER_STAMP | Tamper, LSECSS and TimeStamp through EXTI line19 interrupts | 0x0000_0048 |
| 3 | 10 | settable | RTC_WKUP | RTC Wakeup through EXTI line20 interrupt | 0x0000_004C |
| 4 | 11 | settable | FLASH | Flash global interrupt | 0x0000_0050 |
| 5 | 12 | settable | RCC | RCC global interrupt | 0x0000_0054 |
| 6 | 13 | settable | EXTI0 | EXTI Line0 interrupt | 0x0000_0058 |
| 7 | 14 | settable | EXTI1 | EXTI Line1 interrupt | 0x0000_005C |
| 8 | 15 | settable | EXTI2 | EXTI Line2 interrupt | 0x0000_0060 |
| 9 | 16 | settable | EXTI3 | EXTI Line3 interrupt | 0x0000_0064 |
Table 51. Vector table (Cat.4, Cat.5 and Cat.6 devices) (continued)
| Position | Priority | Type of priority | Acronym | Description | Address |
|---|---|---|---|---|---|
| 10 | 17 | settable | EXTI4 | EXTI Line4 interrupt | 0x0000_0068 |
| 11 | 18 | settable | DMA1_Channel1 | DMA1 Channel1 global interrupt | 0x0000_006C |
| 12 | 19 | settable | DMA1_Channel2 | DMA1 Channel2 global interrupt | 0x0000_0070 |
| 13 | 20 | settable | DMA1_Channel3 | DMA1 Channel3 global interrupt | 0x0000_0074 |
| 14 | 21 | settable | DMA1_Channel4 | DMA1 Channel4 global interrupt | 0x0000_0078 |
| 15 | 22 | settable | DMA1_Channel5 | DMA1 Channel5 global interrupt | 0x0000_007C |
| 16 | 23 | settable | DMA1_Channel6 | DMA1 Channel6 global interrupt | 0x0000_0080 |
| 17 | 24 | settable | DMA1_Channel7 | DMA1 Channel7 global interrupt | 0x0000_0084 |
| 18 | 25 | settable | ADC1 | ADC1 global interrupt | 0x0000_0088 |
| 19 | 26 | settable | USB_HP | USB High priority interrupt | 0x0000_008C |
| 20 | 27 | settable | USB_LP | USB Low priority interrupt | 0x0000_0090 |
| 21 | 28 | settable | DAC | DAC interrupt | 0x0000_0094 |
| 22 | 29 | settable | COMP/CA | Comparator wakeup through EXTI line (21 and 22) interrupt/Channel acquisition interrupt | 0x0000_0098 |
| 23 | 30 | settable | EXTI9_5 | EXTI Line[9:5] interrupts | 0x0000_009C |
| 24 | 31 | settable | LCD | LCD global interrupt | 0x0000_00A0 |
| 25 | 32 | settable | TIM9 | TIM10 global interrupt | 0x0000_00A4 |
| 26 | 33 | settable | TIM10 | TIM10 global interrupt | 0x0000_00A8 |
| 27 | 34 | settable | TIM11 | TIM11 global interrupt | 0x0000_00AC |
| 28 | 35 | settable | TIM2 | TIM2 global interrupt | 0x0000_00B0 |
| 29 | 36 | settable | TIM3 | TIM3 global interrupt | 0x0000_00B4 |
| 30 | 37 | settable | TIM4 | TIM4 global interrupt | 0x0000_00B8 |
| 31 | 38 | settable | I2C1_EV | I 2 C1 event interrupt | 0x0000_00BC |
| 32 | 39 | settable | I2C1_ER | I 2 C1 error interrupt | 0x0000_00C0 |
| 33 | 40 | settable | I2C2_EV | I 2 C2 event interrupt | 0x0000_00C4 |
| 34 | 41 | settable | I2C2_ER | I 2 C2 error interrupt | 0x0000_00C8 |
| 35 | 42 | settable | SPI1 | SPI1 global interrupt | 0x0000_00CC |
| 36 | 43 | settable | SPI2 | SPI2 global interrupt | 0x0000_00D0 |
| 37 | 44 | settable | USART1 | USART1 global interrupt | 0x0000_00D4 |
| 38 | 45 | settable | USART2 | USART2 global interrupt | 0x0000_00D8 |
| 39 | 46 | settable | USART3 | USART3 global interrupt | 0x0000_00DC |
| 40 | 47 | settable | EXTI15_10 | EXTI Line[15:10] interrupts | 0x0000_00E0 |
| 41 | 48 | settable | RTC_Alarm | RTC Alarms (A and B) through EXTI line17 interrupt | 0x0000_00E4 |
Table 51. Vector table (Cat.4, Cat.5 and Cat.6 devices) (continued)
| Position | Priority | Type of priority | Acronym | Description | Address |
|---|---|---|---|---|---|
| 42 | 49 | settable | USB_FS_WKUP | USB Device FS Wakeup through EXTI line18 interrupt | 0x0000_00E8 |
| 43 | 50 | settable | TIM6 | TIM6 global interrupt | 0x0000_00EC |
| 44 | 51 | settable | TIM7 | TIM7 global interrupt | 0x0000_00F0 |
| 45 | 52 | settable | SDIO | SDIO Global interrupt | 0x0000_00F4 |
| 46 | 53 | settable | TIM5 | TIM5 Global interrupt | 0x0000_00F8 |
| 47 | 54 | settable | SPI3 | SPI3 Global interrupt | 0x0000_00FC |
| 48 | 55 | settable | UART4 | UART4 Global interrupt | 0x0000_0100 |
| 49 | 56 | settable | UART5 | UART5 Global interrupt | 0x0000_0104 |
| 50 | 57 | settable | DMA2_CH1 | DMA2 Channel 1 interrupt | 0x0000_0108 |
| 51 | 58 | settable | DMA2_CH2 | DMA2 Channel 2 interrupt | 0x0000_010C |
| 52 | 59 | settable | DMA2_CH3 | DMA2 Channel 3 interrupt | 0x0000_0110 |
| 53 | 60 | settable | DMA2_CH4 | DMA2 Channel 4 interrupt | 0x0000_0114 |
| 54 | 61 | settable | DMA2_CH5 | DMA2 Channel 5 interrupt | 0x0000_0118 |
| 55 | 62 | settable | AES | AES global interrupt | 0x0000_011C |
| 56 | 63 | settable | COMP_ACQ | Comparator Channel Acquisition Interrupt | 0x0000_0120 |
10.2 External interrupt/event controller (EXTI)
The external interrupt/event controller consists of up to 24 (or 23 for Cat.1 and Cat.2 devices) edge detectors for generating event/interrupt requests. Each input line can be independently configured to select the type (event or interrupt) and the corresponding trigger event (rising edge, falling edge or both). Each line can also be masked independently. A pending register maintains the status line of the interrupt requests.
10.2.1 Main features
The main features of the EXTI controller are the following:
- • Independent trigger and mask on each interrupt/event line
- • Dedicated status bit for each interrupt line
- • Generation of up to 24 (or 23 for Cat.1 and Cat.2 devices) software event/interrupt requests
- • Detection of external signals with a pulse width lower than the APB2 clock period. Refer to the electrical characteristics section of the STM32L1xxxx datasheet for details on this parameter.
10.2.2 Block diagram
The block diagram is shown in Figure 32 .
Figure 32. External interrupt/event controller block diagram

10.2.3 Wakeup event management
The STM32L1xxxx is able to handle external or internal events in order to wake up the core (WFE). The wakeup event can be generated by either:
- • enabling an interrupt in the peripheral control register but not in the NVIC, and enabling the SEVONPEND bit in the Cortex®-M3 system control register. When the MCU resumes from WFE, the peripheral interrupt pending bit and the peripheral NVIC IRQ channel pending bit (in the NVIC interrupt clear pending register) have to be cleared.
- • or configuring an external or internal EXTI line in event mode. When the CPU resumes from WFE, it is not necessary to clear the peripheral interrupt pending bit or the NVIC IRQ channel pending bit as the pending bit corresponding to the event line is not set.
To use an external line as a wakeup event, refer to Section 10.2.4: Functional description .
10.2.4 Functional description
To generate the interrupt, the interrupt line should be configured and enabled. This is done by programming the two trigger registers with the desired edge detection and by enabling the interrupt request by writing a '1' to the corresponding bit in the interrupt mask register. When the selected edge occurs on the external interrupt line, an interrupt request is generated. The pending bit corresponding to the interrupt line is also set. This request is reset by writing a '1' into the pending register.
To generate the event, the event line should be configured and enabled. This is done by programming the two trigger registers with the desired edge detection and by enabling the event request by writing a '1 to the corresponding bit in the event mask register. When the selected edge occurs on the event line, an event pulse is generated. The pending bit corresponding to the event line is not set
An interrupt/event request can also be generated by software by writing a '1 into the software interrupt/event register.
Hardware interrupt selection
To configure the 24 (or 23 for Cat.1 and Cat.2 devices) lines as interrupt sources, use the following procedure:
- • Configure the mask bits of the Interrupt lines (EXTI_IMR)
- • Configure the Trigger Selection bits of the Interrupt lines (EXTI_RTSR and EXTI_FTSR)
- • Configure the enable and mask bits that control the NVIC IRQ channel mapped to the external interrupt controller (EXTI) so that an interrupt coming from any one of the lines can be correctly acknowledged.
Hardware event selection
To configure the 24 (or 23 for Cat.1 and Cat.2 devices) lines as event sources, use the following procedure:
- • Configure the mask bits of the Event lines (EXTI_EMR)
- • Configure the Trigger Selection bits of the Event lines (EXTI_RTSR and EXTI_FTSR)
Software interrupt/event selection
The 24 (or 23 for Cat.1 and Cat.2 devices) lines can be configured as software interrupt/event lines. The following is the procedure to generate a software interrupt.
- • Configure the mask bits of the Interrupt/Event lines (EXTI_IMR, EXTI_EMR)
- • Set the required bit in the software interrupt register (EXTI_SWIER)
10.2.5 External interrupt/event line mapping
Up to 116 GPIOs are connected to the 16 external interrupt/event lines in the following manner:
Figure 33. External interrupt/event GPIO mapping

The diagram illustrates the mapping of various GPIO pins to external interrupt (EXTI) lines through multiplexers. Each multiplexer is controlled by a 4-bit configuration in the SYSCFG_EXTICR registers.
- EXTI0: Controlled by EXTI0[3:0] bits in SYSCFG_EXTICR1 register. Inputs: PA0, PB0, PC0, PD0, PE0, PF0, PG0, PH0. Output: EXTI0 .
- EXTI1: Controlled by EXTI1[3:0] bits in SYSCFG_EXTICR1 register. Inputs: PA1, PB1, PC1, PD1, PE1, PF1, PG1, PH1. Output: EXTI1 .
- EXTI2: Controlled by EXTI2[3:0] bits in SYSCFG_EXTICR1 register. Inputs: PA2, PB2, PC2, PD2, PE2, PF2, PG2, PH2. Output: EXTI2 .
- EXTI3: Controlled by EXTI3[3:0] bits in SYSCFG_EXTICR1 register. Inputs: PA3, PB3, PC3, PD3, PE3, PF3, PG3. Output: EXTI3 . A vertical dashed line indicates a gap in the sequence.
- EXTI15: Controlled by EXTI15[3:0] bits in SYSCFG_EXTICR4 register. Inputs: PA15, PB15, PC15, PD15, PE15, PF15, PG15. Output: EXTI15 .
ai17142b
The other EXTI lines are connected as follows:
- EXTI line 16 is connected to the PVD output
- EXTI line 17 is connected to the RTC Alarm event
- EXTI line 18 is connected to the USB Device FS wakeup event
- EXTI line 19 is connected to the RTC Tamper and TimeStamp events
- EXTI line 20 is connected to the RTC Wakeup event
- EXTI line 21 is connected to the Comparator 1 wakeup event
- EXTI line 22 is connected to the Comparator 2 wakeup event
- EXTI line 23 is connected to the channel acquisition interrupt
10.3 EXTI registers
Refer to Section 1.2 for a list of abbreviations used in register descriptions.
The peripheral registers have to be accessed by words (32-bit).
10.3.1 EXTI interrupt mask register (EXTI_IMR)
Address offset: 0x00
Reset value: 0x0000 0000
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reserved | MR23 (1) | MR22 | MR21 | MR20 | MR19 | MR18 | MR17 | MR16 | |||||||
| rw | rw | rw | rw | rw | rw | rw | rw | ||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| MR15 | MR14 | MR13 | MR12 | MR11 | MR10 | MR9 | MR8 | MR7 | MR6 | MR5 | MR4 | MR3 | MR2 | MR1 | MR0 |
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw |
1. Only in Cat.3, Cat.4, Cat.5 and Cat.6 devices
Bits 31:24 Reserved, must be kept at reset value.
Bits 23:0 MRx : Interrupt mask on line x
0: Interrupt request from Line x is masked
1: Interrupt request from Line x is not masked
10.3.2 EXTI event mask register (EXTI_EMR)
Address offset: 0x04
Reset value: 0x0000 0000
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reserved | MR23 (1) | MR22 | MR21 | MR20 | MR19 | MR18 | MR17 | MR16 | |||||||
| rw | rw | rw | rw | rw | rw | rw | rw | ||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| MR15 | MR14 | MR13 | MR12 | MR11 | MR10 | MR9 | MR8 | MR7 | MR6 | MR5 | MR4 | MR3 | MR2 | MR1 | MR0 |
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw |
1. Only in Cat.3, Cat.4, Cat.5 and Cat.6 devices
Bits 31:24 Reserved, must be kept at reset value.
Bits 23:0 MRx : Event mask on line x
- 0: Event request from Line x is masked
- 1: Event request from Line x is not masked
10.3.3 EXTI rising edge trigger selection register (EXTI_RTSR)
Address offset: 0x08
Reset value: 0x0000 0000
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reserved | TR23 (1) | TR22 | TR21 | TR20 | TR19 | TR18 | TR17 | TR16 | |||||||
| rw | rw | rw | rw | rw | rw | rw | rw | ||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| TR15 | TR14 | TR13 | TR12 | TR11 | TR10 | TR9 | TR8 | TR7 | TR6 | TR5 | TR4 | TR3 | TR2 | TR1 | TR0 |
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw |
1. Only in Cat.3, Cat.4, Cat.5 and Cat.6 devices
Bits 31:24 Reserved, must be kept at reset value.
Bits 23:0 TRx : Rising edge trigger event configuration bit of line x
- 0: Rising edge trigger disabled (for Event and Interrupt) for input line x
- 1: Rising edge trigger enabled (for Event and Interrupt) for input line x
Note: The external wakeup lines are edge triggered, no glitch must be generated on these lines. If a rising edge on the external interrupt line occurs while writing to the EXTI_RTSR register, the pending bit is not set. Rising and falling edge triggers can be set for the same interrupt line. In this configuration, both generate a trigger condition.
10.3.4 Falling edge trigger selection register (EXTI_FTSR)
Address offset: 0x0C
Reset value: 0x0000 0000
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reserved | TR23 (1) | TR22 | TR21 | TR20 | TR19 | TR18 | TR17 | TR16 | |||||||
| rw | rw | rw | rw | rw | rw | rw | rw | ||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| TR15 | TR14 | TR13 | TR12 | TR11 | TR10 | TR9 | TR8 | TR7 | TR6 | TR5 | TR4 | TR3 | TR2 | TR1 | TR0 |
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw |
1. Only in Cat.3, Cat.4, Cat.5 and Cat.6 devices
Bits 31:24 Reserved, must be kept at reset value.
Bits 23:0 TRx : Falling edge trigger event configuration bit of line x
0: Falling edge trigger disabled (for Event and Interrupt) for input line x
1: Falling edge trigger enabled (for Event and Interrupt) for input line x
Note: The external wakeup lines are edge triggered, no glitch must be generated on these lines. If a falling edge on the external interrupt line occurs while writing to the EXTI_FTSR register, the pending bit is not set.
Rising and falling edge triggers can be set for the same interrupt line. In this configuration, both generate a trigger condition.
10.3.5 EXTI software interrupt event register (EXTI_SWIER)
Address offset: 0x10
Reset value: 0x0000 0000
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reserved | SWIER 23 (1) | SWIER 22 | SWIER 21 | SWIER 20 | SWIER 19 | SWIER 18 | SWIER 17 | SWIER 16 | |||||||
| rw | rw | rw | rw | rw | rw | rw | rw | ||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| SWIER 15 | SWIER 14 | SWIER 13 | SWIER 12 | SWIER 11 | SWIER 10 | SWIER 9 | SWIER 8 | SWIER 7 | SWIER 6 | SWIER 5 | SWIER 4 | SWIER 3 | SWIER 2 | SWIER 1 | SWIER 0 |
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw |
1. Only in Cat.3, Cat.4, Cat.5 and Cat.6 devices
Bits 31:23 Reserved, must be kept at reset value.
Bits 22:0 SWIERx : Software interrupt on line x
If the interrupt is enabled on this line in the EXTI_IMR, writing a '1' to this bit when it is at '0' sets the corresponding pending bit in EXTI_PR resulting in an interrupt request generation.
This bit is cleared by clearing the corresponding bit in EXTI_PR (by writing a '1' to this bit).
10.3.6 EXTI pending register (EXTI_PR)
Address offset: 0x14
Reset value: undefined
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Reserved | PR23 (1) | PR22 | PR21 | PR20 | PR19 | PR18 | PR17 | PR16 | |||||||
| rw | rw | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | ||||||||
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| PR15 | PR14 | PR13 | PR12 | PR11 | PR10 | PR9 | PR8 | PR7 | PR6 | PR5 | PR4 | PR3 | PR2 | PR1 | PR0 |
| rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 | rc_w1 |
1. Only in Cat.3, Cat.4, Cat.5 and Cat.6 devices
Bits 31:24 Reserved, must be kept at reset value.
Bits 23:0
PRx
: Pending bit
0: No trigger request occurred
1: The selected trigger request occurred
This bit is set when the selected edge event arrives on the external interrupt line. This bit is cleared by writing a '1' to the bit.
10.3.7 EXTI register map
The following table gives the EXTI register map and the reset values. The reserved memory areas are highlighted in gray in the table.
Table 52. External interrupt/event controller register map and reset values
| Offset | Register | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x00 | EXTI_IMR | Reserved | MR[23:0] | ||||||||||||||||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||
| 0x04 | EXTI_EMR | Reserved | MR[23:0] | ||||||||||||||||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||
| 0x08 | EXTI_RTSR | Reserved | TR[23:0] | ||||||||||||||||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||
| 0x0C | EXTI_FTSR | Reserved | TR[23:0] | ||||||||||||||||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||
| 0x10 | EXTI_SWIER | Reserved | SWIER[23:0] | ||||||||||||||||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||
Table 52. External interrupt/event controller register map and reset values (continued)
| Offset | Register | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x14 | EXTI_PR | Reserved | |||||||||||||||||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
Refer to Table 5 on page 47 for the register boundary addresses.