This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

sending ASCII bytes through Mesh between a nrf52840 development kit and two dongle

Hello everyone,

I am new and tried some example on the nrf52840 devkit and dongle, including light switch example. 

I am now going to send some ASCII bytes through the mesh between three boards and receive a verification message in the client side.

Actually I thought this is done by adding  sent and receive functions in the switch light example (server and client) inside the main.c. But after searching the devzone I was completely confused.

I read these discussions but I could not modify the code correctly.

https://devzone.nordicsemi.com/f/nordic-q-a/29836/send-and-receive-a-string-via-access-layer

https://devzone.nordicsemi.com/f/nordic-q-a/31256/receiving-simple-message-mesh/123576

https://devzone.nordicsemi.com/f/nordic-q-a/39629/how-to-send-data-to-all-node-over-mesh

https://devzone.nordicsemi.com/f/nordic-q-a/47611/sending-data-over-the-mesh-network

https://devzone.nordicsemi.com/f/nordic-q-a/46092/send-string-in-a-mesh-with-nrf52dk/

I have error on 

simple_message_OPCODE_SEND
and
the address_set function
and also in the server side:
status= access_model_publish(m_server.model_handle, &msg);

I think there are some different in the new version of the nRF52 SDK for mesh V.5 I used.

Could you please help me on this topic.

Thank you,

Sama

