Skip to content

pico-sdk: cybt: re-read transient corrupt ring index#17

Open
beriberikix wants to merge 1 commit into
zephyrproject-rtos:zephyrfrom
beriberikix:cybt-reread-hal-rpi-pico
Open

pico-sdk: cybt: re-read transient corrupt ring index#17
beriberikix wants to merge 1 commit into
zephyrproject-rtos:zephyrfrom
beriberikix:cybt-reread-hal-rpi-pico

Conversation

@beriberikix

Copy link
Copy Markdown

Mirrors the upstream pico-sdk fix raspberrypi#3027 into the
Zephyr hal_rpi_pico fork, so Zephyr users get it without waiting for a
pico-sdk roll-up.

Problem

cybt_get_bt_buf_index() reads the BT controller's host2bt / bt2host
ring indices over the gSPI backplane and assert()s if any index is out of
range. 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 not
persist — and only if it still does not validate return
CYBT_ERR_HCI_READ_FAILED, so the caller drops the cycle gracefully. Behaviour
is 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.

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 soburi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update ChangeLog.zephyr.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants