GPIO edge interrupt priority and bluetooth interrupt priority

I am working on a project for the nRF52832 using nRF Connect SDK v2.2.0.

I have setup a GPIO interrupt on both edges using gpio_pin_interrupt_configure_dt, gpio_init_callback, and gpio_add_callback.

It seems to work fine : my callback function is called right after the edge interrupt occurs.

I have an issue though when I start to enable Bluetooth.

I know that when running, the Bluetooth stack can interrupt the system to handle Bluetooth events.

I would like to increase the priority of my GPIO interrupt (or decrease the priority of the Bluetooth event interrupt) so that I can reduce the latency on my GPIO interrupt callback.

My plan is to set the connection parameters so that packets can be lost without breaking the Bluetooth connection so that if the GPIO interrupt occurs and blocks / delays a Bluetooth event interrupt, the connection will stay active (probably using timeout and / or slave latency).

I have seen that the default interrupts for gpiote is configured as 'interrupts = <6 5>' in the nrf52832 device tree but I struggle to understand what 6 and 5 are and how to get the highest priority possible. I also have not found how to reduce the priority level of the Bluetooth events.

Regards

Parents
  • I would like to increase the priority of my GPIO interrupt (or decrease the priority of the Bluetooth event interrupt) so that I can reduce the latency on my GPIO interrupt callback.

    My plan is to set the connection parameters so that packets can be lost without breaking the Bluetooth connection so that if the GPIO interrupt occurs and blocks / delays a Bluetooth event interrupt, the connection will stay active (probably using timeout and / or slave latency).

    Sorry, this is not possible, you will quickly get an assert from the softdevice controller if you try to delay it's operations. The only way something like this can be done is to use the nRF5340, where there are two cores (network core and application core). In the application core you have full freedom of which interrupt have highest priority depending on the application.

    Kenneth

  • Thanks for your response. I was afraid that you would say that indeed.

    I am looking at the nRF52 datasheet and am discovering the PPI module.

    Do you think it would be possible to use PPI to configure the GPIOTE interrupt to read a timer value using Timer Capture and then do the processing when the ISR gets executed ? Is there a risk to miss any interrupt in this case ?

    Also: is there an API for using PPI with nRF Connect SDK / Zephyr ? I am only seeing a PPI trace module but I don't think that's the same thing.

Reply
  • Thanks for your response. I was afraid that you would say that indeed.

    I am looking at the nRF52 datasheet and am discovering the PPI module.

    Do you think it would be possible to use PPI to configure the GPIOTE interrupt to read a timer value using Timer Capture and then do the processing when the ISR gets executed ? Is there a risk to miss any interrupt in this case ?

    Also: is there an API for using PPI with nRF Connect SDK / Zephyr ? I am only seeing a PPI trace module but I don't think that's the same thing.

Children
Related