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

Interrupt priority

Hi,

While the softdevice is active (nRF51822) available interrupt priorities are:

typedef enum { NRF_APP_PRIORITY_HIGH = 1, NRF_APP_PRIORITY_LOW = 3 } nrf_app_irq_priority_t;

  1. Can I use interrupt priority = 2?
  2. SVC priority is 2, is it true? So I could't use Softdevice api-functions in interrupt handlers with NRF_APP_PRIORITY_HIGH priority?
  3. What does define "#define NRF_APP_PRIORITY_THREAD 4" in app_util.h mean?

Artem Z. Best Regards

Parents
  • Hi Artem,

    to answer your questions

    • 1. Can I use interrupt priority = 2? No, not while the SoftDevice is active. If you try to set this priority level using sd_nvic_SetPriority() you will get an error.
    • 2. SVC priority is 2, is it true? So I could't use Softdevice api-functions in interrupt handlers with NRF_APP_PRIORITY_HIGH priority? Correct. You would need to pass execution to a lower priority level, for example by using a software interrupt (SWIRQ) with NRF_APP_PRIORITY_LOW.
    • 3. What does define "#define NRF_APP_PRIORITY_THREAD 4" in app_util.h mean? It's used in "current_int_priority_get()" to indicate if the CPU is running in thread mode (main context), as opposed to running in interrupt mode with interrupt priority 0-3.
  • Artem, did vich answer your question?

    Even though all access to the GATT database happens at the same priority, your application still needs to handle the case where both the Central and Peripheral writes to this characteristic in close succession. Maybe applying a "control point" type characteristic will make things easier? Several profiles have characteristics called "control points". The client will write commands to the control point, for example "clear counter command", and the application performs the action.

Reply
  • Artem, did vich answer your question?

    Even though all access to the GATT database happens at the same priority, your application still needs to handle the case where both the Central and Peripheral writes to this characteristic in close succession. Maybe applying a "control point" type characteristic will make things easier? Several profiles have characteristics called "control points". The client will write commands to the control point, for example "clear counter command", and the application performs the action.

Children
No Data
Related