cancel
Showing results for 
Search instead for 
Did you mean: 

How to test GPIO interrupt handlers

pass3master
Senior

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 3
SofLit
ST Employee

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 on "Accept as Solution" on the reply which solved your issue or answered your question.
Pavel A.
Evangelist III

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 @SofLit said. How to do this?  The simplest way: connect the EXTI pin to some other pin configured as push/pull.

 

TDK
Guru

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