0
0
Cnc-programmingConceptBeginner · 3 min read

IRQ and FIQ in ARM: What They Are and How They Work

IRQ (Interrupt Request) and FIQ (Fast Interrupt Request) are two types of hardware interrupts in ARM processors. FIQ has higher priority and faster response than IRQ, allowing critical tasks to interrupt normal processing quickly.
⚙️

How It Works

In ARM processors, interrupts are signals that pause the normal flow of a program to handle urgent tasks. IRQ is a standard interrupt used for general purposes, while FIQ is a special fast interrupt designed for time-critical events.

Think of IRQ as a regular phone call that you answer when you can, and FIQ as an emergency call that you must answer immediately. The processor stops what it is doing and jumps to a special piece of code called an interrupt handler to deal with the event.

FIQ has its own set of banked registers, which means it can save and restore data faster without disturbing the main program's state much. This makes FIQ ideal for very fast responses, like handling data from high-speed devices.

💻

Example

This simple ARM assembly example shows how an IRQ and FIQ interrupt might be handled by jumping to different handlers.

armasm
AREA InterruptExample, CODE, READONLY

ENTRY

    ; Main program loop
main_loop
    B main_loop

    ; IRQ Handler
IRQ_Handler
    ; Handle IRQ interrupt here
    SUBS PC, LR, #4

    ; FIQ Handler
FIQ_Handler
    ; Handle FIQ interrupt here
    SUBS PC, LR, #4

END
🎯

When to Use

Use FIQ when you need the fastest possible response to an interrupt, such as handling high-speed data transfers or critical timing events. Its dedicated registers reduce delay in saving and restoring state.

Use IRQ for general-purpose interrupts like keyboard input, timers, or communication events where speed is important but not critical.

In real-world embedded systems, FIQ might be used for urgent hardware signals like audio or video streaming, while IRQ handles less time-sensitive tasks.

Key Points

  • IRQ is a normal interrupt with lower priority.
  • FIQ is a fast interrupt with higher priority and dedicated registers.
  • FIQ allows quicker response by minimizing context saving.
  • Both interrupts pause normal execution to run special handler code.
  • Use FIQ for critical, time-sensitive tasks and IRQ for general interrupts.

Key Takeaways

IRQ and FIQ are hardware interrupts in ARM with different priorities and speeds.
FIQ has higher priority and uses dedicated registers for faster handling.
Use FIQ for urgent, time-critical tasks and IRQ for general interrupts.
Both interrupts temporarily pause normal program flow to run handlers.
Understanding IRQ and FIQ helps optimize embedded system responsiveness.