Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Events vs. interrupts?

In Nordic parlance, what is event and what is interrupt? To my understanding, in ARM parlance, events are signals that can be routed to NVIC to cause interrupts.

Basically, SW can't see events if they are not causing interrupts (except by using WFE).

I was wondering about event handlers, and especially that you don't configure which events are generated. Are all events handled as interrupts in the abyss of the SDK? And when do you need calls, like nrfx_timer_compare_int_enable()?

  • Hi

    In Nordic parlance, what is event and what is interrupt?

    I would suggest you take a look at the Peripheral interface documentation for event and interrupt.

    I was wondering about event handlers, and especially that you don't configure which events are generated. Are all events handled as interrupts in the abyss of the SDK?

    The event handlers run in interrupt context, but you can run the event handlers in main's context by using the Schedule handling library

    With the app_scheduler you call app_sched_event_put() from an event handler, and then the scheduler will execute the given event handler from main's context after you've returned from the interrupt context. 

    when do you need calls, like nrfx_timer_compare_int_enable()?

     When you need the interrupt for the event in the driver. Like nrfx_timer_compare_int_enable is Function for enabling timer compare interrupt for the compare event.

    -Amanda H.

  • I mean, are all interrupts checked in the (I think) bootloader, and the requested ones are put forward as events? I'm not talking about SW handling of them, but processor cycles. Note that there are HW events (as described in the Peripheral Interface) and there are SW events, that the event handlers handle. Not the same thing - not even(t) close.

    And when do I need interrupts for events in SW? And why only some interrupts are offered?

  • Hi,  

    Yes, are all interrupts checked in the interrupt context, and the requested ones are put forward as events. For the peripheral drivers in the SDK, the handlers are mostly called from the IRQ_handler of the hardware peripheral and will run in the interrupt context. The handlers will be called when there are relevant events to be passed to the application. This is very specific to each peripheral/driver. I would recommend that you check out the event type in the struct that is passed to the handler in most drivers. This will provide details on the relevant events you can expect.

    turboscrew said:
    when do I need interrupts for events in SW? And why only some interrupts are offered?

     Do you mean software interrupts (SWI)? You can refer to this post to see how you can use the EGU as a form of a software interrupt source. This is not really software interrupt (SWI) though, since the EGU is an actual HW peripheral, and it excelled when you want to trigger interrupts via PPI. If you want to use normal SWI in a user-friendly way, then you could look at the SWI driver.

    -Amanda H.

  • Actually the first part of your answer was what I was looking for.

Related