This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is calling Softdevice function from main context safe?

Hello,

my application is using the event scheduler while the softdevice is not. Is it save to call softdevice functions (like sd_ble_gap_scan_stop(), dm_device_delete_all(), ...) directly from the main context?

Parents
  • dm_device_delete_all() is a function that belongs to the Device Manager, which is a software module, it is not part of the SoftDevice.

    sd_ble_gap_scan_stop() is an SVC call and has interrupt priority 2 (0 is the highest, 3 is the lowest)

    There are two application interrupt priorities available, 1 and 3.

    The general answer is yes, it is safe, but it depends on your application, you could get unwanted behavior if you don't keep in mind how the interrupts and the events are handled.

    One difference will be that:

    If you use scheduling on both the application and the SoftDevice, SVC calls and application interrupts will be scheduled and handled in turn.

    If you use scheduling only on the application, the SoftDevice will be able to interrupt the scheduled application events, even the ones with priority 1.

  • You would just need to consider that SVC calls and application interrupts will be scheduled and handled in turn. :)

Reply Children
No Data
Related