2017-09-12 07:41 PM
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?
2017-09-12 08:17 PM
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.