cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 nested interrupts

Fristedt.Jan
Associate II
Posted on March 31, 2013 at 13:18

Once again I feel really stupid. I can't get nested interrupts working.

In the attached file there are three functions, NVIC_Configuration(), SysTick_Handler() and TIM6_DAC_IRQHandler().

I intend the SysTick interrupt to run at highest priority and the TIM6 interrupt to run at medium priority. I can verify that I get both interrupts (the BLIP macros) but the TIM6 interrupt block the SysTick interrupt.

What am I missing?

TIA!

/Janne

#stm32f4xx #nested #interrupt
3 REPLIES 3
Posted on March 31, 2013 at 13:56

You can't use NVIC_Init for internal core sources, ie IRQn less than zero

/* set SysTick interrupt priority to high */ NVIC_InitStructure.NVIC_IRQChannel = SysTick_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure);

You need to use NVIC_SetPriority(SysTick_IRQn, 0); after you've enabled the SysTick itself.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Fristedt.Jan
Associate II
Posted on March 31, 2013 at 14:16

Thank you very much for your very quick reply. It solved my problem.

I wasn't aware of this and also kind of expected the priority of SysTick to be 0 after reset.
Posted on March 31, 2013 at 15:10

The System Handler priority register does clear at reset, however SysTick_Config() [core_cm3.h] sets it down to the lowest setting for the NVIC being used, here 4-bits are implemented.

Prior to the CMSIS version of the fw library (v2.x) so of this was done a bit differently, but you still needed to use a different function to set the SysTick (System Handler) priorities.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..