7 Replies Latest reply on May 19, 2020 10:52 AM by DheerajP_41

    How can I send messages between 3 CYBT-213043-MESH devices?


      How can I send messages between 3 CYBT-213043-MESH devices?



      the picture shows the application



      The CYBT-213043-MESH = B1 plate sends the message Hello world to the CYBT-213043-MESH = B2



      The CYBT-213043-MES = B2 plate sends the same message Hello world of the variable to the CYBT-213043MESH = B3 board



      how can I do this?

      What examples can I use on each board?


        • 1. Re: How can I send messages between 3 CYBT-213043-MESH devices?



          BLE Mesh generally works on publish - subscribe paradigm. A Mesh node broadcast the message, so that all the nodes in direct range with the transmitting node can see the message. But all these nodes cannot parse the payload and read it's info, instead it can just check the keys associated to the packet  (network key, application key, device key) to understand where the packet should go. If these keys are not matching, then the node which receives the packet will simply relay (retransmitted) the message. In this way the message can be received by a node which is not in direct range with the node which sent the message.


          If you wanted to implement a custom model (other than standard model defined by SIG), you can use vendor_specific_app (under mesh snip category).


          I would suggest you to go through below documents to understand basic working and architecture of BLE mesh.

          App Note: https://www.cypress.com/file/473921/download

          Lab Manual: GitHub - cypresssemiconductorco/CypressAcademy_WBT101_Files: Files for WICED Bluetooth 101 class




          • 2. Re: How can I send messages between 3 CYBT-213043-MESH devices?

            The CYBT-213043-MESH = A uses the code mesh_privision_client

            and sends the message helloworld1 to the cards CYBT-213043-MESH = B AND CYBT-213043-MESH = C, This example already works


            CYBT-213043-MESH = B and CYBT-213043-MESH = C boards use the example code mesh_vendor_specific_app


            but i want this

            I want CYBT-213043-MESH = B AND CYBT-213043-MESH = C boads reply or send a message hello world2 or another message to CYBT-213043-MESH = A


            please help me


            this pictour shows the aplication


            • 3. Re: How can I send messages between 3 CYBT-213043-MESH devices?



              Please see the mesh_vendor_specific_app.c.

              All valid mesh messages will be handles by mesh_vendor_server_message_handler  and processed in mesh_vendor_server_process_data.

              Below lines is to create a mesh reply event from the received mesh event and send it to the originating node. (Note, This application returns the data that it received in the command plus TTL value).


              memcpy(p_buffer, p_data, data_len);      //copying the data

              p_buffer[data_len] = (uint8_t)p_event->ttl;     // updating the ttl value

              mesh_vendor_server_send_data(wiced_bt_mesh_create_reply_event(p_event), MESH_VENDOR_OPCODE2, p_buffer, data_len +1); //sending a mesh reply message.


              if you want, you can modify the data processing logic and send any message by creating a mesh event using wiced_bt_mesh_create_event (instead of using wiced_bt_mesh_create_reply_event). Please have a look wiced_bt_mesh_event.h




              2 of 2 people found this helpful
              • 4. Re: How can I send messages between 3 CYBT-213043-MESH devices?

                Thank you

                I sent this message ("12345678") with a board with the code: Mesh_Snip_213043MESH.mesh_provision_client / mesh_vendor_client.c:

                SEND DAATA.PNG


                In the code Mesh_Snip_213043MESH.mesh_vendor_specific_app with the lines

                I can send the data received("12345678") to the UART port as shown in the lines:


                void mesh_vendor_server_process_data(wiced_bt_mesh_event_t *p_event, uint8_t *p_data, uint16_t data_len)


                    uint8_t *p_buffer = NULL;

                    wiced_bt_mesh_event_t * p_reply_event = NULL;

                #if defined HCI_CONTROL

                    wiced_bt_mesh_hci_event_t *p_hci_event;


                    WICED_BT_TRACE("Data to UART:%B" , data_len);//I can send the data received("12345678") to the UART

                    WICED_BT_TRACE("vs process data from:%04x reply:%04x len:%d\n", p_event->src, p_event->reply, data_len);

                data to uart.PNG


                And now I know that this line sends the message received ("12345678") to another board with the code Mesh_Snip_213043MESH.mesh_provision_client / mesh_vendor_client.c:


                mesh_vendor_server_send_data(p_reply_event, MESH_VENDOR_OPCODE2, p_buffer, data_len +1);

                            wiced_bt_free_buffer( p_buffer );




                But I cannot send a received reply message to the UART port in the code Mesh_Snip_213043MESH.mesh_provision_client / mesh_vendor_client.c:


                I tried to send the received data to the uart port, but these lines of the code do not send it to the uart port as a message ( "12345678"):


                extern wiced_bool_t mesh_vendor_client_message_handler(wiced_bt_mesh_event_t *p_event, uint8_t *p_data, uint16_t data_len);


                void mesh_vendor_client_process_data(wiced_bt_mesh_event_t *p_event, uint8_t *p_data, uint16_t data_len)


                #if defined HCI_CONTROL

                    wiced_bt_mesh_hci_event_t *p_hci_event;

                    uint32_t elapsed_time_ms = 0;

                    uint8_t *p_buffer = NULL;

                    uint8_t *p = NULL;


                    WICED_BT_TRACE("Data answered to UART:%B", data_len);

                    WICED_BT_TRACE("vs process data from:%04x opcode: %x len:%d\n", p_event->src, p_event->opcode, data_len);




                Can you tell me how can i send the message or response data received to port uart in the code Mesh_Snip_213043MESH.mesh_provision_client / mesh_vendor_client.c:?

                • 5. Re: How can I send messages between 3 CYBT-213043-MESH devices?



                  Below line sends a reply message to provision_client app. (Since the message came from it).

                  mesh_vendor_server_send_data(p_reply_event, MESH_VENDOR_OPCODE2, p_buffer, data_len +1);


                  Do you want to print the message on PUART? or on ClientControl (which uses the HCI UART)?


                  mesh_vendor_hci_event_send_data is used to send the received vendor data to the transport. (routed to clientcontrol).

                  mesh_vendor_client_message_handler is used to print the message PUART message.

                  I believe both are handled in the existing code.




                  1 of 2 people found this helpful
                  • 6. Re: How can I send messages between 3 CYBT-213043-MESH devices?

                    n the board with code Mesh_Snip_213043MESH.mesh_vendor_specific_app I can print in WICED Peripheral UART the message sent by provision_client app as shown in the image

                    I added the line: WICED_BT_TRACE ("Dato:% B \ n", p_data);





                    I want to print the reply message in WICED Peripheral UART on the card with the code provision_client app



                    I added the line: WICED_BT_TRACE ("Reply message:% B \ n", p_data);

                    in the function: wiced_bool_t mesh_vendor_client_message_handler (wiced_bt_mesh_event_t * p_event, uint8_t * p_data, uint16_t data_len)



                    but the reply message does not print correctly: ("123456789101")



                    the image shows the code and the message in the terminal

                    in the terminal it shows the message ( "00 04 20 00 c1 03"):


                    Reply message: 00 04 20 00 c1 03

                    mesh_vendor_client_message_handler: company_id: 0131 opcode: 2 model_id: ffff





                    You can check, the reply massage does not enter the function: void mesh_vendor_client_process_data in the board with the code provision_client app




                    help me

                    in my work we want to buy 3000 CYBT-213043-MESH but because we cannot solve this problem we cannot buy