We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I am using STM32F407ZGT6 Cortex-M4 microcontroller. I am interested in changing the priority of a certain interrupt while servicing the same interrupt. Is that possible?
More elaborately, lets say I have an interrupt which has a priority of 4. The interrupt has arrived and I am currently in the ISR servicing that interrupt. After running a certain code (in the ISR), I want to run the remaining code (in the ISR) to run at higher priority (say 2). And when I was about to leave the ISR, I again change its priority to 4. Is this possible?
Currently, I have achieved this by calling a higher priority interrupt inside the lower priority interrupt.
Thanking in anticipation for your time and help.
(Sorry for the confusion, I've cleaned up this reply)
I think the article Re: Changing interrupt priority to prevent nesting may be what you're looking for.
You've probably already read A Beginner’s Guide on Interrupt Latency - and Interrupt Latency of the ARM® Cortex®-M processors - but if not, it's an excellent article.
But if you still want to change the priority level in the middle of your interrupt, I believe it's possible.
Typically you would only use an approach like this in a multitasking environment or with very simple high-speed applications.
You could use a svc handler and make the svc handler modify the priority, then call the svc handler from within your interrupt...
...or you could set the priority level of the svc handler to a higher priority, then do a svcall and place the critical section inside your svc handler.
I think both jyiu and chrisshore may have some valuable input on this.
Thanks for your detailed reply. It seems to me that you are misinterpreting that higher priority values mean higher priorities. Please note that low priority values represent higher priorities (which means 0 is the highest priority here). Please correct me if I am wrong.
So, I am trying to change the priority level of a running interrupt to a higher priority.
Thanks!!