FAQ
- M051 Base Series(95)
- M0518 Series(97)
- M0519 Series(43)
- M0564 Series(1)
- Mini51 Base Series(90)
- Nano100/102 Base Series(101)
- Nano103 Base Series(10)
- Nano110/112 LCD Series(100)
- Nano120 USB Series(111)
- Nano130 Advanced Series(110)
- NUC029 Series(94)
- NUC100/200 Advanced Series(102)
- NUC120/122/123/220 USB Series(116)
- NUC121/125 Series(1)
- NUC126 USB Series(2)
- NUC130/230 CAN Series(103)
- NUC131/NUC1311 CAN Series(98)
- NUC140/240 Connectivity Series(114)
FAQ
Why did the program enter the interrupt service routine after interrupt flag has been cleared? Issue Date:2018-11-26
This is because the corresponding peripheral interrupt flag in the NVIC_ICPR register has not been cleared.
In the Cortex-M architecture, the order in which interrupt service routine executed is controlled through the NVIC. There are two flags in this issue. One is the internal interrupt flag in the peripheral and the other is the flag in the NVIC that records which peripheral issued the interrupt.
When the peripheral interrupt flag is set to 1, the corresponding value of the NVIC_ICPR register in the NVIC is set to 1. If the user only clears the peripheral interrupt flag, the corresponding value in the NVIC_ICPR register is still set. The program will still enter the interrupt service routine according to the NVIC_ICPR register.
The procedure for entering the interrupt service routine is as follows:
(1) Peripheral interrupts are triggered
(2) The peripheral interrupt flag is raised
(3) In NVIC, the flag corresponding to the NVIC_ICPR register is raised
(4) After NVIC’s scheduling, enter the interrupt service routine.
There are two ways to clear the NVIC_ICPR register.
(1) Automatically cleared by hardware when entering the interrupt service routine.
(2) Manually cleared by software.
Products: | Microcontrollers ,Arm Cortex-M0 MCUs ,Arm Cortex-M4 MCUs |
---|---|
Applications: | |
Function: | Peripherals,ARM,NVIC |