11. Extended interrupts and events controller (EXTI)

The external interrupt/event controller consists of up to 25 edge detectors for generating event/interrupt requests. Each input line can be independently configured to select the type (interrupt or event) and the corresponding trigger event (rising or falling or both). Each line can also be masked independently. A pending register maintains the status line of the interrupt requests.

11.1 EXTI main features

The main features of the EXTI controller are the following:

11.2 EXTI block diagram

Figure 30 shows the block diagram.

Figure 30. External interrupt/event controller block diagram

Block diagram of the External interrupt/event controller (EXTI) showing its internal architecture and connections.

The block diagram illustrates the internal architecture of the EXTI controller. At the top, an 'AMBA APB bus' is connected to a 'Peripheral interface'. The 'Peripheral interface' is also connected to 'PCLK2' and has bidirectional connections to five registers: 'Pending request register', 'Interrupt mask register', 'Software interrupt event register', 'Rising trigger selection register', and 'Falling trigger selection register'. Below these registers, the 'Pending request register' and 'Interrupt mask register' are connected to an AND gate, which outputs to the 'To NVIC interrupt controller'. The 'Software interrupt event register' and 'Event mask register' (located below the AND gate) are connected to an OR gate. The 'Rising trigger selection register' and 'Falling trigger selection register' are connected to an 'Edge detect circuit', which is also connected to an 'Input line'. The output of the 'Edge detect circuit' is connected to the 'OR gate'. The output of the 'OR gate' is connected to a 'Pulse generator', which outputs to the 'To NVIC interrupt controller'.

Block diagram of the External interrupt/event controller (EXTI) showing its internal architecture and connections.

11.3 Wakeup event management

The STM32F76xxx and STM32F77xxx devices are able to handle external or internal events in order to wake up the core (WFE). The wakeup event can be generated either by:

To use an external line as a wakeup event, refer to Section 11.4: Functional description .

11.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' in 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' in the software interrupt/event register.

11.5 Hardware interrupt selection

To configure a line as interrupt sources, use the following procedure:

  1. 1. Configure the corresponding mask bit (EXTI_IMR)
  2. 2. Configure the Trigger selection bits of the interrupt lines (EXTI_RTSR and EXTI_FTSR)
  3. 3. 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 one of the 25 lines can be correctly acknowledged.

11.6 Hardware event selection

To configure a line as event sources, use the following procedure:

  1. 1. Configure the corresponding mask bit (EXTI_EMR)
  2. 2. Configure the Trigger selection bits of the event line (EXTI_RTSR and EXTI_FTSR)

11.7 Software interrupt/event selection

The line can be configured as software interrupt/event line. The following is the procedure to generate a software interrupt.

  1. 1. Configure the corresponding mask bit (EXTI_IMR, EXTI_EMR)
  2. 2. Set the required bit in the software interrupt register (EXTI_SWIER)

11.8 External interrupt/event line mapping

Up to 168 GPIOs are connected to the 16 external interrupt/event lines in the following manner:

Figure 31. External interrupt/event GPIO mapping

Diagram showing the mapping of GPIOs to external interrupt lines. It consists of three multiplexers. The first multiplexer for EXTI0 is controlled by EXTI0[3:0] bits in the SYSCFG_EXTICR1 register and selects from PA0, PB0, PC0, PD0, PE0, PF0, PG0, PH0, PI0, PJ0, and PK0. The second multiplexer for EXTI1 is controlled by EXTI1[3:0] bits in the SYSCFG_EXTICR1 register and selects from PA1, PB1, PC1, PD1, PE1, PF1, PG1, PH1, PI1, PJ1, and PK1. The third multiplexer for EXTI15 is controlled by EXTI15[3:0] bits in the SYSCFG_EXTICR4 register and selects from PA15, PB15, PC15, PD15, PE15, PF15, PG15, PH15, and PJ15.

MS30440V1

Diagram showing the mapping of GPIOs to external interrupt lines. It consists of three multiplexers. The first multiplexer for EXTI0 is controlled by EXTI0[3:0] bits in the SYSCFG_EXTICR1 register and selects from PA0, PB0, PC0, PD0, PE0, PF0, PG0, PH0, PI0, PJ0, and PK0. The second multiplexer for EXTI1 is controlled by EXTI1[3:0] bits in the SYSCFG_EXTICR1 register and selects from PA1, PB1, PC1, PD1, PE1, PF1, PG1, PH1, PI1, PJ1, and PK1. The third multiplexer for EXTI15 is controlled by EXTI15[3:0] bits in the SYSCFG_EXTICR4 register and selects from PA15, PB15, PC15, PD15, PE15, PF15, PG15, PH15, and PJ15.

The eight other EXTI lines are connected as follows:

11.9 EXTI registers

Refer to Section 1.2 on page 70 for a list of abbreviations used in register descriptions.

11.9.1 Interrupt mask register (EXTI_IMR)

