Invalid assert in btstack_hci_transport_cyw43.c #3207

Open
opened 2026-09-22 16:40:54 -05:00 by gneverov · 2 comments
gneverov commented 2026-09-22 16:40:54 -05:00 (Migrated from github.com)

github.com/raspberrypi/pico-sdk@079c6f3902/src/rp2_common/pico_cyw43_driver/btstack_hci_transport_cyw43.c (L149)

The only call stack to this function is:
btstack_run_loop_base_poll_data_sources() -> hci_transport_data_source_process() -> hci_transport_cyw43_process()

btstack_run_loop_base_poll_data_sources() and any higher code in btstack can't take the lock since btstack doesn't directly know about the cyw43 driver. In the FreeRTOS context at least, this call stack executes in the btstack task, which is not the same as the cyw43 task. So this assert always fires.

Possible solutions:

  1. Remove the assert. Downstream callees of hci_transport_cyw43_process() do already take the lock themselves.
  2. Take and release the lock in hci_transport_data_source_process().
https://github.com/raspberrypi/pico-sdk/blob/079c6f39023649b154152db30f1d781e884879bc/src/rp2_common/pico_cyw43_driver/btstack_hci_transport_cyw43.c#L149 The only call stack to this function is: btstack_run_loop_base_poll_data_sources() -> hci_transport_data_source_process() -> hci_transport_cyw43_process() btstack_run_loop_base_poll_data_sources() and any higher code in btstack can't take the lock since btstack doesn't directly know about the cyw43 driver. In the FreeRTOS context at least, this call stack executes in the btstack task, which is not the same as the cyw43 task. So this assert always fires. Possible solutions: 1. Remove the assert. Downstream callees of hci_transport_cyw43_process() do already take the lock themselves. 2. Take and release the lock in hci_transport_data_source_process().
peterharperuk commented 2026-09-23 05:22:07 -05:00 (Migrated from github.com)

this call stack executes in the btstack task, which is not the same as the cyw43 task

Are you seeing this assert firing? It probably indicates a bug if it is. How do you reproduce this?
I think you're wrong and there is no btstack task. btstack runs in the async task - the same as cyw43. btstack has to use cyw43 to send and receive hci commands.

> this call stack executes in the btstack task, which is not the same as the cyw43 task Are you seeing this assert firing? It probably indicates a bug if it is. How do you reproduce this? I think you're wrong and there is no btstack task. btstack runs in the async task - the same as cyw43. btstack has to use cyw43 to send and receive hci commands.
gneverov commented 2026-09-23 10:56:10 -05:00 (Migrated from github.com)

Oh I see. I am using btstack's FreeRTOS integration (this) instead of pico-sdk's async context. Makes sense now. Sorry for the confusion.

Oh I see. I am using btstack's FreeRTOS integration ([this](https://github.com/bluekitchen/btstack/blob/eb0bb8b5ea6d234ccb940313b47f7a5c3b4e20ec/platform/freertos/btstack_run_loop_freertos.c)) instead of pico-sdk's async context. Makes sense now. Sorry for the confusion.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#3207
No description provided.