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

ble_advdata_set within radio_notification

FormerMember
FormerMember

I'm writing an application which updates the ble advert data at run time. I use the radio_notification callback functionality. Inside that function, the code calls the ble_advdata_set function to update the advertisement data. The code runs with no problems.

Inside the same function data is read from the InvenSense driver(gyro and acceleration) using using dmp_read_fifo (inv_mpu_dmp_motion_driver.c) and this is placed in the advertisement data structure. Again no problems.

It works, however being new to this development environment, I'm wandering if I'm breaking any BLE software design principles or best practices.

Parents
  • Hi

    Good to hear that things are working. What you are doing sounds reasonable. Since you use radio notification, you probably specify how long before a BLE radio event the radio notification triggers, so that you have time to perform both operations before the radio event starts. If your operation is very time consuming then it is an option to have that execute in the main function, which has lower priority than the interrupt context of the radio notification interrupt handler.

    The main function runs at ARM priority 4 while the radio interrupt runs at ARM priority 3 (see S110 SDS , i.e. softdevice specification). The BLE internal softdevice events run on ARM priority 0, so any application interrupt can not break the BLE protocol, the softdevice will preempt any application interrupt in order to maintain the BLE protocol.

Reply
  • Hi

    Good to hear that things are working. What you are doing sounds reasonable. Since you use radio notification, you probably specify how long before a BLE radio event the radio notification triggers, so that you have time to perform both operations before the radio event starts. If your operation is very time consuming then it is an option to have that execute in the main function, which has lower priority than the interrupt context of the radio notification interrupt handler.

    The main function runs at ARM priority 4 while the radio interrupt runs at ARM priority 3 (see S110 SDS , i.e. softdevice specification). The BLE internal softdevice events run on ARM priority 0, so any application interrupt can not break the BLE protocol, the softdevice will preempt any application interrupt in order to maintain the BLE protocol.

Children
No Data
Related