This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

About the priority of multiple interrupts

SDK: 15.3.0
Device: EYSHJNZWZ (nRF52832)

I am using multiple interrupts.
For example, BLE communication interrupt and SOC interrupt.
I set the priority of each interrupt as follows.

#define		C_APP_SOC_OBSERVER_PRIO			1
#define		C_BLE_APP_BLE_OBSERVER_PRIO		3

NRF_SDH_SOC_OBSERVER(
						m_soc_observer,
						C_APP_SOC_OBSERVER_PRIO,
						e_soc_evt_handler,
						NULL
);

NRF_SDH_BLE_OBSERVER(
						m_ble_observer,
						C_BLE_APP_BLE_OBSERVER_PRIO,
						e_ble_evt_handler,
						NULL
);

Since the priority of the interrupt is different, I think that it will be a multiple interrupt.
When a high-priority interrupt occurs during a low-priority interrupt, the high-priority interrupt runs with priority.
Is my opinion correct?
Is it possible to disable or enable multiple interrupts?

  • Hi,

     

     

    I am using multiple interrupts.
    For example, BLE communication interrupt and SOC interrupt.

     The _OBSERVER macro will inherit the interrupt priority of the interrupt vector that is set pending by the SoftDevice (SWI2 by default) in nrf_sdh.c::SD_EVT_IRQHandler.

    Each registered observer has a priority level in the case that several observers are registered to the same type, and one shall execute first (ie: a software implemented priority).

     

    Since the priority of the interrupt is different, I think that it will be a multiple interrupt.
    When a high-priority interrupt occurs during a low-priority interrupt, the high-priority interrupt runs with priority.
    Is my opinion correct?
    Is it possible to disable or enable multiple interrupts?

     As mentioned, these observers will inherit the interrupt level as the SD_EVT_IRQ runs in.

    You can disable interrupts if you'd like, but as you should not disable softdevice interrupts, you should use these macros instead which only disables application interrupts:

    CRITICAL_REGION_ENTER();
    critical_code();
    CRITICAL_REGION_EXIT();
    Kind regards,
    Håkon
  • Thank you for answering.
    I understood interrupt priority and how to disable interrupts.

    >> Since the priority of the interrupt is different, I think that it will be a multiple interrupt.
    >> When a high-priority interrupt occurs during a low-priority interrupt, the high-priority interrupt runs with priority.
    >> Is my opinion correct?
    What about the above?
    Please tell me.

Related