The purpose of this guide is to demonstrate the use of Bluetooth Shell. Bluetooth Shell (BT Shell) is a command-line shell application that runs over the UART. It allows one to manually type in a UNIX-like shell to establish and manipulate Bluetooth connections. In this guide, we shall show how to compile, run, and establish a BT connection with a device running the nRF Connect application.
1 x nRF5340-DK1 x Android or iOS device (Android used in this example)
nRF Connect mobile applicationnRF Connect SDK (v1.8.0, at time of publishing)
CONFIG_SHELL_BACKEND_SERIAL=y
west build -b nrf5340dk_nrf5340_cpuapp_ns -p auto
west flash
bt --help
bt init
bt advertise on
bt advertise off hrs simulate on
As shown, BT Shell is a very powerful tool to enable the manipulation of Bluetooth connections. It can be modified via its prj.conf file to enable customizations. There are many options that enables one to modify the connection such as PHY choices, advertising types, etc. Furthermore, BT Shell can act as a peripheral and a central device simultaneously which allows for testing and development of Bluetooth-enabled products. Make sure to use the built-in help text to learn the various functions. Also note that there may be experimental features in the shell that are not yet implemented (such as the iso command at the time of this publishing).
I am learning this and wonder how to config UART1 as the shell uart. target board use uart1.
thanks for this, very interesting and helpful! also found another sample called shell_bt_nus, and a bit confused, are they similar? I am looking for some document to get shell_bt_nus talking, not sure where is the shell command documentation.