ARM Interrupts
In general, ARM Interrupts are signals from a computer device or a programme within a controller that prompts the main programme to halt and choose what to do next. When an interrupt occurs in ARM, the ISR (Interrupt Service Routine) is called. When an interrupt is received, a component of a programme takes control and performs the activities necessary to service the interrupt. Click here to access complete arm series.
When a device requires microcontroller service, the device sends an interrupt signal to the microcontroller.
- When the microcontroller receives an interrupt signal, it interrupts the main programme flow and saves the location of the next instruction (PC) on the stack pointer (SP).
- It jumps to a defined area in memory known as the interrupt vector table, which contains the ISR’s address (Interrupt Service Routine). Each interrupt has its own interrupt service routine (ISR). The interrupt vector table contains the address of the interrupt service routine (ISR), to which the microcontroller jumps.
- It begins executing the Interrupt Service Routine until it reaches the subroutine’s last instruction, RETI (Return from Interrupt). In C coding, RETI is not used.
- The microcontroller returns to where it left off or was interrupted before after executing the final instruction in the Interrupt Service Routine. And then it pops the top two bytes of the stack into the PC to acquire the programme counter (PC) address from the stack pointer.
- The programme then begins to run from that address and continues to run the main application.
When an external device asserts the processor’s IRQ (Interrupt) pin, an interrupt occurs. This can be utilized by an external device to get the processor’s attention.
Types of Interrupts
On an ARM processor, there are two types of interrupts. The interrupt produced by external events from hardware peripherals is the first type, whereas the SWI instruction is the second. Because the ARM core only has one FIQ pin, an external interrupt controller is always used so that the system can have multiple interrupt sources that are prioritised by the interrupt controller. The FIQ interrupt is then raised, and the handler determines which of the external interrupts was raised and handles it.
Interrupt Handling
It is up to the system designer to determine which hardware peripherals are capable of generating specific interrupt requests. We may attach numerous external interrupts to one of the ARM interrupt requests and discriminate between them by utilizing an interrupt controller. System designers have chosen a common design for allocating interrupts:
• Normally, SWIs are used to invoke privileged operating system procedures.
• IRQs are often allocated to interruptions that are used on a regular basis, such as periodic timers.
• FIQ is reserved for a single interrupt source that demands a quick reaction time, such as DMA or any other time-critical activity.
Interrupt exception
The CPU sets the computer to a certain memory location when an exception or interrupt occurs. The address is in the vector table, which is a particular address range. The vector table’s entries are instructions that lead to specific routines that deal with a specific exception or interrupt. The vector table, a collection of 32-bit words, is stored at memory map location 0x00000000. On certain CPUs, the vector table can be stored at a higher memory location (starting at the offset 0xffff0000). This functionality may be used by operating systems like Linux and Microsoft’s embedded solutions.
The processor suspends regular execution and begins loading instructions from the exception vector table when an exception or interrupt occurs.
- When the CPU is unable to decode an instruction, an undefined instruction vector is utilized.
- When you perform a SWI instruction, the software interrupt vector is triggered. The SWI instruction is commonly used to call an operating system procedure.
- Prefetch abort vector occurs when the processor attempts to fetch an instruction from an address without the correct access permissions. In the decode step, the real abort happens.
- The data abort vector is identical to the prefetch abort vector, except it is raised when an instruction tries to access data memory without the proper permissions.
- External hardware uses an interrupt request vector to interrupt the processor’s usual execution flow. Only if IRQs are not disguised in the cpsr can it be increased.
- Fast interrupt request vectors similar to the interrupt request but are reserved for hardware requiring faster response times. It can only be increased if the FIQs in the cpsr are not disguised.
For detailed information – Click here
Also refer relevant blogs: