cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Timer Channels Priority

darla14
Senior
Posted on April 07, 2016 at 12:13

Is it possible to assign the priority to Timer channels.I am suing timer1 channels 1,2,3,4 where time period of channel 1,3 and 2 and 4 are multiple of each other so thier respective interrupts comes at the same time but I want one to be non-premepted by other by using priority.

Is it possible?

Thanks in advance !

#timer-channels #priority #!stm32f4 #-
3 REPLIES 3
Posted on April 07, 2016 at 13:54

No, one vector one set of levels.

You might be able to play games with the NVIC directy or manage threads with an rtos.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on April 07, 2016 at 14:01

Hi p.raul,

You should managed that by the NVIC premption priotity. The Intrerruption with the high priority ( premption priority is set to the lowest number)  will be non-prempted.

For example:

here TIM1 interruption will be non-prempted bu TIM8 interruption.

   HAL_NVIC_SetPriority(TIM1_UP_TIM10_IRQn, 0, 0);

   HAL_NVIC_SetPriority(TIM8_UP_TIM13_IRQn, 1, 0);

-Hannibal-

Posted on April 07, 2016 at 17:49

I think you misinterpreted the question.

Single timer, multiple channels, single IRQ vector/handler. I'm pretty sure the NVIC can't preempt a currently running handler at the same level. To do so would allow unconstrained reentry, and the stack could explode.

In an RTOS, one could presumably use the IRQ to signal worker tasks/threads, causing a task switch upon exiting the IRQ handler, and freeing the NVIC to fire again.

There was another thread on materially the same topic/issue earlier, where I basically stated that to do what was wanted with multiple interrupts you'd want to constrain the handler(s) so ALL could execute within the same minimum time defined by the fastest frequency being called. ie if you had 1, 10 and 100ms tasks, combined they would need to execute in less than 1ms for this mechanism to work. If the 100ms task takes 85ms, it is not going to work, and another method needs to be used.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..