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

soft device threading - when and what are calls safe?

I would like to learn more about when it is safe to invoke soft device methods and when it is not. For example, are the following 'allowed' to make soft device calls to update a characteristic? If not, what is the suggested workaround? For example, can I initiate a TX characteristic notification to the peer from any of these contexts?

  1. From within a button interrupt handler
  2. From within a timer interrupt
  3. From a callback when an RX characteristic notification is received
  4. From an on_ble event handler
Parents
  • 1 & 2) Yes, as long as the interrupt handler priority is less than SVC IRQ priority.

    3 & 4) Technically Yes, but some has seen problems in few cases, that is why using a scheduler and moving the context to main is recommended here.

  • Is use of the scheduler required or can one just check a 'pend' variable in the main loop? It's not clear to me what events trigger the main loop to wake up and run.

Reply Children
No Data