Interrupt priority: Documentation missing in nRF Connect SDK / nRF5340 SoC Product Specification / NRFX UARTE driver requires interrupt priority configuration

Hello everybody who is familiar with the nRF Connect SDK and NRFX drivers,

I cannot find any documentation about interrupt priorities in the nRF Connect SDK documentation. There is some information available in the nRF5x S140 documentation, but not in the nRF Connect documentation. I also coudln't find any information in the nRF5340 Product Specification (v1.3).

Question 1: How are interrupt priorities handled on the nRF5340 and in nRF Connect SDK? Please add a chapter to the official documentation.

Question 2: The NRFX_UARTE driver requires an interrupt priority definition in the nrf_uarte_config_t structure (member: interrupt_priority). It is a uint8_t value. What value should I use to initialize this member? Is there a macro available? Does the interrupt_priority value depend on the SoC being used? (e.g. different values für nRF5340 and nRF52832)?

Question 3: The NRFX_UARTE driver defines a callback function for received data (or finished send buffer). In which context (and under which interrupt priority level) is this handler called? ZEPHYR is initialized and running some tasks in the background.

Best regards,

Michael

  • Hello Michael,

    Firstly I want to stress that we recommend that you use the Zephyr drivers and not the nrfx drivers.

    Question 1: How are interrupt priorities handled on the nRF5340 and in nRF Connect SDK? Please add a chapter to the official documentation.

    The interrupt priority levels are specific for each Cortex-M variant and is described in the device tree. Se the documentation here.

    Here is a direct link to the description for the interrupt priority bits for nRF5340 application core: https://github.com/nrfconnect/sdk-zephyr/blob/main/dts/arm/nordic/nrf5340_cpuapp.dtsi#L109.

    Question 2: The NRFX_UARTE driver requires an interrupt priority definition in the nrf_uarte_config_t structure (member: interrupt_priority). It is a uint8_t value. What value should I use to initialize this member? Is there a macro available? Does the interrupt_priority value depend on the SoC being used? (e.g. different values für nRF5340 and nRF52832)?

    For the Zephyr driver, the interrupt values are defined in the device tree like this: https://github.com/nrfconnect/sdk-zephyr/blob/main/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi#L82-L87. A quick glance into the corresponding devicetree for nRF52832 revealed that the two chips have the same amount of interrupt priority bits.

    If you need to use the nrfx driver -- which is not recommended -- you can use NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY
    as the initializing value. It is defined in <ncs-installation>/zephyr/modules/hal_nordic/nrfx/nrfx_config_nrf5340_application.h and has default value is 7.

    Question 3: The NRFX_UARTE driver defines a callback function for received data (or finished send buffer). In which context (and under which interrupt priority level) is this handler called? ZEPHYR is initialized and running some tasks in the background.

    The handler is called whenever there is a UARTE event with priority NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY.

    Best Regards,
    Maria

Related