2012-04-11 05:55 AM
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.2012-04-11 09:01 AM
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.