Embedded systems constantly react to events.
A microcontroller may need to respond when:
- a timer expires,
- an ADC conversion finishes,
- a CAN frame arrives,
- a UART receives a byte,
- a motor fault occurs,
- an encoder changes state,
- a safety input is triggered.
If the processor had to continuously check every peripheral, much of its time would be wasted.
Interrupts solve this problem.
An interrupt lets hardware signal the processor only when attention is required.
The interrupt controller decides:
- which interrupt is active,
- which has higher priority,
- whether one interrupt can preempt another,
- which interrupt handler should run,
- which requests remain pending.
This makes the interrupt controller one of the most important parts of a responsive embedded system.
Fundamentals and Technology Overview
What Is an Interrupt Controller?
An interrupt controller is hardware that receives interrupt requests from system peripherals and presents them to the CPU in a controlled way.
Typical interrupt sources include:
- timers,
- ADCs,
- UART,
- SPI,
- CAN,
- GPIO,
- DMA,
- fault monitors.
The controller can manage:
- enable / disable state,
- priority,
- pending state,
- active state,
- interrupt vector.
Without an interrupt controller, the CPU would need much more software logic to determine which event needs service.
Polling vs Interrupts
Consider a UART receiver.
With polling, the processor repeatedly asks:
Has new data arrived?
This wastes processing time when no data is available.
With interrupts:
- CPU performs other work.
- UART receives a byte.
- UART raises an interrupt.
- CPU runs the receive handler.
- CPU returns to previous work.
This improves processor utilization.
Why Interrupt Controllers Improve Responsiveness
An interrupt controller can reduce response time in several ways:
- direct vectoring,
- hardware priority arbitration,
- nested preemption,
- automatic pending management,
- efficient context switching.
These mechanisms reduce software overhead between:
event occurrence
and
handler execution.
Interrupt Latency
Interrupt latency is the time between:
- an interrupt request becoming active
and:
- the first instruction of the interrupt service routine.
Low interrupt latency is important in:
- motor control,
- digital power,
- robotics,
- industrial networking.
CPU Speed Is Only Part of Interrupt Latency
Latency depends on more than clock frequency.
It is affected by:
- current instruction,
- memory wait states,
- interrupt controller,
- stack operations,
- cache behavior,
- higher-priority interrupts.
A processor with a well-designed interrupt controller can respond faster than a higher-clocked processor with more software overhead.
Vectored Interrupts
A vectored interrupt controller knows which handler belongs to each interrupt.
When an interrupt occurs, the CPU can branch directly to the correct ISR.
This avoids software code that must:
- read a shared status register,
- identify the source,
- branch manually.
Hardware vectoring reduces latency.
Interrupt Vector Table
A vector table contains the addresses of interrupt handlers.
Typical entries may include:
- reset handler,
- timer ISR,
- UART ISR,
- ADC ISR,
- CAN ISR.
The interrupt controller and CPU use the vector table to locate the correct routine.
Nested Vectored Interrupt Controller
Arm Cortex-M processors integrate the:
Nested Vectored Interrupt Controller (NVIC).
The NVIC is closely coupled to the processor core.
Arm describes this integration as a key reason Cortex-M can provide low-latency interrupt handling.
Automatic State Saving
When an interrupt occurs, the processor must preserve enough context to return to the interrupted code later.
On Cortex-M, processor state is automatically stacked on exception entry and restored on exit.
This reduces software instructions inside the ISR entry and exit path.
Parallel Vector Fetch
Arm's Cortex-M4 documentation states that the interrupt vector fetch can occur in parallel with processor-state saving.
That reduces the total delay before ISR execution.
Interrupt Priorities
Not every event is equally important.
For example:
High Priority
- overcurrent fault,
- emergency input.
Medium Priority
- motor-control timer,
- ADC sample.
Low Priority
- UART logging,
- display update.
The interrupt controller lets software assign priorities.
Manufacturing, Scaling, and Industry Developments
Preemption
Suppose the processor is servicing a UART interrupt.
Then a motor overcurrent interrupt occurs.
If the motor fault has higher priority, it can preempt the UART ISR.
The CPU switches immediately to the high-priority handler.
After the fault ISR completes, the lower-priority ISR can continue.
Why Preemption Matters
Without priority preemption, an urgent safety event might wait behind a slow low-priority handler.
That can increase worst-case latency.
Proper priority design ensures critical events are serviced first.
Pending Interrupts
If an interrupt cannot run immediately, the controller can mark it:
pending.
The request is not lost.
When higher-priority work completes, the CPU services the pending interrupt.
Active State
An interrupt controller also tracks which handler is currently active.
This is required for:
- nested interrupts,
- return sequencing,
- priority decisions.
Priority Grouping
Some controllers divide priority into:
- preemption priority,
- subpriority.
The preemption field determines whether an interrupt can interrupt another ISR.
Subpriority determines ordering between pending interrupts that have the same preemption level.
ST's Cortex-M programming documentation explains this priority-grouping model.
Lower Number Often Means Higher Priority
On Cortex-M systems, a numerically lower configurable priority value generally means:
- higher execution priority.
This is important because it is opposite to what some developers initially expect.
Tail-Chaining
Tail-chaining is an important Cortex-M optimization.
Suppose one ISR finishes and another interrupt is already pending.
A simple processor might:
- restore the previous task context,
- immediately save it again,
- enter the next ISR.
That is inefficient.
With tail-chaining, the processor can move directly from one ISR to the next.
Arm documents tail-chaining as a way to avoid unnecessary stack save and restore operations.
Why Tail-Chaining Improves Throughput
In a busy embedded system, multiple interrupts may arrive close together.
Examples include:
- ADC,
- timer,
- communication.
Tail-chaining reduces the overhead between handlers.
This improves:
- interrupt throughput,
- response time,
- energy efficiency.
Late-Arrival Handling
Imagine a low-priority interrupt begins its entry sequence.
Before the ISR starts, a higher-priority interrupt arrives.
Cortex-M processors can recognize this late-arriving request and service the higher-priority interrupt first.
This reduces response time for urgent events.
Interrupt Masking
Software sometimes needs to temporarily prevent interrupts.
Interrupt controllers support masking mechanisms.
Possible uses include:
- protecting critical sections,
- updating shared state.
But masking must be used carefully.
Global Interrupt Disable
Disabling all interrupts is simple but can significantly increase worst-case response time.
Avoid long global critical sections.
Sensors, Perception, and Motion Control
Priority-Based Masking
Some architectures let software block only interrupts below a certain priority.
This is more flexible.
High-priority safety interrupts can remain active.
Non-Maskable Interrupt
A Non-Maskable Interrupt, or NMI, is reserved for very important events.
Typical sources may include:
- severe clock fault,
- memory fault,
- external emergency signal.
NMI usually has higher priority than normal peripheral interrupts.
Fault Exceptions
Many MCU architectures treat faults similarly to interrupts.
Examples include:
- hard fault,
- memory fault,
- bus fault.
The exception controller helps route these conditions to dedicated handlers.
Interrupt Controller in Motor Control
Consider a BLDC motor controller.
Possible interrupts include:
PWM Timer
Triggers control loop.
ADC
Signals current-sample completion.
Encoder
Updates position.
Overcurrent Fault
Requires immediate shutdown.
A well-configured interrupt controller ensures the overcurrent fault can preempt normal control processing.
ADC Sampling
ADC sampling often must happen at a precise point in the PWM cycle.
A typical path is:
timer trigger → ADC conversion → interrupt / DMA
Interrupt priorities help ensure processing occurs on time.
Timer Interrupts
Timers generate periodic interrupts for:
- control loops,
- scheduling,
- time measurement.
A motor-control timer may need higher priority than:
- communication,
- logging.
UART Receive
UART interrupts allow the processor to respond only when:
- a byte arrives,
- transmit buffer becomes empty.
This is much more efficient than constant polling.
CAN Interrupts
CAN controllers may interrupt for:
- receive message,
- transmit complete,
- bus error.
Priority configuration is important in systems where communication competes with real-time control.
DMA Interrupts
DMA reduces CPU involvement during data transfer.
The CPU may receive an interrupt only when:
- transfer completes,
- half buffer fills,
- error occurs.
This can dramatically reduce interrupt frequency.
GPIO Interrupts
External signals can trigger interrupts through GPIO or external interrupt controllers.
Examples include:
- limit switches,
- emergency buttons,
- proximity sensors.
Interrupts and Low-Power Modes
Interrupt controllers also support low-power operation.
The processor can sleep until:
- timer,
- sensor,
- communication
generates an interrupt.
Some Cortex-M implementations include a Wake-up Interrupt Controller for deep low-power operation.
Wake-Up Interrupt Controller
A WIC can monitor interrupts while much of the processor is:
- clock gated,
- power gated.
When a wake event occurs, the processor resumes.
This improves battery efficiency.
Performance, Memory, and Data Processing
Interrupt Storms
An interrupt storm occurs when interrupts arrive too quickly or continuously.
Possible causes include:
- noisy GPIO,
- communication fault,
- uncleared flag.
The CPU can spend almost all its time inside ISRs.
Preventing Interrupt Storms
Techniques include:
- clear flags correctly,
- debounce inputs,
- limit event rate,
- use DMA.
Keep ISRs Short
One of the most important interrupt-design rules is:
do as little work as possible inside the ISR.
An ISR should ideally:
- acknowledge hardware,
- capture critical data,
- signal a task,
- exit.
Long ISRs increase latency for other interrupts.
Move Heavy Work to Tasks
For example, a UART ISR can:
- copy received byte,
- notify RTOS task.
The task can later:
- parse protocol,
- process message.
This keeps interrupt response predictable.
RTOS and Interrupts
An RTOS works closely with interrupt priorities.
Interrupts may:
- give semaphores,
- send queues,
- wake tasks.
But only RTOS-safe APIs should be called from ISR context.
Interrupt Priority and RTOS Rules
Many RTOS ports reserve priority ranges.
For example, very high-priority ISRs may be prohibited from calling kernel APIs.
Incorrect priority configuration can cause:
- crashes,
- timing faults.
Priority Inversion Between ISR and Tasks
Interrupts always outrank normal tasks on many MCUs.
A low-value ISR that runs too frequently can starve an important RTOS task.
Therefore both:
- interrupt priority,
- interrupt frequency
must be considered.
Measuring Interrupt Latency
Do not rely only on datasheet cycle counts.
Measure the actual system.
A simple method is:
- toggle GPIO at interrupt source,
- toggle another GPIO at ISR start,
- measure delay with oscilloscope.
Cycle Counters
Many processors include cycle counters or trace hardware.
These can measure:
- ISR entry time,
- ISR duration,
- jitter.
Worst-Case Latency
Average latency is not enough.
Real-time design should evaluate:
- longest interrupt blocking interval,
- nested interrupt behavior,
- memory wait states,
- maximum ISR duration.
Cortex-M4 Example
Arm documents a maximum interrupt-entry latency of 12 cycles under specific zero-wait-state conditions for Cortex-M4.
Tail-chaining between back-to-back interrupts can take fewer cycles because full stack restore/save is avoided.
These numbers illustrate how tightly integrated interrupt hardware improves responsiveness.
Architecture and Operating Principles
Cortex-M7 NVIC Capacity
Arm's Cortex-M7 documentation describes an NVIC supporting:
- up to 240 external interrupts,
- up to 256 priority levels
depending on implementation.
This allows complex SoCs to prioritize many hardware sources.
Modern Cortex-M55
Newer Cortex-M55 implementations can support even larger interrupt counts depending on implementation.
This reflects the growing complexity of:
- AI-enabled MCUs,
- connected embedded systems.
Interrupt Controllers in Multicore Systems
Multicore processors require more advanced interrupt routing.
An interrupt may need to target:
- core 0,
- core 1,
- several cores.
Large Arm application processors commonly use the Generic Interrupt Controller architecture rather than the Cortex-M NVIC.
Interrupt Affinity
Multicore controllers can route certain interrupts to specific CPUs.
This helps isolate:
- real-time control,
- networking,
- application workloads.
Software-Generated Interrupts
Some interrupt controllers support software-triggered interrupts.
These can be used for:
- inter-core communication,
- deferred processing,
- testing.
Safety Systems
Safety-critical processors may use interrupt controllers for:
- overtemperature,
- ECC fault,
- watchdog warning,
- voltage fault.
Critical fault interrupts should have carefully planned priority and response paths.
Determinism
A good interrupt architecture improves determinism by ensuring:
- priorities are explicit,
- pending behavior is defined,
- nesting rules are known.
This is essential for hard real-time control.
Interrupt Latency vs ISR Duration
These are different metrics.
Interrupt Latency
Time before ISR begins.
ISR Duration
Time spent inside ISR.
A fast interrupt controller cannot compensate for poorly written long ISRs.
Shared Interrupt Lines
Some MCUs route multiple peripheral sources to one IRQ.
The ISR must then determine which source caused the interrupt.
This adds software overhead.
Dedicated vector entries reduce this overhead.
Interrupt Coalescing
High-throughput systems sometimes combine multiple events into fewer interrupts.
This reduces CPU overhead.
Example:
- Ethernet controller generates one interrupt after several packets.
The trade-off is increased latency.
Polling Can Still Be Better Sometimes
Interrupts are not always the right answer.
For extremely high-rate events, polling or DMA may be more efficient.
Example:
- continuous high-speed data stream.
The ideal architecture may be:
DMA + occasional completion interrupt.
Implementation, Testing, and Optimization
Interrupt Design for Industrial Systems
A practical priority hierarchy might be:
Priority 0
- hardware safety fault.
Priority 1
- motor-control timer.
Priority 2
- ADC completion.
Priority 3
- industrial network.
Priority 4
- UART diagnostics.
The exact numbers depend on the MCU.
Common Design Mistake: Everything at Highest Priority
If all interrupts share the highest priority, preemption becomes ineffective.
Priorities should represent actual timing requirements.
Common Design Mistake: Long Critical Sections
Disabling interrupts for too long increases worst-case response time.
Keep critical sections short.
Common Design Mistake: Long ISRs
Protocol parsing, logging, and heavy calculations usually belong outside the ISR.
Common Design Mistake: Incorrect Flag Clearing
If the peripheral flag is not cleared correctly, the interrupt can immediately retrigger.
This may create an interrupt storm.
Common Design Mistake: Priority Misunderstanding
On Cortex-M, lower numerical priority values represent higher execution priority.
Misunderstanding this can invert the intended design.
Common Design Mistake: Ignoring Shared Resources
Nested ISRs can access the same:
- buffer,
- peripheral,
- variable.
Use synchronization and atomic operations where necessary.
Practical Interrupt Design Workflow
Step 1: List Interrupt Sources
Examples:
- timer,
- ADC,
- CAN,
- UART,
- GPIO,
- fault.
Step 2: Define Maximum Allowed Latency
For each source, specify:
- deadline.
Step 3: Assign Priorities
The shortest safety-critical deadline receives higher priority.
Step 4: Keep ISR Work Minimal
Move noncritical processing to:
- task,
- main loop.
Step 5: Use DMA Where Possible
Reduce interrupt frequency.
Step 6: Measure Worst-Case Latency
Test with multiple interrupts active simultaneously.
Step 7: Test Fault Conditions
Create:
- communication bursts,
- noisy inputs,
- nested events.
Interrupt Controllers and Physical AI
Intelligent machines may use high-level AI for:
- perception,
- planning.
But low-level embedded controllers still depend on interrupts for:
- motor control,
- safety,
- sensors.
The interrupt controller forms part of the bridge between:
physical events
and
digital response.
Future Direction
Interrupt controllers are becoming more sophisticated as embedded systems become:
- multicore,
- connected,
- safety critical.
Future architectures will increasingly combine:
- hardware routing,
- virtualization support,
- security isolation,
- low-power wake management.
Conclusion
Interrupt controllers improve embedded-system responsiveness by allowing hardware events to reach the processor quickly and in the correct order.
They provide:
- vectoring,
- priorities,
- nesting,
- preemption,
- pending management,
- masking,
- efficient context transitions.
Architectures such as Arm Cortex-M's NVIC add optimizations including:
- automatic stacking,
- late arrival,
- tail-chaining.
These mechanisms reduce the software overhead between an external event and the correct ISR.
But good hardware alone is not enough.
Responsive embedded systems also require:
- sensible priority design,
- short ISRs,
- limited interrupt masking,
- DMA for high-rate data,
- worst-case latency measurement.
The central engineering principle is:
prioritize urgent physical events in hardware, then keep the software response as short and deterministic as possible.
That combination makes interrupt controllers fundamental to responsive motor drives, robots, industrial networks, sensors, and safety systems.