AnsweredAssumed Answered

Interrupt priority problem

Question asked by vugs.michel on Jan 8, 2014
Latest reply on Jan 10, 2014 by vugs.michel
Hi

I'm working on a project where I use a interrupt from the RTC. This is the one second interrupt. I also use a couple of other interrupts, for example timer 3. 

The RTC interrup can have the lowest interrupt possible because i'ts not more than a led that switches on and off. So I set it like this:

     NVIC_InitTypeDef NVIC_InitStructure;
     NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

     NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQn;
     NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
     NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
     NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
     NVIC_Init(&NVIC_InitStructure);

     RTC_ClearITPendingBit(RTC_IT_SEC);
     RTC_ITConfig(RTC_IT_SEC, ENABLE); // Enables second interrupt

Timer 3 has to one of the highest priority interrupt so i set it like this:

     NVIC_InitTypeDef NVIC_InitStructure;

     NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
     NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn;
     NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
     NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
     NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
     NVIC_Init(&NVIC_InitStructure);

But when i use timer 3 to blink a led, I can see that this blinking is interrupted by the one second interrupt from the RTC. If I disable the second interrupt the timer 3 led is blinking as it should do.

Am I doing something wrong, or am I missing something?

my sincerly

Michel

Outcomes