I am planning to migrate from the nRF5 SDK to the nrf connect SDK.
My application is processing events from SoftDevice on a single thread.
In the same way, please tell me how to receive HCI events in a single thread with the nrf connect SDK.
I am planning to migrate from the nRF5 SDK to the nrf connect SDK.
My application is processing events from SoftDevice on a single thread.
In the same way, please tell me how to receive HCI events in a single thread with the nrf connect SDK.
Hi,
Multithread support is required for BLE, unfortunately. The reason for this is the Bluetooth host implementation relies on multiple threads to operate.
Best regards,
Vidar
I will change the way the question is asked.
nrf connect SDK defines a number of BLE events (in other words, callback functions).
for example,
bt_le_scan_cb_t
bt_le_ext_adv_cb
bt_le_per_adv_sync_cb
bt_gatt_cb
bt_gatt_attr_read_func_t
bt_gatt_attr_write_func_t
I want to know how many threads are calling these.
I find it annoying to have to do lock processing every time I process a BLE event.
Most callbacks appear to be called from the System Workqueue.
HCI is the communication interface between the Bluetooth controller and host, so it is the Bluetooth host API you should be looking at.
yes. I understand It.
What I am concerned about is which thread (Context) is calling the callback when it is called back using the Bluetooth Host API.
I expect all callbacks to be called from SystemWorkq.
Was your question addressed by Amanda's reply in your other thread here: Why is ble_rx_thread priority cooperative?
No.
my question is
1. How all HCI events are called on SystemWrokq context (this thread)
2. How to set SystemWorkq priority to preemptive (other thread)
What thread/workqueue they are run in depends on your configuration settings here: https://github.com/nrfconnect/sdk-zephyr/blob/main/subsys/bluetooth/host/Kconfig#L97. You can open the thread viewer when debugging the application in VS code or Segger Ozone to confirm what thread a particular callback is run in.
E.g.
What thread/workqueue they are run in depends on your configuration settings here: https://github.com/nrfconnect/sdk-zephyr/blob/main/subsys/bluetooth/host/Kconfig#L97. You can open the thread viewer when debugging the application in VS code or Segger Ozone to confirm what thread a particular callback is run in.
E.g.