How can I do software interrupt in nRF Connect SDK v2.9.0

Hello, 
I am using nRF Connect SDK version 2.9.0, and I want to know how to perform the software interrupt.

Where can I find the driver of the software interrupt to know its APIs and use them?

  • Hi,

    The documentation for interrupts can be found here: docs.zephyrproject.org/latest/kernel/services/interrupts.html.

    Here is an example of a how interrupts can be used by a driver (the nRF5x UART driver in this case): github.com/zephyrproject-rtos/zephyr/blob/main/drivers/serial/uart_nrfx_uart.c.

    There are many drivers written already so you might not need to access the IRQ API directly. But I have no clue about what problem you are solving so it is hard to tell. I hope the supplied links helps you to move forward!

  • I was using SDK16, and now I am trying to migrate from SDK16 to nRF Connect SDK v2.9.0. 
    I saw that nRF Connect SDK depends on Zephyr. 
    Now, to do the migration, I used Zephyr/irq.h to implement the software interrupt. But I am not sure if this is the best way or if there is another better way. Also, I found these application priorities in the SDK 16
    //lint -save -e113 -e452
    /**@brief The interrupt priorities available to the application while the SoftDevice is active. */
    typedef enum
    {
    #ifndef SOFTDEVICE_PRESENT
    APP_IRQ_PRIORITY_HIGHEST = _PRIO_SD_HIGH,
    #else
    APP_IRQ_PRIORITY_HIGHEST = _PRIO_APP_HIGH,
    #endif
    APP_IRQ_PRIORITY_HIGH = _PRIO_APP_HIGH,
    #ifndef SOFTDEVICE_PRESENT
    APP_IRQ_PRIORITY_MID = _PRIO_SD_LOW,
    #else
    APP_IRQ_PRIORITY_MID = _PRIO_APP_MID,
    #endif
    APP_IRQ_PRIORITY_LOW_MID = _PRIO_APP_LOW_MID,
    APP_IRQ_PRIORITY_LOW = _PRIO_APP_LOW,
    APP_IRQ_PRIORITY_LOWEST = _PRIO_APP_LOWEST,
    APP_IRQ_PRIORITY_THREAD = _PRIO_THREAD /**< "Interrupt level" when running in Thread Mode. */
    } app_irq_priority_t;

    But, I couldn`t find the application priorities like this in the nRF Connect SDK v2.9.0

  • Hello,

    Can you be a bit more specific on what you want to do?

    I assume you want to run a piece of software after some event. What do you want to trigger this event? A button press? A timer? An event on one of the HW peripherals (UART, SPI, I2C, ...)?

    Best regards,

    Edvin

  • I had my own driver of software interrupt when I was working on SDK16. Now, I am trying to migrate from SDK16 to nRF Connect SDK v2.9.0. I need to know if there are new APIs that I should use from the nRF Connect SDK to complete this migration
    Also, I found these application priorities in SDK 16, and I was using APP_IRQ_PRIORITY_HIGH to set the priority of software interrupt as HIGH, but, I couldn`t find the application priorities like this in the nRF Connect SDK v2.9.0
    //lint -save -e113 -e452
    /**@brief The interrupt priorities available to the application while the SoftDevice is active. */
    typedef enum
    {
    #ifndef SOFTDEVICE_PRESENT
    APP_IRQ_PRIORITY_HIGHEST = _PRIO_SD_HIGH,
    #else
    APP_IRQ_PRIORITY_HIGHEST = _PRIO_APP_HIGH,
    #endif
    APP_IRQ_PRIORITY_HIGH = _PRIO_APP_HIGH,
    #ifndef SOFTDEVICE_PRESENT
    APP_IRQ_PRIORITY_MID = _PRIO_SD_LOW,
    #else
    APP_IRQ_PRIORITY_MID = _PRIO_APP_MID,
    #endif
    APP_IRQ_PRIORITY_LOW_MID = _PRIO_APP_LOW_MID,
    APP_IRQ_PRIORITY_LOW = _PRIO_APP_LOW,
    APP_IRQ_PRIORITY_LOWEST = _PRIO_APP_LOWEST,
    APP_IRQ_PRIORITY_THREAD = _PRIO_THREAD /**< "Interrupt level" when running in Thread Mode. */
    } app_irq_priority_t;


  • Zephyr (used in NCS) has it's own priorities. 

    E.g. if you are running a thread, you can set the thread priority.

    But you didn't answer the question. What do you use to trigger the interrupt? Is it a button press? A Timer? 

Related