Skip to content

Commit 399dee9

Browse files
tyethclaude
andcommitted
zephyr-cp: enable BLE on the Raspberry Pi Pico 2 W
The CYW43439's Bluetooth controller shares the WiFi gSPI bus rather than sitting on a UART, so it needs the new shared-bus HCI driver (see the companion zephyr branch). With a bt_hci device in the devicetree, the port's existing Kconfig turns CONFIG_BT on by itself and common-hal _bleio needs no board-specific work. Wire it up for the Pico 2 W: - board overlay: add the infineon,cyw43-bt-hci node as a child of the stock infineon,airoc-wifi node, and point zephyr,bt-hci at it. The hyphenated chosen name matters — the port's Kconfig derives CONFIG_BT via dt_chosen_enabled(zephyr,bt-hci). - board conf: deeper system workqueue stack and HW stack protection, as the WHD WiFi, cybt and coexistence call chains are deeper than the port defaults. - compat2driver: map infineon_cyw43_bt_hci to bluetooth/hci, which is what makes zephyr2cp.py set _bleio. Added by hand rather than regenerating the file, which would churn 500+ unrelated lines against the current Zephyr revision. Builds at 67.1% flash and 43.4% RAM, up from 59.7%/38.0% without BLE. Not hardware-tested. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent b4709a2 commit 399dee9

4 files changed

Lines changed: 32 additions & 1 deletion

File tree

ports/zephyr-cp/boards/raspberrypi/rpi_pico2_w_zephyr/autogen_board_info.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "Raspberry Pi Foundation Raspberry Pi Pico 2"
33

44
[modules]
55
__future__ = true
6-
_bleio = false
6+
_bleio = true # Zephyr board has _bleio
77
_eve = false
88
_pew = false
99
_pixelmap = false

ports/zephyr-cp/boards/rpi_pico2_rp2350a_m33_w.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,12 @@ CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
1818
CONFIG_MBEDTLS_CIPHERSUITE_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256=y
1919
CONFIG_MBEDTLS_ENTROPY_C=y
2020
CONFIG_MBEDTLS_CTR_DRBG_C=y
21+
22+
# Bluetooth over the shared gSPI bus (CONFIG_BT itself comes from the
23+
# zephyr,bt-hci chosen node in the overlay).
24+
#
25+
# The WHD WiFi, cybt BT and coexistence call chains are deeper than the
26+
# defaults in ../prj.conf; the Cortex-M33 MPU catches an overflow cleanly
27+
# instead of silently corrupting neighbouring stacks.
28+
CONFIG_HW_STACK_PROTECTION=y
29+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

ports/zephyr-cp/boards/rpi_pico2_rp2350a_m33_w.overlay

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,25 @@
3030
};
3131
};
3232

33+
/*
34+
* Bluetooth. The CYW43439's HCI is not on a UART here — it shares the WiFi
35+
* gSPI bus — so hang the shared-bus HCI transport off the board's stock
36+
* infineon,airoc-wifi node and point the host at it. CONFIG_BT then turns
37+
* itself on via the zephyr,bt-hci chosen (see ../../Kconfig).
38+
*/
39+
&pio0_spi0 {
40+
airoc-wifi@0 {
41+
cyw43_bt_hci: cyw43_bt_hci {
42+
compatible = "infineon,cyw43-bt-hci";
43+
status = "okay";
44+
};
45+
};
46+
};
47+
48+
/ {
49+
chosen {
50+
zephyr,bt-hci = &cyw43_bt_hci;
51+
};
52+
};
53+
3354
#include "../app.overlay"

ports/zephyr-cp/cptools/compat2driver.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
"infineon_bless_hci": "bluetooth/hci",
167167
"infineon_bt_hci_uart": "bluetooth/hci",
168168
"infineon_cyw208xx_hci": "bluetooth/hci",
169+
"infineon_cyw43_bt_hci": "bluetooth/hci",
169170
"nxp_bt_hci_uart": "bluetooth/hci",
170171
"nxp_hci_ble": "bluetooth/hci",
171172
"renesas_bt_hci_da1453x": "bluetooth/hci",

0 commit comments

Comments
 (0)