11. Extended interrupts and events controller (EXTI)

The external interrupt/event controller consists of up to 24 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 '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 'OR gate' output is connected to a 'Pulse generator', which outputs to the left. The 'Event mask register' is also connected to the 'Pulse generator' output. The diagram is labeled 'MSV34192V1' in the bottom right corner.

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

11.3 Wakeup event management

The STM32F75xxx and STM32F74xxx 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 24 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.

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 EXTI0, EXTI1, and EXTI15 via multiplexers controlled by SYSCFG registers.

The diagram illustrates the mapping of GPIOs to external interrupt lines using multiplexers. Each multiplexer is controlled by configuration bits in the SYSCFG_EXTICR registers.

MS30440V1

Diagram showing the mapping of GPIOs to external interrupt lines EXTI0, EXTI1, and EXTI15 via multiplexers controlled by SYSCFG registers.

The eight other EXTI lines are connected as follows:

11.9 EXTI registers

Refer to Section 1.2 on page 63 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.Res.IM23IM22IM21IM20IM19IM18IM17IM16
rwrwrwrwrwrwrwrw
1514131211109876543210
IM15IM14IM13IM12IM11IM10IM9IM8IM7IM6IM5IM4IM3IM2IM1IM0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 23:0 IMx : 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.Res.EM23EM22EM21EM20EM19EM18EM17EM16
rwrwrwrwrwrwrwrw
1514131211109876543210
EM15EM14EM13EM12EM11EM10EM9EM8EM7EM6EM5EM4EM3EM2EM1EM0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 23:0 EMx : 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.Res.TR23TR22TR21TR20TR19TR18TR17TR16
rwrwrwrwrwrwrwrw
1514131211109876543210
TR15TR14TR13TR12TR11TR10TR9TR8TR7TR6TR5TR4TR3TR2TR1TR0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 23: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.Res.TR23TR22TR21TR20TR19TR18TR17TR16
rwrwrwrwrwrwrwrw
1514131211109876543210
TR15TR14TR13TR12TR11TR10TR9TR8TR7TR6TR5TR4TR3TR2TR1TR0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 23: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.Res.SWIER 23SWIER 22SWIER 21SWIER 20SWIER 19SWIER 18SWIER 17SWIER 16
rwrwrwrwrwrwrwrw
1514131211109876543210
SWIER 15SWIER 14SWIER 13SWIER 12SWIER 11SWIER 10SWIER 9SWIER 8SWIER 7SWIER 6SWIER 5SWIER 4SWIER 3SWIER 2SWIER 1SWIER 0
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 23: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.Res.PR23PR22PR21PR20PR19PR18PR17PR16
rc_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:24 Reserved, must be kept at reset value.

Bits 23: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 45 gives the EXTI register map and the reset values.

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

OffsetRegister313029282726252423222120191817161514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.
0x00EXTI_IMRIM[23:0]
Reset value00000000000000000000000000000000
0x04EXTI_EMREM[23:0]
Reset value00000000000000000000000000000000
0x08EXTI_RTSRTR[23:0]
Reset value00000000000000000000000000000000
0x0CEXTI_FTSRTR[23:0]
Reset value00000000000000000000000000000000
0x10EXTI_SWIERSWIER[23:0]
Reset value00000000000000000000000000000000
0x14EXTI_PRPR[23:0]
Reset value00000000000000000000000000000000

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