Skip to main content
Explorer
December 24, 2024
Question

How to test GPIO interrupt handlers

  • December 24, 2024
  • 3 replies
  • 701 views

We are developing software that uses GPIO interrupts.
We would like to test if the GPIO interrupt handler is working properly, but is it possible to set the pin assigned to the GPIO interrupt High/Low in software?
Is this only possible by inputting a signal to the target GPIO from outside?

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    December 24, 2024

    Hello @pass3master ,

    In next time please provide the MCU part number.


    @pass3master wrote:

     but is it possible to set the pin assigned to the GPIO interrupt High/Low in software?


    Yes it's possible to set the rising and falling edges.


    @pass3master wrote:

    Is this only possible by inputting a signal to the target GPIO from outside?


    Not clear what do you mean by this. As you will use GPIO it's for sure from outside.

    Also you refer to one of the examples provided in CubeHAL: https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/NUCLEO-H743ZI/Examples/GPIO/GPIO_EXTI

    Super User
    December 24, 2024

    On most STM32s you can trigger any NVIC interrupt by software. But you likely want to test the whole path from the pin -> EXTI -> NVIC -> handler. As @mƎALLEm said. How to do this?  The simplest way: connect the EXTI pin to some other pin configured as push/pull.

     

    Super User
    December 24, 2024

    > is it possible to set the pin assigned to the GPIO interrupt High/Low in software?

    Probably the easiest way is to configure the pin as an output and toggle it. That will trigger the interrupt.