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.
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.
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.
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.
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.
When the CLI over BLE connection is established, a black terminal window appears. You can now enter commands.
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
.
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.
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.
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.