pico-sdk: cybt: re-read transient corrupt ring index#17
Open
beriberikix wants to merge 1 commit into
Open
Conversation
cybt_get_bt_buf_index() asserts when the BT controller's bt2host / host2bt ring indices read back out of range over the gSPI backplane. The gSPI bus is shared with WiFi, so under bus contention these indices can read corrupt for a single access, turning a recoverable glitch into a full system abort. Re-read the index up to CYBT_BUF_INDEX_REREAD_MAX (8) times and, if it still does not validate, return CYBT_ERR_HCI_READ_FAILED so the caller drops the cycle instead of aborting. Reproduced on a CYW43439 (Raspberry Pi Pico 2 W) under concurrent WiFi+BT load: the assert fired at boot and under sustained traffic; with the re-read the controller recovers and BT stays up across a 2-hour zero-fault WiFi+BLE coexistence soak. Mirrors the upstream pico-sdk fix (raspberrypi#3027) as an interim Zephyr-side carry until that merges and rolls up into hal_rpi_pico. Assisted-by: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Jonathan Beri <jmberi@gmail.com>
soburi
reviewed
Jul 5, 2026
soburi
left a comment
Member
There was a problem hiding this comment.
Please also update ChangeLog.zephyr.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirrors the upstream pico-sdk fix raspberrypi#3027 into the
Zephyr
hal_rpi_picofork, so Zephyr users get it without waiting for apico-sdk roll-up.
Problem
cybt_get_bt_buf_index()reads the BT controller'shost2bt/bt2hostring indices over the gSPI backplane and
assert()s if any index is out ofrange. The gSPI bus is shared with WiFi traffic, so under bus contention a
single read can return a transiently corrupt value — and the assert then
turns a recoverable glitch into a full system abort.
Change
Re-read up to
CYBT_BUF_INDEX_REREAD_MAX(8) times — the corruption does notpersist — and only if it still does not validate return
CYBT_ERR_HCI_READ_FAILED, so the caller drops the cycle gracefully. Behaviouris unchanged on a valid read.
Testing
Reproduced on a CYW43439 (Raspberry Pi Pico 2 W) under concurrent WiFi+BT load:
the assert fired both at boot and under sustained traffic. With the re-read the
controller recovers and BT stays up across a 2-hour zero-fault WiFi+BLE
coexistence soak (
rpi_pico2/rp2350a/m33/w).Relates to RFC zephyrproject-rtos/zephyr#111811. Upstream: raspberrypi#3027.