cancel
Showing results for 
Search instead for 
Did you mean: 

What happens if I use the same priority and sub-priority in multiple NVIC?

Carter Lee
Associate III
Posted on September 13, 2017 at 04:41

Hi.

Now I'm trying to implement USART interrupt mode.

But I'm wondering if I use the same priority and sub-priority in multiple NVIC, what happens?

For example,

If I use as the below,

NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

We can see that 

EXTI0_IRQn and EXTI0_IRQn have the same priority.

if I use the same priority and sub-priority in multiple NVIC, what happens?

As I know, first time to compare between 

NVIC_IRQChannelPreemptionPrioritys , if they are the same then compare between NVIC_IRQChannelSubPrioritys. but I'm not sure what happens if they have the same priority. m

ight be there is such as some race condition?

1 REPLY 1
Posted on September 13, 2017 at 05:17

The service order is then determined by the interrupt number/index, when you leave the handler the NVIC will select the next to be serviced.

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