Not returning from ISR? Yes you can!
Rayman
Posts: 14,646
I have this cog waiting for a trigger on a pin, but need to get it out of that loop if the trigger pin changes...
I could just stop the cog and then restart it, but that seems wasteful...
Can I have an ISR that isn't actually meant to be returned from?
Can I just pop the stack and then jump to the start of the cog code or wherever?
Update: Ok, figured it out... Don't need to pop anything but you do need to either NIXINTx or RETIx to clear interrupt flag.
I could just stop the cog and then restart it, but that seems wasteful...
Can I have an ISR that isn't actually meant to be returned from?
Can I just pop the stack and then jump to the start of the cog code or wherever?
Update: Ok, figured it out... Don't need to pop anything but you do need to either NIXINTx or RETIx to clear interrupt flag.
Comments
I guess PC gets sent to IRETx and then it jumps to IJMPx.
Maybe I don't need to pop anything...
Cog will essentially restart on interrupt...
RETx must clear some flag that allows the interrupt to work again.
But, I did just figure out that NIXINTx clears this flag, so back in business...
oh wait... Maybe I need a POLLATN?
I think I remember from something else that I needed a POLLATN for some reason...
But, seems like nix has the same affect...
Presumably NIXINTx clears that flag too.
Seems there are two ways to do this... IRETx or NIXINTx.