Bluetooth: NUS shell transport

The Nordic UART Service (NUS) shell transport sample demonstrates how to use the Nordic UART Service (NUS) shell transport to receive shell commands from a remote device.

Overview

When the connection is established, you can connect to the sample through the Nordic UART Service (NUS) by using a host application. You can then send shell commands that are executed on the device that runs the sample, and see the logs. See Sending shell commands for more information about the host tools that are available in nRF Connect SDK for communicating with the sample.

Requirements

  • One of the following development boards:

  • A second nRF52 Development Kit board (PCA10040) for connecting with bt_nus_shell.py. Alternatively, you can use BLE Console for connecting (Linux only).

Building and running

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

See Building and programming a sample application for information about how to build and program the application.

Testing

After programming the sample to your board, test it by connecting to it and sending some shell commands.

Perform the following steps to use the bt_nus_shell.py script:

  1. Connect a Nordic Development Kit (for example, PCA10040) to your PC.

  2. Start the bt_nus_shell.py script with the correct parameters, for example:

    bt_nus_shell.py --snr 680834186 --name BT_NUS_shell --com COM115 --family NRF52
    
  3. Open a terminal, for example PuTTY. Set the Connection Type to Raw and the Destination Address to 127.0.0.1:8889.

  4. Press Enter in the terminal. A console prompt is displayed.

  5. Enter the commands that you want to execute on the remote shell.

Alternatively, use the BLE Console for testing.

Dependencies

This sample uses the following nRF Connect SDK libraries:

In addition, it uses the following Zephyr libraries:

  • Bluetooth:

    • include/bluetooth/bluetooth.h

    • include/bluetooth/hci.h

    • include/bluetooth/uuid.h

    • include/bluetooth/gatt.h

    • samples/bluetooth/gatt/bas.h

  • Logging