btstack/port/zephyr
2023-08-10 21:30:22 +02:00
..
src port/zephyr: nrf51/52/53 support, fix for latest zephyr 2023-08-10 21:01:17 +02:00
.gitignore
btstack_config.h
CMakeLists.txt port/zephyr: nrf51/52/53 support, fix for latest zephyr 2023-08-10 21:01:17 +02:00
env.sh zephyr: default to ~/zephyrproject 2023-06-20 14:49:23 +02:00
prj.conf port/zephyr: nrf51/52/53 support, fix for latest zephyr 2023-08-10 21:01:17 +02:00
README.md port/zephyr: update README.md 2023-08-10 21:30:22 +02:00
sample.yaml

BTstack Port for Zephyr RTOS

Overview

This port targets any platform supported by Zephyr that either contains a built-in Bluetooth Controller or is connected to an external Controller via one of the supported Zephyr HCI Transports drivers (see zephyr/drivers/bluetooth/hci)

Status

Tested with nRF52 DK (PCA10040), nRF52840 DK (PC10056) and nRF5340 DK (PCA10095) boards only. It uses the fixed static random BD ADDR stored in NRF_FICR/NRF_FICR_S, which will not compile on non nRF SoCs.

Build Environment

The first step needs to done once. Step two is needed every time to setup the environment.

1. Build Environment Preconditions

Follow the getting started guide until you are able to build an example.

Then update the ZEPHYR_ROOT variable in env.sh to point to your zephyrproject. Defaults to ~/zephyrproject

2. Prepare the build environmet

To setup your environment to build a BTstack example, run the provided setup in env.sh.

source env.sh

Building and Running on nRF52840

3. Build Example

You can build an example using:

west build -b nrf52840dk_nrf52840

nrf52840dk_nrf52840 selected the Nordic nRF52840 DK. For the older nRF52 DK with nRF52832, you can specify nrf52dk_nrf52832. To get a list of all supported Zephyr targets, run west boards

To change zephyr platform settings use:

west build -b nrf52840dk_nrf52840 -t menuconfig

To build a different example, e.g. the gatt_streamer_server, set the EXAMPLE environment variable:

EXAMPLE=gatt_streamer_server west build -b nrf52840dk_nrf52840

4. Flash Example

To flash a connected board:

west flash

Buiding and Running on nRF5340

The nrf5340 is a dual core SOC, where one core is used for Bluetooth HCI functionality and the other for the high level application logic. So both cores need to be programmed separately. Using the nRF5340-DK for example allowes debug output on both cores to separate UART ports.

Building the application

build using:

west build -b nrf5340dk_nrf5340_cpuapp

with debug:

west build -b nrf5340dk_nrf5340_cpuapp -- -DOVERLAY_CONFIG=debug_overlay.conf

Using zephyr network core image

the hci_rgmsg application needs to be loaded first to the network core

west build -b nrf5340dk_nrf5340_cpunet
west flash

Using Packetcraft binary network core image

for nrf5340 the latest netcore firmware is located at sdk-nrf to program it:

nrfjprog --program ble5-ctr-rpmsg_<version number>.hex --chiperase --coprocessor CP_NETWORK -r

TODO

  • Allow/document use of Zephyr HCI Drivers