1.. _bluetooth_shell:
2
3Shell
4#####
5
6The Bluetooth Shell is an application based on the :ref:`shell_api` module. It offer a collection of
7commands made to easily interact with the Bluetooth stack.
8
9For specific Bluetooth functionality see also the following shell documentation
10
11.. toctree::
12   :maxdepth: 1
13
14   shell/audio/bap.rst
15   shell/audio/bap_broadcast_assistant.rst
16   shell/audio/bap_scan_delegator.rst
17   shell/audio/cap.rst
18   shell/audio/ccp.rst
19   shell/audio/csip.rst
20   shell/audio/gmap.rst
21   shell/audio/mcp.rst
22   shell/audio/tmap.rst
23   shell/audio/pbp.rst
24   shell/classic/a2dp.rst
25   shell/host/gap.rst
26   shell/host/gatt.rst
27   shell/host/iso.rst
28   shell/host/l2cap.rst
29
30Bluetooth Shell Setup and Usage
31*******************************
32
33First you need to build and flash your board with the Bluetooth shell. For how to do that, see the
34:ref:`getting_started`. The Bluetooth shell itself is located in
35:zephyr_file:`tests/bluetooth/shell/`.
36
37When it's done, connect to the CLI using your favorite serial terminal application. You should see
38the following prompt:
39
40.. code-block:: console
41
42        uart:~$
43
44For more details on general usage of the shell, see :ref:`shell_api`.
45
46The first step is enabling Bluetooth. To do so, use the :code:`bt init` command. The following
47message is printed to confirm Bluetooth has been initialized.
48
49.. code-block:: console
50
51        uart:~$ bt init
52        Bluetooth initialized
53        Settings Loaded
54        [00:02:26.771,148] <inf> fs_nvs: nvs_mount: 8 Sectors of 4096 bytes
55        [00:02:26.771,148] <inf> fs_nvs: nvs_mount: alloc wra: 0, fe8
56        [00:02:26.771,179] <inf> fs_nvs: nvs_mount: data wra: 0, 0
57        [00:02:26.777,984] <inf> bt_hci_core: hci_vs_init: HW Platform: Nordic Semiconductor (0x0002)
58        [00:02:26.778,015] <inf> bt_hci_core: hci_vs_init: HW Variant: nRF52x (0x0002)
59        [00:02:26.778,045] <inf> bt_hci_core: hci_vs_init: Firmware: Standard Bluetooth controller (0x00) Version 3.2 Build 99
60        [00:02:26.778,656] <inf> bt_hci_core: bt_init: No ID address. App must call settings_load()
61        [00:02:26.794,738] <inf> bt_hci_core: bt_dev_show_info: Identity: EB:BF:36:26:42:09 (random)
62        [00:02:26.794,769] <inf> bt_hci_core: bt_dev_show_info: HCI: version 5.3 (0x0c) revision 0x0000, manufacturer 0x05f1
63        [00:02:26.794,799] <inf> bt_hci_core: bt_dev_show_info: LMP: version 5.3 (0x0c) subver 0xffff
64
65
66Logging
67*******
68
69You can configure the logging level per module at runtime. This depends on the maximum logging level
70that is compiled in. To configure, use the :code:`log` command. Here are some examples:
71
72* List the available modules and their current logging level
73
74.. code-block:: console
75
76        uart:~$ log status
77
78* Disable logging for *bt_hci_core*
79
80.. code-block:: console
81
82        uart:~$ log disable bt_hci_core
83
84* Enable error logs for *bt_att* and *bt_smp*
85
86.. code-block:: console
87
88        uart:~$ log enable err bt_att bt_smp
89
90* Disable logging for all modules
91
92.. code-block:: console
93
94        uart:~$ log disable
95
96* Enable warning logs for all modules
97
98.. code-block:: console
99
100        uart:~$ log enable wrn
101