cancel
Showing results for 
Search instead for 
Did you mean: 

NVIC Priority Groups

jvavra
Associate III
Posted on April 07, 2014 at 14:48

I have read through Yiu's Cortex M3 book on the NVIC, and read this section of the COrtex M3 manual (

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0337e/ch05s03s02.html

), and am still missing the answer to one vital, basic question: does the Priority Group have any bearing on the actual priority assigned to an IRQ, or do the groups just allow you to have available different numbers of preemptive priorities/subpriorities?

So for example, if I want 16 subpriorities, I have to use Group 0, as its the only group with 4 bits available for subpriorities. 

But if I've assigned an IRQ to Group 0, subpriority 0, is this necessarily higher than one assgined to Group 1, pre-emption priority 0, subpriority 0? If not, how are these arbitrated? 

EDIT: Or, do I assign a Preemption Priority to a particular group (which could be any of the four), and the IRQs that are then included in that group would all have the same preemption priority (but possibly different subpriorities)?

 
1 REPLY 1
Posted on April 07, 2014 at 16:45

Priority is controlled by the sub-priority, and the NVIC# when that is ambigous.

If you want specific interrupts to break into others, they must have a lower pre-emption level. Otherwise the ordering is managed as the interrupt exits, and the processor makes a tail-chaining decision.

Ideally your interrupts should be brief and simple, if things will take a long time queue the work so it can be handled in a deferred manner. This can avoid a lot of grief with priorities, and priority inversions when resources are locked.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..