Skip to main content
Associate III
December 24, 2024
Question

How to test GPIO interrupt handlers

  • December 24, 2024
  • 3 replies
  • 702 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?

3 replies

mƎALLEm
ST 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

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Pavel A.
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.

 

TDK
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.

"If you feel a post has answered your question, please click ""Accept as Solution""."