cancel
Showing results for 
Search instead for 
Did you mean: 

Specifying the Interrupt priority.

STork.1
Associate III

Hi every body. I want to manage two events with general purpose timers 16 and 3.

As a convention in ARM processors, as much as I know, the lower interrupt number corresponds to the higher priority. So I think I need to manage event with higher priority with Timer_interrupt_3 and manage the one with lower priority with Timer_interrupt_16 ... do I think correctly? Is it enough to put the codes of higher priority task (set the corresponding flag in the interrupt service routine) in ISR of Timer3 and put the codes of lower priority event in ISR of Timer 16? or maybe I need to set their priority with a command like HAL_NVIC_SetPriority ... .

On the other hand, when I check the Pin & Configuration >>System Core>>NVIC I see a table in which Timer3 and Timer16 have the same preemption priority and Sub_Priority which is zero.

so, what am I supposed to do ?

1 REPLY 1
DOCon.1
Senior

Hi. The NVIC section of your reference manual has a table showing the default priorities of each interrupt line. You change priorities using the Cortex-M NVIC peripheral. (ie not something STM32-specific). Se the timer's interrupt line you wish to be higher to a lower interrupt priority value. It's not an STM32 register, so the command will be with whatever you access Cortex-M peripherals with.

For details, see PM0214, here: STM32 Cortex®-M4 MCUs and MPUs programming manual - Programming manual