Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLE start routine freezes when the event_queue dispatching inside mbed-os-ble-utils moved to a thread #15482

Closed
16L-YT opened this issue Jan 4, 2024 · 1 comment

Comments

@16L-YT
Copy link
Contributor

16L-YT commented Jan 4, 2024

Description of defect

I'm using mbed-os-ble-utils for our BLE-enabled device. In this library the BLEProcess class has the start API to strart advertising. I tried to fork the library and make the _event_queue.dispatch_forever(); (line) inside a thread to avoid blocking the code I will execute at startup after starting the BLE advertisements .

        thread.start([this] {_event_queue.dispatch_forever();});

However the BLE stuck at

[DBG ][BLE ]: Cordio HCI reset started

I even tried to increase the priority of that thread to the highest osPriorityRealtime7 with no effect.

Note:
No extra debugging messages, even if the BLE logs are enabled:

            "cordio.trace-hci-packets": false,
            "cordio.trace-cordio-wsf-traces": true,
            "ble.trace-human-readable-enums": true,

Is there a clear reason why ?

Target(s) affected by this defect ?

AMA3B1KK-KBR-B0

Toolchain(s) (name and version) displaying this defect ?

gcc version 10.2.1 20201103 (release) (xPack GNU Arm Embedded GCC, 64-bit)

What version of Mbed-os are you using (tag or sha) ?

mbed-os-6.9.0

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

mbed-tools 7.59.0

How is this defect reproduced ?

Following the mentioned steps in the defect description.

@16L-YT 16L-YT changed the title BLE start routine get freeze when the event_queue dispatching inside mbed-os-ble-utils moved to a thread BLE start routine freezes when the event_queue dispatching inside mbed-os-ble-utils moved to a thread Jan 4, 2024
@16L-YT 16L-YT closed this as completed Jan 5, 2024
@yahyatawil
Copy link

yahyatawil commented Feb 15, 2024

It seems the Bluetooth APIs are not thread-safe according to #14558.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Untriaged
Status: Done
Development

No branches or pull requests

3 participants