cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupt questions on STM32F4

SProg
Associate III
Posted on August 28, 2016 at 21:51

I am using STM32F407VG but questions i guess will be the same for all series.

- When 2 interrupts come on same time,the first will be executed comes from priority and sub-priotiry.Right?

-When 1st interrupt comes and i am inside its vector... if 2nd interrupts comes,program can jump to other vector or must leave first from 1st vector?

-Also when 2 interrupts come at same time we execute the one with highest priority.The other interrupt will be executed after we leave the first vector?

-If i disable global interrupts inside the vector and during this time some interrupt come...its lost or will be executed later;

I am a bit confused due to 8bit mC logic.

1 REPLY 1
Posted on August 29, 2016 at 20:45

The basic information is in ARM Cortex-M4 Technical Reference Manual, and parts of it duplicated in PM0214.

> When 2 interrupts come on same time,the first will be executed comes from priority and sub-priotiry.Right?

Yes.

> When 1st interrupt comes and i am inside its vector... if 2nd interrupts comes,program can jump to other vector or must leave first from 1st vector?

''Incoming'' interrupt sets a ''pending'' flag inside the NVIC. If the ''newcoming'' interrupt's group priority is higher than the currently executed one, it will be executed immediately, in the ARM world's parlance, ''preempt'' the first one (i.e. interrupts can nest).

Otherwise, it gets executed once the first finishes.

> Also when 2 interrupts come at same time we execute the one with highest priority.The other interrupt will be executed after we leave the first vector?

Yes.

> If i disable global interrupts inside the vector and during this time some interrupt come...its lost or will be executed later;

It sets the pending flag so it will be executed as soon as the interrupts are reenabled.

> I am a bit confused due to 8bit mC logic.

There is nothing inherently 8- or 32-bit in the interrupt system. Every mcu family has its own interrupt system with its own peculiarities, it's one of the tasks of the engineer to read and understand it before she starts to use the mcu/mpu. There are similar, and maybe even more complex interrupt systems in the 8-bit world; OTOH, many 32-bit mcu/mpu have a much more simplisitic interrupt system (including the non-Cortex-M ARMs).

JW