Trigger ISR via Software

Status
Not open for further replies.

gfvalvo

Well-known member
Hi all.

I have a need to trigger via software the ISR I've attached to fire on the Rising edge of a T3.6 GPIO pin. Essentially, trick it into thinking that the edge occurred on the external signal.

I know I can use NVIC_SET_PENDING() or write to the NVIC_STIR register. But, I think that will only fire the interrupt for the PORT. That ISR will scan through the Port's ISFR register and see that the edge did not in fact occur. So, my attached ISR won't be called.

So, is there any way to force the Interrupt Status Flag for the pin before I fire the PORT interrupt?

Thanks.
 
Won't work for my application. I have found a work-around. But, it would be interesting for my own edification to find out if it's possible.
 
@WMXZ,

Yes, that's the sequence I mentioned in my original post. NVIC_TRIGGER_IRQ, NVIC_SET_PENDING, and setting the NVIC_STIR register all do essentially the same thing.

But, as I mentioned, if my ISR that I want to trigger is for an edge change on a PORT input pin, then all NVIC_TRIGGER_IRQ will do is trigger the "port_A_isr()", "port_B_isr()", etc function defined in pins_teensy.c.

As I mentioned, this function will scan through the PORTA_ISFR, PORTB_ISFR, etc register looking for set bits that correspond to the ISF field of the 32 pins associated with that PORT (i.e. bit 24 of PORTx_PCRn). Seeing that the ISF bit isn't actually set, the ISR that I set up using attachInterrupt() won't get called.

It doesn't look there's a way to directly set the ISF bit in the PORTx_PCRn register via software. So, I'll probably go with the alternate approach that I identified.
 
Last edited:
Status
Not open for further replies.
Back
Top