UM10413
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2011. All rights reserved.
User manual
Rev. 1 — 16 December 2011
30 of 268
NXP Semiconductors
UM10413
MPT612 User manual
•
Application code must be set up in a way to prevent the spurious interrupts from
occurring. Simple guarding of changes to the VIC cannot be enough since, for
example, glitches on level-sensitive interrupts can also cause spurious interrupts.
•
Correctly set up and test the VIC default handler.
9.6.1 Details and case studies on spurious interrupts
This chapter contains details that can be obtained from the official ARM website, FAQ
section.
What happens if an interrupt occurs as it is being disabled?
Applies to: ARM7TDMI
If an interrupt received by the core during execution of an instruction disables interrupts,
the ARM7 family still takes the interrupt (IRQ or FIQ).
For example, consider the following instruction sequence:
MRS r0, cpsr
ORR r0, r0, #I_Bit:OR:F_Bit ;disable IRQ and FIQ interrupts
MSR cpsr_c, r0
If an IRQ interrupt is received during execution of the MSR instruction, then the behavior
is as follows:
1. The IRQ interrupt is latched.
2. The MSR cpsr, r0 executes to completion setting both bit I and bit F in the CPSR.
3. The IRQ interrupt is taken because the core was committed to taking the interrupt
exception before bit I was set in the CPSR.
4. The CPSR (with bit I and bit F set) is moved to the SPSR_IRQ.
This means that, on entry to the IRQ interrupt service routine, you can see the unusual
effect that an IRQ interrupt has been taken while bit I in SPSR is set. In the example
above, bit F is also set in both CPSR and SPSR. This means that FIQs are disabled upon
entry to the IRQ service routine until explicitly re-enabled. The IRQ return sequence does
not automatically re-enable FIQs.
Although the example shows both IRQ and FIQ interrupts being disabled, similar behavior
occurs when only one of the two interrupt types is being disabled. The core processes the
IRQ after completing the MSR instruction which disables IRQs, and does not normally
cause a problem, as an interrupt arriving one cycle earlier is expected to be taken. When
the interrupt routine returns with an instruction like:
SUBS pc, lr, #4
the SPSR_IRQ is restored to the CPSR. The CPSR now has bit I and bit F set, and
therefore execution continues with all interrupts disabled. However, problems can be
caused in the following cases:
Problem 1:
A particular routine maybe called as an IRQ handler, or as a regular
subroutine. In the latter case, the system guarantees that IRQs have been disabled before
the routine being called. The routine exploits this restriction to determine how it was called
(by examining bit I of SPSR), and returns using the appropriate instruction. If the routine is