cancel
Showing results for 
Search instead for 
Did you mean: 

Don't understand interrupt nesting & priority

jordi_pn
Associate II
Posted on April 02, 2009 at 06:09

Don't understand interrupt nesting & priority

2 REPLIES 2
jordi_pn
Associate II
Posted on May 17, 2011 at 13:08

I don't understand how interrupt preempt works. STM32 documentation doesn't explains too much and refers to CortexM3 one, which I found difficult to understand.

I've also looked at Hitex manual for STM32 and at the STM library examples.

I've made a little program, programming uart, i2c and systicks interrupts at preemption priority 0, 1 and 2. I set group priority to 2 ( 4 levels).

I've defined a global variable, each interrupt increases its value at the enter and decreases it on exit. I put a breakpoint if this global variable is greater than one ( nested interrupt ), but it never stops.

I've read this in ARM CM3 documentation:

A late-arriving interrupt can preempt a previous interrupt if the first instruction of the

 

previous ISR has not entered the Execute stage, and the late-arriving interrupt has a

 

higher priority than the previous interrupt.

Then it's no possible to interrupt one ISR on its execution? Can I program thnking that the code in one interrupt is atomic?

Thanks

ccowdery9
Associate III
Posted on May 17, 2011 at 13:08

A late-arriving interrupt can preempt a previous interrupt if the first instruction of the previous ISR has not entered the Execute stage, and the late-arriving interrupt has a higher priority than the previous interrupt.

I read that to mean that the late-arriving interrupt will take advantage of the fact that the previous (low priority) interrupt has already stacked the context and changed processor mode. I presume that if the high-priority interrupt arrives any later, it will just interrupt the existing interrupt in the conventional manner.

You can certainly have a high priority interrupt execute within a lower priority interrupt - I have this going on at multiple levels on my board.

Chris.

[ This message was edited by: c.cowdery on 02-04-2009 09:40 ]