TI Bluetooth Mesh Host PC Tool

This section describes the functionality of the Bluetooth Mesh Host PC Tool features and provides a list of APIs eRPC uses to interface with Bluetooth Mesh.

Overview

The PC host application is a Python based tool created using the Embedded Remote Procedure Call (eRPC) system which is an open source Remote Procedure Call system. This application acts as the host processor with the goal of providing the option of getting started and performing the operations of the BLE Mesh examples.

Running Bluetooth Mesh Host PC Tool

This section covers the required libraries and installations prior to running the Host PC tool. In addition, it covers the steps on how to get the Host PC tool running on a PC.

Installation

  1. Install Python version 3.7.6.
    1. Download Python installer from: https://www.python.org/downloads/release/python-376/

    Note

    Utilize the Windows x86-64 executable installer.

  2. Install eRPC.
    1. Navigate to <SDK_ROOT>/source/third_party/erpc/erpc_python

    2. Install Python library enum34 using the following command:

      pip install enum34

    3. Install Python library pyserial using the following command:

      pip install pyserial

    4. Install the eRPC packages by using the following command:

      python setup.py install

Running Tool

  1. Navigate to the location of the Host PC tool at <SDK_ROOT>/examples/rtos/ CC26X2R1_LAUNCHXL/ble5stack/mesh_app_python.

  2. Run the ble_mesh_erpc_app script.

    1. Open up a terminal such as Git Bash.

    2. Run the ble_mesh_erpc_app script using the following command:

      python ble_mesh_erpc_app.py

    3. At this moment, if not already running, flash a CC26x2 device with the simple_mesh_node example project. Ensure that simple_mesh_node is compiled with “Network Processor Mode” enabled in SysConfig as seen in Figure 146. in order to work with the host.

      ../_images/ble_mesh_erpc_enable_nwp_syscfg.png

      Figure 146. Enabling Network Processor Mode in SysConfig

    4. Determine the COM port the simple_mesh_node device is connected to. Enter the COM port when prompted as seen in Figure 147.

      ../_images/ble_mesh_erpc_com_port.png

      Figure 147. Providing Device COM Port

    Note

    When entering the device serial port name, include the phrase “COM”. For example, for a simple_mesh_node device connected to COM port 13, enter “COM13”.

    1. Utilize the command menu seen in Figure 148. to select the proper commands needed.

      ../_images/ble_mesh_erpc_command_menu.png

      Figure 148. Host PC Tool Command Menu

Using Menu Commands

The commands should be run in the following order upon start-up to function successfully:

  1. Run one of the following menu commands to initialize Mesh:

    • Mesh init and unprovisioned beacon
    • Mesh init and static provisioning
    • Mesh init and load from NV

Only one of these commands needs to be called when initializing Mesh. Each command should be called in different scenarios. The Mesh init and unprovisioned beacon command should be used when the purpose is to initialize the Mesh data and start advertising unprovisioned beacon. The Mesh init and static provisioning command should be used when the purpose is to initialize Mesh data and perform static provisioning. Finally, the Mesh init and load from NV should be used when the purpose is to initialize the Mesh data and load previous provisioning data from NV. For instance, if the device reset after povisioning, this command should be used to return to a provisioned state without performing the provisioning process again.

Host PC Tool APIs

This section describes the APIs available on the Host PC Tool and the mapping of the APIs to the ones provided on the Bluetooth Mesh project. Upon the Host PC Tool startup and connecting to the correct device serial port, the following menu Figure 148. will appear in the terminal. Table 28. details these command descriptions.

