This project exposes the Raspberry Pi Pico W's Bluetooth Controller HCI
interface via USB CDC. This allows using the Pico W as UART HCI dongle, for
example, with hciattach on Linux.
Because we wanted to use the Pico W's Bluetooth controller. You could also just buy another dongle with an Infineon/Cypress/Broadcom chip (like this one). But why buy something if you can build it with stuff you already have.
More on that in our blogpost.
- Install the Pico SDK
- Build the project.
git clone https://github.com/auracast-research/pico-uart-hci.git
cd pico-uart-hci
mkdir build
cd build
cmake -DPICO_BOARD=pico_w ..
make- Flash the
uf2file the Pico W. - Attach the Pico as Bluetooth controller (Linux).
# start bluetooth if it's not running
sudo systemctl start bluetooth
# attach the HCI UART
sudo hciattach /dev/ttyACM0 any
# list HCI devices
hciconfig
hci0: Type: Primary Bus: UART
BD Address: 28:CD:C1:XX:XX:XX ACL MTU: 1021:8 SCO MTU: 64:10
DOWN RUNNING
RX bytes:722 acl:0 sco:0 events:40 errors:0
TX bytes:438 acl:0 sco:0 commands:40 errors:0
# power on device
sudo hciconfig hci0 upNow you can use the Pico as Bluetooth controller. For example with
bluetoothctl
$ bluetoothctl
Agent registered
[bluetoothctl]> power on
Changing power on succeeded
S[bluetoothctl]> scan on
SetDiscoveryFilter success
Discovery started
[CHG] Controller 28:CD:C1:XX:XX:XX Discovering: yes
[NEW] Device XX:XX:XX:XX:XX:XX XX-XX-XX-XX-XX-XX
[...]By default, debug logging via a second CDC interface is enabled. If you wish to
deactivate it, set HCI_DEBUG_LOG to 0 in the
CMakeLists.txt file.
HCI and ACL work well, but SCO currently does not work. More details about the issue can be found in the pico-sdk repo. Apparently, this is a combination of an issue with the controller firmware, and the way the controller is wired to the Pico SoC. By default, the controller routes audio via I2S, which is not connected on the Pico, and routing it over HCI does not seem to work at the moment.