ARM Interrupts
ARM Interrupts
Interrupts are signals that prompt the processor to pause its current operations and execute a specific piece
of code (the interrupt handler) to address the event that triggered the interrupt. Interrupts can come from
various sources, including hardware devices (like timers, sensors, etc.) and software.
Types of Interrupts
1. External Interrupts: Triggered by external hardware sources.
2. Internal Interrupts: Generated by internal sources, such as timers.
3. Software Interrupts: Generated by software instructions (like the SVC instruction for system calls).
4. System Exceptions: Special interrupts that occur due to processor-specific events (e.g., faults).
ARM Exceptions
Exceptions are a broader category that encompasses both interrupts and faults. They represent unexpected
conditions or events that alter the normal execution flow of a program.
Types of Exceptions
1. Reset:
Triggered when the processor is reset (e.g., upon power-up).
Always the highest priority, it clears the current state and initializes the system.
3. Hard Fault:
Occurs when the processor detects a serious error (e.g., accessing invalid memory).
It can lead to the termination of the current task and may require a reset.
5. Bus Fault:
Occurs when there’s an error accessing memory or peripherals, such as when a device is
unresponsive.
6. Usage Fault:
Triggered when invalid instructions are executed (e.g., undefined instructions or attempts to
execute a non-executable memory region).
8. Debug Monitor:
Allows the debugger to intervene during execution, typically used for debugging processes.
The NVIC is an integral part of ARM Cortex-M microcontrollers, managing the interrupts and exceptions
efficiently. It allows for prioritized, nested interrupt handling, enabling a higher-priority interrupt to preempt
a lower-priority one.
Features of NVIC
2. Low Latency:
Fast context switching and low latency for interrupt handling ensure quick response to critical
events.
Each interrupt can be assigned a priority level that can be changed at runtime, providing
flexibility in how the system responds to different events.
4. Preemptive Handling:
Allows for interrupts to interrupt other interrupts based on priority levels, ensuring that the most
critical tasks are serviced first.
5. Vector Table:
Provides a method for efficiently locating the appropriate interrupt service routine (ISR) for each
interrupt source.
NVIC Registers
The NVIC contains several registers that control and manage interrupts. Here are the key NVIC registers
related to interrupt control: