3 Replies Latest reply on Jul 3, 2019 2:25 PM by DheerajP_41

    BLE Mesh '2 chip' usages

    RoBe_1502026

      Hi,

      I would like to learn how to make a ble mesh setup where you can communicate over a serial port (HCI?) to a Ble mesh device to send commands over the network to other devices. And how to receive that data to be processed.

      I see in the mesh_vender_server.c code menthion of

      <code>

      #ifdef HCI_CONTROL

      static void mesh_vendor_hci_event_send_data(wiced_bt_mesh_hci_event_t *p_hci_event, uint8_t *p_data, uint16_t data_len);

      #endif

      </code>

      and this code is curious on how to use as I believe my setup would benefit from this code>

      <code>

      *

      * In 2 chip solutions MCU can send commands to set vendor specific status.

      */

      uint32_t mesh_app_proc_rx_cmd(uint16_t opcode, uint8_t *p_data, uint32_t length)

      {

          wiced_bt_mesh_event_t *p_event;

          uint16_t dst         = p_data[0] + (p_data[1] << 8);

          uint16_t app_key_idx = p_data[2] + (p_data[3] << 8);

          uint8_t  element_idx = p_data[4];

       

       

          WICED_BT_TRACE("[%s] cmd_opcode 0x%02x\n", __FUNCTION__, opcode);

       

       

          if (opcode != HCI_CONTROL_MESH_COMMAND_VENDOR_DATA)

              return WICED_FALSE;

       

       

          p_event = wiced_bt_mesh_create_event(element_idx, MESH_VENDOR_COMPANY_ID, MESH_VENDOR_MODEL_ID, dst, app_key_idx);

          if (p_event == NULL)

          {

              WICED_BT_TRACE("app_proc_rx_cmd: no mem\n");

              return WICED_TRUE;

          }

          mesh_vendor_server_send_status(p_event, p_data + 6, length - 6);

          return WICED_TRUE;

      }

      </code>

      I feel stupid as I cant get the code to call these blocks. what am I missing. I have been programming in C for decades and am lost...

      Best Regards,

      Rob

        • 1. Re: BLE Mesh '2 chip' usages
          DheerajP_41

          All mesh devices should be provisioned and configured first to start communicating. You can use Cypress provisioners (Windows (MeshClientControl, MeshClient), Android, IOS) to do provisioning and configuring.

           

          Please follow below instructions to use vendor specific application and to send HCI commands.

          1. Download mesh_provision_client and mesh_vendor_server apps into two separate boards.
          2. Open MeshClientControl (LightControl tab) and open COMport of mesh_provision_client device.
          3. Create a network, Open it and then Scan and Provision the mesh_vendor_server app. (Please use Helper application guide: https://www.cypress.com/file/462491/download if you have doubt in the usage of helper application)
          4. Select the required provisioned device (mesh_vendor_server) from the drop down menu in MeshClientControl and use Vendor Data field to send required data to the server.
          5. You will be able to see sent messages and received the status message on the ClientControl log itself (Bottom).

           

          NOTE: Instead of using mesh_provision_client and MeshClientControl, you can use MeshClient helper application (windows mesh standalone implementation) alone to provision and communicate with a vendor specific server app.

           

          The callback function mesh_app_proc_rx_cmd()  will be used when an HCI UART command is received from the external host. This function is relevant in the case of a hosted MCU implementation. Here MeshClientControl is the host and mesh_provision_client is the controller part. You can connect MeshClientControl with mesh_provision_client and provision your vendor specific app (mesh_vendor_server).

          Also source code of all mesh helper application (MeshClientControl, MeshClient, Android, IOS) are also available along with the release (.\components\BT-SDK\common\apps\snip\mesh) so that you can customize the it.

          • 2. Re: BLE Mesh '2 chip' usages
            RoBe_1502026

            I have used the helpers apps with great success. Now I want to work on how to get data from an external controller via the HCI Uart.

            "The callback function mesh_app_proc_rx_cmd()  will be used when an HCI UART command is received from the external host."
            what is the command format when communicating with the module via the HCI Uart?
            I have looked in the getting started document and if mentions that this is how to use an external controller to communicate with the module but no more info on how.

            Is there another document that shows more?

            Best Regards,

            Rob

             

             

             

            • 3. Re: BLE Mesh '2 chip' usages
              DheerajP_41

              Hi Robert,

               

              I believe, we have discussed this in detail in BLE Mesh 2 way communication thread.

               

              If you want to use WICED HCI UART you can use sample "MCU" application which is MeshClientControl  (common\apps\snip\mesh\ClientControl). All the source code is there and release directory has the binary that you can use. There will be also a document (MeshClient and ClientControlMesh App User Guide) in the doc directory. 

              In the ModusToolbox click on the Documentation tab, the WICED API Reference then WICED HCI Control Protocol, and please search wiced_bt_mesh_app.h for getting mesh_app_proc_rx_cmd definition.

               

              Thanks,

              -Dheeraj