 Hello and welcome to this presentation of the STM32G4 Extended Interrupts and Events Controller. We will be presenting the features of the EXTI controller. The Extended Interrupt and Event Controller, or EXTI, provides up to 42 independent events, split into two categories, configurable events and direct events. Applications benefit through smarter use of low power modes, taking advantage of the STM32G4's capability to wake up via external communication or requests. This is the block diagram of the Extended Interrupt and Event Controller. Configurable peripheral events are generated by peripherals without interrupt capability, but which are able to issue a pulse. The EXTI controller provides interrupt detection, masking and software trigger. Direct peripheral events are generated by peripherals supporting interrupt requests. In this case, the EXTI controller is used to generate events to the CPU and to request system wakeups. Do not confuse peripheral events and processor event. Peripheral events are used by peripherals to indicate that they require processor attention. The processor event is a pulse signal used by ARM CPUs to exit the wait for event low power state. The Extended Interrupt and Event Controller can generate interrupt and event as well as wake up the processor from stop modes. Configurable events are linked with external interrupts from GPIOs, PVD, RTC, timestamp or CSS LSE comparators and PWM modules. Direct events are linked with USB, I2C, UART, USART, LPUART1, LPTIM1 and UCPD1. The Cortex-M4 supports two ways to enter a low power state, executing the wait for event, WFE instruction or executing the wait for interrupt WFI instruction. With WFE, the first instruction executed after a wakeup event is the next sequential one, Instruction N plus 1 in the sequence on the left. By implementing WFI, the processor jumps to the interrupt service routine when an enabled interrupt request is received. Note that an interrupt request is a WFE exit condition, but an event received on RxEV is not a WFI exit condition. Receiving an enabled interrupt request while the processor is in WFE state causes a wakeup of the processor and the execution of the interrupt service routine. When the Cortex-M4 controlled bit, called SEV onPend, which means send event on pending, is set to 1, receiving an interrupt request related to a must interrupt, causes a wakeup event. In this case, the processor executes the next sequential instruction. Software may later decide to enable the next interrupt to be served. This figure explains the various stages enabling the conversion of a configurable peripheral event active edge into an interrupt request. The first stage is the asynchronous edge detection circuit configured by two registers, EXTI-RTSR and EXTI-FTSR. Any edge, possibly both, can be chosen. The software can emulate a configurable event by setting the corresponding bit in the EXTI-SWIER register. The bit is autocleared by hardware. An end gate is used to mask or enable the generation of the interrupt to the NVIC. Finally, a flag is set in the EXTI-PR register when the interrupt is generated to the NVIC. This flag enables the software to determine the course of the interrupt. This flag is expected to be cleared by the interrupt service routine. This figure explains the various stages enabling the conversion of a peripheral event active edge into a processor event. Both configurable and direct peripheral events can be configured to issue events to the CPU, steered to its RXCV input. Configurable event active edge is programmable in the EXTI-RTSR and EXTI-FTSR registers while direct events are always sensitive to a rising edge. Software can emulate a configurable event by writing to the EXTI-SWIER register. Unlike interrupt requests, the CPU has a unique event input so all event requests are all read together before entering the event post-generator. The registers used to mask the generation of events are different from the ones used to mask the generation of interrupts. EXTI-EMR instead of EXTI-IMR. Note that unlike interrupt requests, the pending bit corresponding to the peripheral event line is not set. The CPU wake-up signals generated by the EXTI block are connected to the PWR block and are used to wake up the system and CPU subsystem bus clocks. Both configurable and direct peripheral events are able to request a wake-up. A wake-up occurs when an asynchronous edge detection circuit has detected an active edge or a flag is set to 1 in the EXTI-RPR register. Consequently, software is expected to clear the flag in the EXTI-RPR register to disable the wake-up request when the source of the wake-up is a configurable event. For direct events, the flag is located in the peripheral unit. These flags enable the software to find the cause of the wake-up. The wake-up indication is asserted when either the interrupt or the event generation is enabled, see the ORGATE Combining EXTI-IMR and EXTI-EMR registers. A direct event is able through the EXTI controller to generate a CPU event and trigger system wake-up. The active edge of direct events is the rising edge. Direct events do not rely on the EXTI controller to assert interrupt requests because they have their dedicated lines to the NVIC. Otherwise, the same circuit as the one described in the previous slides is implemented. Direct events can be independently masked for event generation and interrupt generation. The interrupt mask is only used as a wake-up mask. This table provides all inputs of the EXTI block present in the STM32G4 microcontroller and indicates for each of them whether it's a configurable event input or a direct event input. For more details about the system configuration module, refer to the reference manual for STM32G4 microcontrollers. Refer also to these trainings for more information if needed. ARM Cortex M4 Core Power Control or PWR System Configuration or Sys CFG Interconnect Matrix or IMX