When app timer handling its ISR,can ble observer interrupt it?
When app timer handling its ISR,can ble observer interrupt it?
Depends on the app timer priority: APP_TIMER_CONFIG_IRQ_PRIORITY
With the default prio (6), the ble observer can preempt the timer IRQ handler.
Edit: As mentioned below, I was mistaken about the SD event IRQ priority, which happens to be 6, too. Thus by default the timer evens cannot be preempted unless APP_TIMER_CONFIG_IRQ_PRIORITY is configured to be 7.
Depends on the app timer priority: APP_TIMER_CONFIG_IRQ_PRIORITY
With the default prio (6), the ble observer can preempt the timer IRQ handler.
Edit: As mentioned below, I was mistaken about the SD event IRQ priority, which happens to be 6, too. Thus by default the timer evens cannot be preempted unless APP_TIMER_CONFIG_IRQ_PRIORITY is configured to be 7.
Thanks for answer!
Now I set APP_TIMER_CONFIG_IRQ_PRIORITY to 6 , and set a ble service observer priority to 2 , the ble observer still can not preempt the timer IRQ handler. A ble write occurs when app timer handling its IRQ,but the ble observer does not report BLE_GATTS_EVT_WRITE until the app timer IRQ done.
Am i missing something?Thank you
All observers are notified in the same SD_EVT_IRQn interrupt context regardless of observer priority. So the APP_TIMER_CONFIG_IRQ_PRIORITY would have to be "lowered" to priority 7 to allow it to be preempted by a BLE observer.
The observer priority determines in which order the various observers are notified. Eg a BLE callback with priority 1 will always get called before a BLE callback with priority 2. Please refer to "Observers and their priorities" for more details.
You are right! I set APP_TIMER_CONFIG_IRQ_PRIORITY to 7,and a BLE observer can preempt the app timer IRQ. Thank you so much!^_^