Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between an event and an interrupt in ARM Cortex?

I was wondering, because it seems to be different (for example WFI and WFE are separate instructions), but I can't exactly pinpoint the thing.

like image 562
nraynaud Avatar asked May 03 '13 04:05

nraynaud


People also ask

What is the difference between event and interrupt?

interrupts are hardware events, events are software interrupts.

What is interrupt in ARM Cortex?

Exceptions and interrupts The Cortex-M0 processor supports interrupts and system exceptions. The processor and the NVIC prioritize and handle all exceptions. An interrupt or exception changes the normal flow of software control. The processor uses handler mode to handle all exceptions except for reset.

What 5 conditions must be true for an interrupt to occur?

The five necessary events (device arm, NVIC enable, global enable, level, and trigger) can occur in any order. For example, the software can set the I bit to prevent interrupts, run some code that needs to run to completion, and then clear the I bit.

Which interrupt bus in ARM processor has the highest priority?

As another example, the advanced interrupt controller (AIC) used for ARM processors can handle up to 32 interrupt sources. Each interrupt source can have a programmable priority level of 7-0: level 7 is the highest and level 0 is the lowest priority.


2 Answers

After a few years, I see this question is popular, and in the mean time I understood the answer by experience.

Events are implemented as lines entering the MCU ARM core, alongside the memory bus (actually the core can generate events too, the lines are one way and point to point dedicated, this is not a bus), so that peripherals or other cores can raise those lines to tell stuff in real time to the core outside any memory bus management or instruction execution, even if there is no bus arbitrer in the MCU (I guess they are clocked at bus frequency, tho).

Those events are then handled by the core, and one way to make the event enter the program world it by raising an interrupt (more exactly, plugging the line to the NVIC, that can interpret it as an interrupt), by flipping a bit in one of the core registers, by re-starting the core clock or they can be plugged to a DMA peripheral to start or stop a transfert. There is a whole logic part dedicated to event management in the core, to mask them, use them as sources for exception or as source of DMA actions.

The list of events is decided by the MCU implementers, they can decide to use an NVIC, a DMA, or connect them to PLD logic (some cypress MCU can trigger a DMA or interrupt from the PLD part).

The absolute most common way to handle an event is to ignore it, and the second most common is to send an exception to execute some code.

like image 185
nraynaud Avatar answered Sep 20 '22 04:09

nraynaud


Both instructions are meant for power management/saving. While WFI is supposed to halt the core till an interrupt or exception occurs, WFE will also wait for an "event", which can be send by the SEV instruction.

It is implementation defined to which level the instructions are implemented, they might be just NOPs. So for example you can not trust that an interrupt or "event" really occurred when WFE returns.

like image 37
Nico Erfurth Avatar answered Sep 21 '22 04:09

Nico Erfurth