Go Down

Topic: DUE: change interrupt priority on timere  (Read 555 times) previous topic - next topic

KG_DK

I use two timers,
  Timer1.attachInterrupt(T1IRQ).start(370);
  Timer2.attachInterrupt(T2IRQ).start(370);

Somewhere on the web I have seen, that I set the priority in this way:
NVIC_SetPriority(GPIOTE_IRQn, 3); //optional: set priority of interrupt

But I do not know how to use this for my two timers.
Can someone help?

I know, that the higest lewel is 0,  and want Timer2 to bee 2 and Timer1 to bee 3!

Kind regards
Kurt


ard_newbie

Interrupt priorities of Cortex M3 uc is a complex subject, although you can begin with this:

https://www.keil.com/pack/doc/cmsis/Core/html/group__NVIC__gr.html

and something like this should do what you are looking for:

Code: [Select]

// Set Timer Counter 0 chanel 1 priority
NVIC_SetPriority (TC1_IRQn, 3);

// Set Timer Counter 0 chanel 2 priority
NVIC_SetPriority (TC2_IRQn, 2);



KG_DK

Thank you.
I has written it in my code, and the compiler do'nt fail, so I think, it wordk.
I will test it later.
Kurt

Go Up