2021-10-21 02:45 PM
Hello,
My question is that how many interrupts could be in pending state in STM32F1 MCUs?
What would happen when a interrupt is running and in the same time another interrupt with same preempt priority be fired, does the running interrupt finishes and the second one be run or the first one should be finish and the next starts?
And my next question is that Assume that an interrupt is running and in this moment 2 or more interrupts with lower preempt priorities be fired. In this case two situations will occur:
1. Fired interrupts have the same preempt priority: Does the sub priority is determine the priority of interrupts?
2. Fired interrupts have different preempt priority: In this case does preempt priority determine the priority of interrupt execution?
Best regards
Solved! Go to Solution.
2021-10-21 03:35 PM
> My question is that how many interrupts could be in pending state in STM32F1 MCUs?
Technically, all of them. Or at least all user interrupts, so something like 50.
> What would happen when a interrupt is running and in the same time another interrupt with same preempt priority be fired, does the running interrupt finishes and the second one be run or the first one should be finish and the next starts?
An interrupt can only pre-empt if it has a high priority than the currently executing interrupt. So it would finish, then the other would fire.
> 1. Fired interrupts have the same preempt priority: Does the sub priority is determine the priority of interrupts?
Yes, if it's defined. Otherwise, the numerically lower interrupt number fires first.
> 2. Fired interrupts have different preempt priority: In this case does preempt priority determine the priority of interrupt execution?
Yes.
2021-10-21 03:35 PM
> My question is that how many interrupts could be in pending state in STM32F1 MCUs?
Technically, all of them. Or at least all user interrupts, so something like 50.
> What would happen when a interrupt is running and in the same time another interrupt with same preempt priority be fired, does the running interrupt finishes and the second one be run or the first one should be finish and the next starts?
An interrupt can only pre-empt if it has a high priority than the currently executing interrupt. So it would finish, then the other would fire.
> 1. Fired interrupts have the same preempt priority: Does the sub priority is determine the priority of interrupts?
Yes, if it's defined. Otherwise, the numerically lower interrupt number fires first.
> 2. Fired interrupts have different preempt priority: In this case does preempt priority determine the priority of interrupt execution?
Yes.
2021-10-22 02:53 AM
Thank a million for your answer.
I got it.
Wishes the best
2021-10-22 11:51 PM
Hello,
Your previous answers solved my questions. Thank you for your favor. I have another question. How many interrupts with a higher preempt priority can occur successive? How many steps?
2021-10-23 01:48 AM
2021-10-23 02:21 AM
The priority levels depend on hardware implementation and the number of implemented bits are defined in CMSIS headers as __NVIC_PRIO_BITS.
Read this article:
And search for "Binary point" chapter in PM0056.
2021-10-24 11:05 PM
Thanks for your response
Assume that an interrupt is running and in this moment another interrupt with higher preempt priority be fired and the new interrupt begin to running. Again another interrupt with higher preempt priority be fired and like this many interrupts with higher interrupts will fire, in this case the previous interrupts will be left and the new one will be running.
my question is that, how many levels does it have this issue that running higher priority and start new interrupt? Does is have limitation?
for example if 3 times interrupts with higher preempt priority be fired and third interrupts is running, does the fourth interrupt with higher preempt priority would be fire or it will be lost?
I am going to know how many limitation is exist for firing and running interrupts for higher preempt priority.
2021-10-24 11:05 PM
Thanks for your response
Assume that an interrupt is running and in this moment another interrupt with higher preempt priority be fired and the new interrupt begin to running. Again another interrupt with higher preempt priority be fired and like this many interrupts with higher interrupts will fire, in this case the previous interrupts will be left and the new one will be running.
my question is that, how many levels does it have this issue that running higher priority and start new interrupt? Does is have limitation?
for example if 3 times interrupts with higher preempt priority be fired and third interrupts is running, does the fourth interrupt with higher preempt priority would be fire or it will be lost?
I am going to know how many limitation is exist for firing and running interrupts for higher preempt priority.
2021-10-25 06:28 AM
The only limitation is due to the number of preemption priorities. The STM32F1 has 4 bits available for preemption levels. This allows for 16 different preemption levels (0-15). That is the max calls you can have occurring at a time.
14 preempts 15
13 preempts 14
etc...
0 preempts 1
2021-10-25 01:59 PM
Your answers cleared up my ambiguities. Many Thanks for your answers.