Home arrow Support arrow Forums

Luminary Micro Forums

<< Start < Prev 1 2 Next > End >>

hauensts

Senior Boarder

2008/10/28 09:41

Force an interrupt by software

Hi,

how do I force an interrupt of the GPIO B by software?
I need this for debugging/testing purposes.
I found the following line in an example:

Code:

 HWREG(NVIC_SW_TRIG) = INT_GPIOB 16;[



Causes this to call the interrupt handler for port B and how do I set the flag for e.g. pin 1?

Best regards
Stefan

Post edited by: hauensts, at: 2008/10/28 09:42

login or register to reply

slandrum

Gold Boarder

2008/10/28 10:59

Re:Force an interrupt by software

As near as I can tell, you can't use software to trigger the GPIO interrupt the same way as if the condition had occurred on the pin(s). You can make the code in the interrupt vector execute, but you can't force values into the GPIORIS register for the event(s) you want.

Can you set up a testbed where you can connect signals directly to the pins that you can control through software for your testing?

login or register to reply

cb1

Platinum Boarder

2008/10/28 12:47

Re:Force an interrupt by software

Hi - question:

As software is desired to "cause" the interrupt - why not have that same software simply call your desired function?

Forgive me - I don't see the merit of an interrupt in this case...

login or register to reply

slandrum

Gold Boarder

2008/10/28 15:09

Re:Force an interrupt by software

It's very critical for test and debug to get code to execute all paths and make sure that the expected things happen. Any code path that hasn't been tested should be assumed to not work.

Calling a routine that is called when a specific interrupt condition occurs is not the same as testing and verifying that your interrupt handler will work, call the necessary routine(s), clean up after itself, et cetera if that condition should occur. The only way to be absolutely sure is to have the code actually have to handle the interrupt, not just pretend that the interrupt happened.

login or register to reply

hauensts

Senior Boarder

2008/10/29 02:53

Re:Force an interrupt by software

First, in my app the interrupt counts the ticks between two interruptions. The GPIO B has 4 interrupt inputs.

The idea for the software interrupt is, because I don't have an external clock source that clocks the input pin. So I want to simulate this by periodically force the interrupt by software and I additionally can adjust the period of this interrupt. I also can try different timings.


Stefan

login or register to reply

hauensts

Senior Boarder

2008/10/30 01:46

Re:Force an interrupt by software

Ok guys,

I did some tests with

Code:

 HWREG(NVIC_SW_TRIG) = INT_GPIOB 16



and it works. I'm calling this line in the systick interrupt to get a period interrupt at port B. This is what I needed.

Stefan

login or register to reply
<< Start < Prev 1 2 Next > End >>