Address offset: 0x00

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.MR24MR23MR22MR21MR20MR19MR18MR17MR16
rwrwrwrwrwrwrwrwrw
1514131211109876543210
MR15MR14MR13MR12MR11MR10MR9MR8MR7MR6MR5MR4MR3MR2MR1MR0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:25 Reserved, must be kept at reset value.

Bits 24:0 MRx : Interrupt mask on line x

0: Interrupt request from line x is masked

1: Interrupt request from line x is not masked

11.9.2 Event mask register (EXTI_EMR)

Address offset: 0x04

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.MR24MR23MR22MR21MR20MR19MR18MR17MR16
rwrwrwrwrwrwrwrwrw
1514131211109876543210
MR15MR14MR13MR12MR11MR10MR9MR8MR7MR6MR5MR4MR3MR2MR1MR0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:25 Reserved, must be kept at reset value.

Bits 24:0 MRx : Event mask on line x

0: Event request from line x is masked

1: Event request from line x is not masked

11.9.3 Rising trigger selection register (EXTI_RTSR)

Address offset: 0x08

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.TR24TR23TR22TR21TR20TR19TR18TR17TR16
rwrwrwrwrwrwrwrwrw
1514131211109876543210
TR15TR14TR13TR12TR11TR10TR9TR8TR7TR6TR5TR4TR3TR2TR1TR0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:25 Reserved, must be kept at reset value.

Bits 24:0 TRx : Rising trigger event configuration bit of line x

0: Rising trigger disabled (for Event and Interrupt) for input line

1: Rising trigger enabled (for Event and Interrupt) for input line

Note: The external wakeup lines are edge triggered, no glitch must be generated on these lines. If a rising edge occurs on the external interrupt line while writing to the EXTI_RTSR register, the pending bit is set.

Rising and falling edge triggers can be set for the same interrupt line. In this configuration, both generate a trigger condition.

11.9.4 Falling trigger selection register (EXTI_FTSR)

Address offset: 0x0C

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.TR24TR23TR22TR21TR20TR19TR18TR17TR16
rwrwrwrwrwrwrwrwrw
1514131211109876543210
TR15TR14TR13TR12TR11TR10TR9TR8TR7TR6TR5TR4TR3TR2TR1TR0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:25 Reserved, must be kept at reset value.

Bits 24:0 TRx : Falling trigger event configuration bit of line x

0: Falling trigger disabled (for Event and Interrupt) for input line

1: Falling trigger enabled (for Event and Interrupt) for input line.

Note: The external wakeup lines are edge triggered, no glitch must be generated on these lines. If a falling edge occurs on the external interrupt line 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.

11.9.5 Software interrupt event register (EXTI_SWIER)

Address offset: 0x10

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.SWIER 23SWIER 23SWIER 22SWIER 21SWIER 20SWIER 19SWIER 18SWIER 17SWIER 16
rwrwrwrwrwrwrwrwrw
1514131211109876543210
SWIER 15SWIER 14SWIER 13SWIER 12SWIER 11SWIER 10SWIER 9SWIER 8SWIER 7SWIER 6SWIER 5SWIER 4SWIER 3SWIER 2SWIER 1SWIER 0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:25 Reserved, must be kept at reset value.

Bits 24:0 SWIERx : Software Interrupt on line x

If interrupt are enabled on line x in the EXTI_IMR register, writing '1' to SWIERx bit when it is set at '0' sets the corresponding pending bit in the EXTI_PR register, thus resulting in an interrupt request generation.

This bit is cleared by clearing the corresponding bit in EXTI_PR (by writing a 1 to the bit).

11.9.6 Pending register (EXTI_PR)

Address offset: 0x14

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.PR24PR23PR22PR21PR20PR19PR18PR17PR16
rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1
1514131211109876543210
PR15PR14PR13PR12PR11PR10PR9PR8PR7PR6PR5PR4PR3PR2PR1PR0
rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1

Bits 31:25 Reserved, must be kept at reset value.

Bits 24:0 PRx : Pending bit

0: No trigger request occurred

1: selected trigger request occurred

This bit is set when the selected edge event arrives on the external interrupt line.

This bit is cleared by programming it to '1'.

11.9.7 EXTI register map

Table 47 gives the EXTI register map and the reset values.

Table 47. External interrupt/event controller register map and reset values

OffsetRegister313029282726252423222120191817161514131211109876543210
Res.Res.Res.Res.Res.Res.Res.
0x00EXTI_IMRMR[24:0]
Reset value00000000000000000000000000000000
0x04EXTI_EMRMR[24:0]
Reset value00000000000000000000000000000000
0x08EXTI_RTSRTR[24:0]
Reset value00000000000000000000000000000000
0x0CEXTI_FTSRTR[24:0]
Reset value00000000000000000000000000000000
0x10EXTI_SWIERSWIER[24:0]
Reset value00000000000000000000000000000000
0x14EXTI_PRPR[24:0]
Reset value00000000000000000000000000000000

Refer to Section 2.2 on page 76 for the register boundary addresses.