cancel
Showing results for 
Search instead for 
Did you mean: 

Re enabling interrupts

jihlein
Associate II
Posted on April 11, 2012 at 14:55

I need to re enable interrupts in an interrupt service routine so I can do some I2C communication (my I2C driver uses the error and event interrupts).  But I'm not clear as whether I should use CPSIE i or CPSIE f to do this. 

Or is there a more appropriate way to do this?

Thanks in advance.
1 REPLY 1
Posted on April 11, 2012 at 18:01

Or is there a more appropriate way to do this?

Like not doing slow I2C comms and spin loops under interrupt?

Couldn't you just use the I2C interrupts to advance your own state machine?

Enabling interrupts on the processor doesn't not impact the NVIC or change the interrupt priority or preemption. ie It does not magically function in the way you're wanting it too.

You could put this I2C code as the lowest possible priority, and have every other one preempt it. Remember interrupts are not disabled during normal servicing, the NVIC queues them up and dispatches them as you return from service, or if the preemption level with high priority cause that interrupt service to occur.

Realistically you're going to need to EXIT the interrupt, and change where it returns too. This is presumably what an RTOS would do.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..