You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bb410ab
Browse filesBrowse the repository at this point in the historyBrowse files
zephyr-cp: fix Pico 2 W BLE bring-up found on hardware
Four changes needed to get BLE actually working on a Pico 2 W, all found
by bisecting the failures over SWD.
The settings partition was 2K at 0x180800 — neither erase-sector aligned
nor large enough for one of the RP2350's 4K sectors. flash_area_get_sectors()
returned zero sectors, settings_nvs then computed its sector size from an
uninitialised struct and failed with -EDOM, so bt_enable() returned -33
before ever opening the HCI driver. That surfaced as a bare "OSError: 33"
from "import _bleio", which is where the adapter is enabled (the _bleio
module's __init__ calls common_hal_bleio_adapter_set_enabled). main has
since grown it to one aligned 4K sector at 0x17f000, which fixes the -EDOM
but is still one sector short: nvs_mount() rejects fewer than two sectors
with -EINVAL. Give settings two sectors at 0x17e000, taking the extra one
from the code partition. nvm and circuitpy stay at 0x180000 and 0x181000,
where cptools/check_partitions.py requires them to match
ports/raspberrypi, so the CIRCUITPY filesystem is not moved.
A board whose settings sectors hold content from a previous layout then
fails differently: NVS reads it as "all sectors closed" and refuses to
mount with -EDEADLK. CONFIG_NVS_INIT_BAD_MEMORY_REGION lets it reclaim a
region it does not recognise, so the first boot after a layout change
recovers on its own instead of needing a manual erase over SWD.
The CYW43439's BT controller firmware (CYW4343A2_001.003.016.0065.0000)
does not implement the Bluetooth 5 extended advertising/scanning commands.
It rejects LE Set Extended Scan Parameters (0x2041) with status 0x01
"Unknown HCI Command", so scanning failed with -EIO. The port defaults
BT_EXT_ADV on, which is right for the nRF parts but wrong here, so turn it
off for this board and let the host use the legacy 0x200B/0x200C commands.
Also raise the system workqueue stack and enable HW_STACK_PROTECTION (the
MPU turned several silent corruptions into clean, named faults while
debugging this), and enable BT HCI driver/host debug logging in
debug.conf.
Verified on hardware: patchram loads over the shared gSPI bus, the
controller reports BD_ADDR 2C:CF:67:B7:62:AC (= WiFi MAC + 1), and a scan
returns nearby advertisers by name. That run used the earlier layout with
settings at 0x181000; the 0x17e000 placement is build-tested only.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments