cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupts priority

martindida
Associate II
Posted on November 13, 2012 at 13:11

Hi all

Can higher priority interrupt interrupts lower priority in his execution? For example. When I am servicing DMA ISR routine with priority 0x01 and EXTI interruption with priority 0x00 if and only if happens. Does it preempt lower priority level ISR immediately or after finishing of that routine.

While what I know just SysTick timer does it when it has higher priority then peripheral priority.

But between two priorities like DMA and EXTI it was not successful when one of them was higher why?

Next one question. I debug my applications with ST-link debugger on STM32F0 discovery board. In my one application I use ordinary delay functions from Discovery tutorial, and decrement TimingDelay variable through SysTick handler. That delay function is used in DMA ISR routine (SysTick interrupt has higher priority than DMA priority). But the problem is that.

When I use higher optimization than Level 0 in uVision studio in ''Option for Target'' - ''C/C++'' bookmark, so it creates endless loop in this part of code ''while(TimingDelay != 0);'' even though the variable TimingDelay is already zero value. When I use optimization Level 0 everything works fine. I don't understand why?

Thanks for your help.

2 REPLIES 2
Posted on November 13, 2012 at 16:32

Using interrupt driven delays, and long while loops in interrupt code is to be generally avoided.

Check the volatile status of variables removed via optimization.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
martindida
Associate II
Posted on November 13, 2012 at 20:47

Thanks for your help. I suppose that you know interrupt using delays from STM32f0 periph. library. So you know, that the part of function ''while (TimingDelay != 0)'' is not directly in interruption, but it is called from general source file. And just one thing what is done in SysTick interruption is decrementing TimingDelay by one. As I already wrote in my prevoius post that mistake was optimization. I wanted to know why. I think that your second hint should help me, but I don't know how to check volatile status of variables removed via optimization. Try to be more specific please.

Thanks for your help