Bluetooth: External radio coexistence using 1-wire interface

This sample demonstrates how to use the 1-wire coexistence feature described in Generic one-wire coexistence.

Requirements

The sample supports the following development kit:

Hardware platforms

PCA

Board name

Board target

nRF54L15 DK

PCA10156

nrf54l15dk

nrf54l15dk/nrf54l15/cpuapp

nRF54H20 DK

PCA10175

nrf54h20dk

nrf54h20dk/nrf54h20/cpurad

nRF52840 DK

PCA10056

nrf52840dk

nrf52840dk/nrf52840

Overview

The application sets up an advertiser and configures the 1-wire coexistence feature. Enter g to grant or d to deny Bluetooth radio activity.

  • When Bluetooth radio activity is granted, packets are transmitted.

  • When Bluetooth radio activity is denied, no packets are transmitted.

  • The number of packets transmitted is tracked by counting the RADIO->READY event.

  • The total number of transmitted packets is printed every second.

Wiring

The application generates a grant signal on the pin selected by coex-pta-grant-gpios. Connect this pin to the pin defined by the grant-gpios property in the DTS using a jumper cable.

The following table shows the default pins used for this sample for each supported target:

Target

coex-pta-grant-gpios

grant-gpios

nrf52840dk/nrf52840

P0.26

P0.02

nrf54l15dk/nrf54l15/cpuapp

P0.00

P0.02

nrf54h20dk/nrf54h20/cpurad

P0.00

P0.02

The board’s /zephyr,user node must have the coex-pta-grant-gpios property set in the devicetree. You can use this sample’s board overlay as an example.

Note

For the nrf54h20dk/nrf54h20/cpurad target in the board’s devicetree file, you must define a node with the compatible property set to coex-pta-grant-gpios. Then set the coex-pta-grant-gpios property of that node to the desired pin. This is needed to properly configure the UICR register and get a pin access from the core the application is running on. See the boards/nrf54h20dk_nrf54h20_cpurad.overlay file for an example.

Building and running

This sample can be found under samples/bluetooth/radio_coex_1wire in the nRF Connect SDK folder structure.

To build the sample, follow the instructions in Building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.

Note

When building repository applications in the SDK repositories, building with sysbuild is enabled by default. If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild parameter to every build command or configure west to always use it.

Testing

After programming the sample to your development kit, complete the following steps to test it:

  1. Build and program the development kit.

  2. Connect to the kit with a terminal emulator (for example, nRF Connect Serial Terminal). See Testing and optimization for the required settings and steps.

  3. Observe the number of packets transmitted.

  4. Enter d to deny packet transmission.

  5. Observe that packet transmissions have stopped.

  6. Enter g to grant packet transmission.

  7. Observe that packet transmissions have restarted.

Dependencies

This sample uses the following sdk-nrfxlib libraries:

It also uses drivers from the nrfx libraries.

It uses the following Zephyr libraries:

  • include/console/console.h

  • API