Hi,
I have a question regarding BluetoothLEHost_Init() in the KW47 SDK.
My application is running on FreeRTOS, and several tasks are created in advance using xTaskCreateStatic().
After creating these tasks, I call BluetoothLEHost_Init() to initialize BLE. While stepping through the SDK, I observed that during communication with the NBU, the initialization process waits for inter-task events. As a result, other lower-priority tasks are scheduled and start running while BluetoothLEHost_Init() is still executing and before the function call itself returns.
To clarify, I am not referring to the host initialization completion callback provided to BluetoothLEHost_Init(). I do not need to wait for that callback.
My concern is that task switching occurs before BluetoothLEHost_Init() returns. I would like to prevent other application tasks from running until the BluetoothLEHost_Init() function call itself has returned.
My questions are:
・Is there any configuration, API, or recommended method to prevent task switching while BluetoothLEHost_Init() is executing (for example, while waiting for NBU communication)?
・Is there a way to ensure that BluetoothLEHost_Init() completes and returns without yielding execution to other tasks?
・If such a method exists, could you please provide guidance or an example of the recommended approach?
My goal is to ensure that no application tasks begin their normal processing until BluetoothLEHost_Init() has returned.
Any advice would be greatly appreciated.
Hi @t_hosomi, hope you are doing well.
You can hold the execution of other tasks with different FreeRTOS approaches as explained below:
For both options I'd suggest referring to the FreeRTOS Reference Manual and for the second option, you may refer to the "freertos_event_cm33_core0" example from the SDK as it demonstrates how to create event groups and set tasks to wait for events.
Please let me know if the information helps cover your requirements.