Smart Remote 3 nRF52 v1.2
Bluetooth Console

With Bluetooth Console, it is possible to remotely debug a device over Bluetooth Low Energy. It uses the Nordic UART Service (NUS) to communicate with the logger module running on the Smart Remote device. The logger module supports several backends: RTT, UART, and Command Line Interface (CLI).

The CLI allows for bidirectional communication with Smart Remote. The device can send log messages and you can issue commands to control the device and dynamically change its behavior.

Setup

To use the CLI on Smart Remote for nRF52810, you must compile the firmware with the CLI over BLE option enabled in the configuration header file. Due to memory size restrictions, the firmware will not compile with this option unless you disable some other features to provide enough free space in memory. See Working with Smart Remote 3 for nRF52810.
On Smart Remote nRF52832, this option is enabled by default and present in the precompiled firmware.

cli_over_ble.png
Enabling console over BLE in Keil IDE

Next, flash the firmware to Smart Remote. For instructions on how to flash the device, check Firmware upgrade via cable connection.

After flashing, pair the device with the NVS Ubuntu host.

Usage

Bluetooth Console is preinstalled and ready to use on the NVS 5.4 LiveCD Ubuntu ISO. After launching NVS Ubuntu, you can start Bluetooth Console using a desktop shortcut or from the Linux terminal, using the BluetoothConsole command.

ubuntu_desktop_icons.png
Desktop shortcuts to Bluetooth Console and Audio Probe

Bluetooth Console requires BlueZ running in experimental mode in order to access all BLE GATT characteristics. On NVS LiveCD Ubuntu, this is already set up. On other Linux systems, you must modify the file /etc/systemd/system/bluetooth.service. Find the line:

ExecStart=/usr/lib/bluetooth/bluetoothd

and add -E flag to start BlueZ in experimental mode by default.

ExecStart=/usr/lib/bluetooth/bluetoothd -E

Make sure the device is paired with the host. After launching Bluetooth Console, you can connect to a compatible device. Smart Remote devices that are paired with the host should be visible in the Select device menu.

ble_console_select_device.png
Selecting a device in Bluetooth Console

When the CLI over BLE connection is established, a black terminal window appears. You can now enter commands.

ble_console_connected.png
Active CLI over BLE connection

If the delay during typing is significant, you can make the console more responsive by disabling slave latency on the Bluetooth connection. This can be done using the command ble sl disable.

Note
Disabled slave latency comes at a cost of increased power usage.
The changes made through the console (such as BLE slave latency, logger settings) are discarded when Smart Remote goes to sleep mode.

You can easily check what commands are currently available on the Smart Remote device by pressing Tab. Autocompletion of commands is also available with the Tab key. See Logger and CLI.

ble_console_slave_latency.png
Disabling slave latency to make BLE console more responsive

When the Smart Remote goes to sleep, the Bluetooth connection becomes inactive. This is indicated to the user by striking through the device name and graying out the terminal. When the device wakes up, the terminal turns black again.

ble_console_inactive.png
Grayed out terminal after device has disconnected

It is possible to control and communicate with multiple devices at the same time. If the user selects more paired devices, each one will have its own terminal in a separate tab.

ble_console_multi.png
Multiple Smart Remote devices used simultaneously.

Documentation feedback | Developer Zone | Subscribe | Updated