AnsweredAssumed Answered

NVIC priority group, preemption and sub priority.

Question asked by shrestha.durgesh on Dec 18, 2011
Latest reply on Feb 9, 2016 by Clive One
What is the meaning of Preemppriority and subpriority?
If the number allocated to them is higher, does it mean that they are prioritized for the service than the

others which are allocated less number or it is the opposite?

Do i need to categorize Priority Groups if i have several interrupt service routine?

I have the following priorities in my program:

TIM2 (HIGH Priority)
DMA (HIGH Priority)
EXTI7 (HIGH Priority)
TIM1 (HIGH Priority)

EXTI0 (LOW Priority)
TIM4 (Low Priority)

Among the HIGH PRIORITY TIM2 and DMA should not be made to wait at all.

In my program i wrote:

NVIC_PriorityGroupConfig(NVIC_PriorityGroupConfig[NVIC_PriorityGroup_2];


  NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel1_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
 

  NVIC_InitStructure.NVIC_IRQChannel = TIM1_CC_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;


  NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
 
  NVIC_InitStructure.NVIC_IRQChannel = TIM4_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;

 
  NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
 
  NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
 

Lines irrelevant to the discussion are avoided. Should i edit the NVIC_PriorityGroup??

I request some-one to help me on this.

Thanks in advance.

Outcomes