cancel
Showing results for 
Search instead for 
Did you mean: 

catching interrupt IRQ during processing different interrupt IRQ

developer2
Senior
Posted on August 26, 2014 at 14:31

Hi All, 

please could you help me ... i'm using STM32F407 and i don't know what to do ...

i catch Timer IRQ using NVIC, 

inside procedure of timer IRQ i need to do something that takes time ... but it should be executing without any delay ( spool and run from main while ), 

and i need to process SPI IRQ using NVIC  - it's sufficient to spool received byte into buffer, 

but i don't see that SPI IRQ is raised during processing timer IRQ, 

if i test SPI IRQ without any other IRQs ... work correctly ... 

please help me to find out solution ...

Thanks for all replies , 

Kind regards
4 REPLIES 4
Posted on August 26, 2014 at 15:44

Use preemption levels.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
developer2
Senior
Posted on August 26, 2014 at 16:42

Hi Clive1,

Thank You for the reply ... so i was looking for some infos and i forgot in first message that i'm using usb at FullSpeed in CDC and there is BSP with predefined IRQ priorities ... 

do you have some advice to setup optimal configuration of priorities ? 

i'm not sure if BSP can be or should not be interrupted :( 

and BSP is preconfigured to use 1bit preemption and 3 bits subpriorities, 

so ... is this configuration of levels good ? : 

SPI @ Preemption Level 0 , Subpriority 1 

Timer @ Preemption Level 1 , Subpriority 1 (subpriority is probably irrelevant if preemption level is different ... )

and what about BSP ? can be :

BSP @ Preemption Level 1, Subpriority 2 ?

Posted on August 26, 2014 at 17:49

I'd probably opt for the 2-bit/2-bit mode, and park the TIM at Preempt 3. You should also evaluate why you need to dwell in the interrupt excessively.

If you have interrupt routines which are quick and decisive, have them at the highest level (lowest #), especially where switching context is at least as expensive as just finishing, and tail-chaining.

Suggest a review of the TRM NVIC docs, and Joseph Yiu's books on the Core/NVIC
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
developer2
Senior
Posted on August 26, 2014 at 18:07

it works perfectly ... 

i decided to use IRQ because of precise timing ... i was afraid of ART and compiler :) 

when i was asking for help i was thinking about stoped NVIC :(

so Clive1 ... Thank You very much ... 

Kind regards