Skip to content

Software interrupts support for STM32 EXTI #82503

@Salamandar

Description

@Salamandar

Introduction

Problem description

In STM32s, the suggested way to generate/handle software interrupts (SWI) is via EXTI (Extended interrupts and events controller).

Unfortunately, the EXTI lines are supposed to be shared between GPIO and SWI.

The register used to trigger EXTI SWIs can be used to determinate if an interrupt source is GPIO or SWI. See https://stackoverflow.com/questions/44482964/using-exti-line-for-software-interrupt for an example.

The usage is actually to use those SWIs in a Bluetooth controller LLL (lower-link-layer), just as it is done already for Nordic SoCs.

Proposed change

  • Add APIs to handle SWIs in the EXTI (just now renamed gpio_intc_stm32), to
    • register callbacks just like for GPIO interrupts
    • trigger SWIs on a specified line
  • On interrupt, read the SWIER register to determinate if the interrupt source is GPIO or software.

A wip can be found here: https://github.com/Salamandar/zephyr/commits/stm32_exti/

Concerns and Unresolved Questions

  • A SWI might "hide" a GPIO interrupt (but, anyways, two GPIO interrupts might hide each other already…)
  • Portability on the stm32 family (See the commit message of e4a7c0f)
  • would it be relevant to expose a high-level software interrupt API ? (implementable on stm32 with EXTI, on nordic with 6 SWIs)

Alternatives

The path taken by some implementations is to leverage unused IRQ instead… but that is really not portable in any way.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions