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.
> BASEPRI / PRIMASK registers prevent other low priority exceptions. I don't think, they will be useful in my case.
Wouldn't changing the priority also prevent other low priority exceptions as well ?
As far as I understood it, this is how the priority mechanism actually works (but I may be wrong).
Have you tried ...
IRQHandler_4
{
Code A
dump contents of BASEPRI
execute SVC, which has priority 2
}
SVC
... (try making a short test-program, which does nothing except from the above and trigger IRQHandler_4 once only.
-So using __set_BASEPRI(priority) for setting / restoring it inside the interrupt would have the same effect; you should not have to call/trigger a higher priority interrupt manually.
Thanks for the reply!
I am still unable to understand why I need to use BASEPRI. Because SVC has a priority higher than IRQHanlder_4, so the SVC interrupt will easily pre-empt the IRQHandler_4 and I don't need to change BASEPRI. Please correct me if I am wrong.
Any ways, the idea of using SVC is as similar as I am already achieving by calling a higher priority (software) interrupt inside IRQHandler_4. Please correct me if I am wrong.
Many thanks for your time and help!