Parents
  • Hi, 

    There have been made a lot of changes and improvements from Mesh SDK v1.0.0 to v5.0.0. Unfortunately, we don't have any official examples for sending strings over mesh. The links you are referring to is a great starting point and gives you an idea of how you can do this. 

    When it comes to the error you get, can you get more details? What function gives which errors? What kinda error do you get? Can you provide some debug logs?

  • Hi,

    Have you had any progress with this? 

    You should put the send_my_message() function outside the button_event_handler(). And the void address_set(uint16_t addr) can be added to main.c.

    Additional you should add these static variables and include as well in your main.c:

    #include "simple_message_common.h"
    #include "simple_on_off_server.h"
    
    static simple_on_off_server_t m_server;
    
    static dsm_handle_t m_central_handle;

    Thanks for your patience.

  • Hi,

    Thank you for your reply.

    I tested that again, and it seems that the error is related to the invalid status in ERROR_CHECK(status);

    Here is the log and line that returned the error.


    <t: 0>, main.c, 431, ----- BLE Mesh Light Switch Client Demo -----
    <t: 12585>, main.c, 390, Initializing and adding models
    <t: 17486>, mesh_app_utils.c, 66, Device UUID (raw): 137FF47B11294702B381A62F60654E45
    <t: 17489>, mesh_app_utils.c, 67, Device UUID : 137FF47B-1129-4702-B381-A62F60654E45
    <t: 17506>, main.c, 478,
    ------------------------------------------------------------------------------------
    Button/RTT 1) Send a message to the odd group (address: 0xC003) to turn on LED 1.
    Button/RTT 2) Send a message to the odd group (address: 0xC003) to turn off LED 1.
    Button/RTT 3) Send a message to the even group (address: 0xC002) to turn on LED 1.
    Button/RTT 4) Send a message to the even group (address: 0xC002) to turn off LED 1.
    ------------------------------------------------------------------------------------
    <t: 150901>, main.c, 297, Button 1 pressed
    <t: 150903>, main.c, 139, ----- send_message -----
    Sending to group address 0xCAFE
    <t: 150914>, main.c, 151, Status : 7
    <t: 150916>, app_error_weak.c, 115, Mesh error 7 at 0x000279E5 (D:\Behine Niroo\Nordic\NRF Mesh\nrf5_SDK_for_Mesh_v5.0.0_src\examples\light_switch - Copy (3)\client\src\main.c:161)

    Because the status returned by the "access_model_publish" function, I printed out the parameters before that. As you can see 

    <t: 0>, main.c, 435, ----- BLE Mesh Light Switch Client Demo -----
    <t: 12535>, main.c, 394, Initializing and adding models
    <t: 17432>, mesh_app_utils.c, 66, Device UUID (raw): 137FF47B11294702B381A62F60654E45
    <t: 17435>, mesh_app_utils.c, 67, Device UUID : 137FF47B-1129-4702-B381-A62F60654E45
    <t: 17449>, main.c, 482,
    ------------------------------------------------------------------------------------
    Button/RTT 1) Send a message to the odd group (address: 0xC003) to turn on LED 1.
    Button/RTT 2) Send a message to the odd group (address: 0xC003) to turn off LED 1.
    Button/RTT 3) Send a message to the even group (address: 0xC002) to turn on LED 1.
    Button/RTT 4) Send a message to the even group (address: 0xC002) to turn off LED 1.
    ------------------------------------------------------------------------------------
    <t: 111205>, main.c, 301, Button 1 pressed
    <t: 111208>, main.c, 139, ----- send_message -----
    Sending to group address 0xCAFE
    <t: 111219>, main.c, 150, msg.opcode.opcode : 0x00C1
    <t: 111221>, main.c, 151, msg.p_buffer : Hello
    <t: 111223>, main.c, 152, msg.length : 5
    <t: 111225>, main.c, 154, Status : 7
    <t: 111227>, app_error_weak.c, 115, Mesh error 7 at 0x00027A1D (D:\Behine Niroo\Nordic\NRF Mesh\nrf5_SDK_for_Mesh_v5.0.0_src\examples\light_switch - Copy (3)\client\src\main.c:165)

    I also followed the  "access_model_publish" function until "packet_alloc_and_tx" function and tried to print out its parameters:

    <t: 0>, main.c, 467, ----- BLE Mesh Light Switch Client Demo -----
    <t: 12356>, main.c, 426, Initializing and adding models
    <t: 12406>, main.c, 230, Node Address: 0x0002
    <t: 12409>, mesh_app_utils.c, 66, Device UUID (raw): 137FF47B11294702B381A62F60654E45
    <t: 12412>, mesh_app_utils.c, 67, Device UUID : 137FF47B-1129-4702-B381-A62F60654E45
    <t: 12436>, main.c, 514,
    ------------------------------------------------------------------------------------
    Button/RTT 1) Send a message to the odd group (address: 0xC003) to turn on LED 1.
    Button/RTT 2) Send a message to the odd group (address: 0xC003) to turn off LED 1.
    Button/RTT 3) Send a message to the even group (address: 0xC002) to turn on LED 1.
    Button/RTT 4) Send a message to the even group (address: 0xC002) to turn off LED 1.
    ------------------------------------------------------------------------------------
    <t: 178686>, main.c, 333, Button 1 pressed
    <t: 178688>, main.c, 139, ----- send_message -----
    Sending to group address 0xCAFE
    <t: 178699>, main.c, 150, msg.opcode.opcode : 0x00C1
    <t: 178702>, main.c, 151, msg.p_buffer : Hello
    <t: 178704>, main.c, 152, msg.length : 5
    <t: 178706>, access.c, 439, handle : 0
    <t: 178708>, access.c, 440, pp_access_payload : 537128688
    <t: 178711>, access.c, 441, p_access_payload_len : 537128694
    <t: 178714>, access.c, 442, TX: Msg Hello
    <t: 178716>, main.c, 154, Status : 7
    <t: 178718>, app_error_weak.c, 115, Mesh error 7 at 0x00027A25 (D:\Behine Niroo\Nordic\NRF Mesh\nrf5_SDK_for_Mesh_v5.0.0_src\examples\light_switch - Copy (3)\client\src\main.c:165)

    I am not sure about the correctness of my method to print out and I could not print the "p_rx_message" variable.

    Any idea?

    Are you sure there is no need to change other codes, as I see in this case that the Generic OnOff and a few lines have been modified?

    Could you please run this example on your side? Because I have been struggling a long time to run that.

    It seems that after 3 years, it is needed an update, isn't it?

    Br,

    Sama

  • Hi,

    Could you please help me to solve my problem?

    I look forward to hearing from you.

    Br,

    Sama

  • Hi,

    Regarding the error 7, you probably haven't bound model to appkey or publish address haven't been set.

    Sama said:
    Are you sure there is no need to change other codes, as I see in this case that the Generic OnOff and a few lines have been modified?

    I don't think you have to make the changes that are being made on the client in that thread, but you need make changes on the server side though.

    I will try setting up the example with the latest SDK version on my side. It might take some time, I will update you as soon as possible.

  • Hi,

    I have modified the light switch example in our latest Mesh SDK v5.0.0. You can search for "modified" to see what I have modified on the client and server.

    I used the nRF Mesh app to provision the devices, bind the models to appkey and set the publish address. 

    Push button 1 on the client board and you will see that a "Hello" message will be received on the server.

    nrf5_SDK_for_Mesh_v5.0.0_src_.rar

  • Hi,

    Thank you very much.

    I will try that.

    Br,

    Sama

Reply Children
No Data
Related