Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
btstack_control_raspi.h raspi: BT_REG_EN on GPIO 45 on Pi Zero W Jul 29, 2018


BTstack Port for Raspberry Pi 3 with BCM4343 Bluetooth/Wifi Controller

Tested with Raspberry Pi 3 Model B V1.2 and Raspberry Pi Zero W V1.1.

With minor fixes, the port should also work with older Raspberry Pi models that use the RedBear pHAT. See TODO at the end.

Raspberry Pi 3 / Zero W Setup

There are various options for setting up the Raspberry Pi, have a look at the Internet. Here's what we did:

Install Raspian Stretch Lite:

Configure Wifi

Create the file wpa_supplicant.conf in the root folder of the SD Card with your Wifi credentials:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

Alternatively, just plug-it in via Ethernet - unless you have a Raspberry Pi Zero W.

Enable SSH

Create an empty file called 'ssh' in the root folder of the SD Card to enable SSH.


If everything was setup correctly, it should now boot up and join your Wifi network. You can reach it via mDSN as 'raspberrypi.local'.

Disable bluez

By default, bluez will start up using the the BCM4343. To make it available to BTstack, you can disable its system services:

$ sudo systemctl disable hciuart
$ sudo systemctl disable bthelper
$ sudo systemctl disable bluetooth

and if you don't want to restart, you can stop them right away. Otherwise, please reboot here.

$ sudo systemctl stop hciuart
$ sudo systemctl stop bthelper
$ sudo systemctl stop bluetooth

If needed, they can be re-enabled later as well.


The Makefile assumes cross-compilation using the regular GCC Cross Toolchain for gnueabihf: arm-linux-gnueabihf-gcc. This should be available in your package manager. Read on for a heavy, but easy-to-use approach.

Compile using Docker

For non-Linux users, we recommend to use a Raspberry Pi Cross-Compiler in a Docker Container. Please follow the installation instructions in the README.

Then, setup a shared folder in Docker that contains the BTstack repository. Now, go to the BTstack repository and 'switch' to the Raspberry Pi Cross-Compiler container:

$ rpxc bash

The default images doesn't have a Python installation, so we manually install it:

$ sudo apt-get install python

Change to the port/raspi folder inside the BTstack repo:

$ cd btstack/port/raspi

and compile as usual:

$ make

For regular use, it makes sense to add Python permanently to the Docker container. See documentation at GitHub.

Running the examples

Copy one of the examples to the Rasperry Pi and just run them. BTstack will always power cycle the Bluetooth Controller.

pi@raspberrypi:~ $ ./le_counter
Packet Log: /tmp/hci_dump.pklg
Hardware UART without flowcontrol
Phase 1: Download firmware
Phase 2: Main app
BTstack counter 0001
BTstack up and running at B8:27:EB:27:AF:56


  • Raspberry Pi Zero W: Check if higher baud rate can be used, 3 mbps does not work.
  • Raspberry + RedBear IoT pHAT (AP6212A = BCM4343) port: IoT pHAT need to get detected and the UART configured appropriately.