Table 28. eRPC Commands and Bluetooth API Mapping
Command API Description Bluetooth API Mapping
Mesh init and unprovisioned beacon Initialize Mesh data and call mesh_prov_enable to enable specific provisioning bearers bt_mesh_prov_raw_init bt_mesh_init_comp_raw_init bt_mesh_init_elem_raw_init bt_mesh_cfg_srv_raw_init bt_mesh_health_srv_raw_init bt_mesh_init_model_raw_init bt_mesh_init bt_mesh_prov_enable
Mesh Init and static provisioning Initialize Mesh data and do static provisioning bt_mesh_prov_raw_init bt_mesh_init_comp_raw_init bt_mesh_init_elem_raw_init bt_mesh_cfg_srv_raw_init bt_mesh_cfg_cli_raw_init bt_mesh_health_srv_raw_init bt_mesh_init_model_raw_init bt_mesh_init bt_mesh_provision
Mesh Init and load from NV Initialize the Mesh data and load from NV bt_mesh_prov_raw_init bt_mesh_init_comp_raw_init bt_mesh_init_elem_raw_init bt_mesh_cfg_srv_raw_init bt_mesh_health_srv_raw_init bt_mesh_init_model_raw_init bt_mesh_init settings_load
Mesh load provisioning information from NV Call the Zephyr settings module load API settings_load settings_load
Mesh is provisioned Check if the local node has been provisioned by calling bt_mesh_is_provisioned bt_mesh_is_provisioned
Mesh Prov Enable Enable specific porivisoning bearers by calling bt_mesh_prov_enable ADV and GATT bearers. bt_mesh_prov_enable
Mesh Reset Reset the state of the local Mesh node by calling bt_mesh_reset bt_mesh_reset
Mesh Generic OnOff Client Menu Initialize and start the generic on/off client Menu Screen This command opens additional menu. For Bluetooth API mapping, please see the Generic OnOff Menu Commands and Bluetooth APIs table
Mesh VND Model Menu Initialize and start the VND model example Menu Screen This command opens additional menu. For Bluetooth API mapping, please see the VND Menu Commands and Bluetooth APIs table
Mesh find model index Find a SIG model in a specific element bt_mesh_model_find
Mesh find vnd model index Find a VND model in a specific element bt_mesh_model_find_vnd
Mesh LPN set Toggle the Low Power feature of the local device bt_mesh_lpn_set
Mesh LPN poll Send out a Friend Poll message bt_mesh_lpn_poll
Mesh PROXY Identity enable Enable advertising with Node Identity bt_mesh_proxy_identity_enable
Generate Fault on Health server (for testing only) Used for adding a new fault to the fault array of the health server model, only used for testing purposes bt_mesh_fault_update
Quit Exit menu application  

Figure 149. will appear when choosing command 8. Mesh Generic OnOff Client Menu on the main menu. Table 29. details the these command descriptions.

../_images/ble_mesh_erpc_gen_onoff_menu.png

Figure 149. Host PC Tool Generic OnOff Command Sub-Menu

Table 29. Generic OnOff Menu Commands and Bluetooth APIs
Command API Description Bluetooth API Mapping
Mesh Generic OnOff Client get msg Get Gen OnOff State bt_mesh_model_send_data
Mesh Generic OnOff Client set msg Set Gen OnOff State bt_mesh_model_send_data
Mesh Generic OnOff Client set msg with transition Set Gen OnOff State with Transition bt_mesh_model_send_data
Mesh Generic OnOff Client set unack msg Set Gen OnOff Unacknowledged State bt_mesh_model_send_data
Mesh Generic OnOff Client set unack msg with transition Set Gen OnOff Unacknowledged State with Transition bt_mesh_model_send_data
Back Return to upper menu screen  

Figure 150. will appear when choosing command 9. Mesh VND Model Menu. Table 30. details the these command descriptions.

../_images/ble_mesh_erpc_vnd_menu.png

Figure 150. Host PC Tool Generic OnOff Command Sub-Menu

Table 30. VND Menu Commands and Bluetooth APIs
Command API Description Bluetooth API Mapping
Mesh VND LED ON Call VND Model API led_on led_on
Mesh VND LED OFF Call VND Model API led_off led_off
Mesh VND Notify LED Status Call VND Model API notify_led_status notify_led_status
Mesh VND Get LED Status Call VND Model API get_led_status get_led_status
Back Return to upper menu screen