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

  • 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

  • Hi,

    Thank you again for the modification of the codes which workes well.

    1) I wonder that why the handle_send_status function is rune twice in the server-side as you see in the log:

    <t: 0>, main.c, 370, ----- BLE Mesh Light Switch Server Demo -----
    <t: 12177>, main.c, 326, Initializing and adding models
    <t: 12180>, main.c, 180, App OnOff Model Handle: 2
    <t: 12183>, main.c, 185, App DTT Model Handle: 3
    <t: 12187>, main.c, 191, App Scene Model Handle: 5
    <t: 12244>, main.c, 304, Node Address: 0x0002
    <t: 12247>, mesh_app_utils.c, 66, Device UUID (raw): 137FF47B11294702B381A62F60654E45
    <t: 12250>, mesh_app_utils.c, 67, Device UUID : 137FF47B-1129-4702-B381-A62F60654E45
    <t: 12279>, main.c, 420,
    -------------------------------------------------------------------------------
    Button/RTT 1) LED state will toggle and inform clients about the state change.
    Button/RTT 4) Clear all the states to reset the node.
    -------------------------------------------------------------------------------
    <t: 12745>, app_onoff.c, 154, msg: SET: 0
    <t: 169757>, generic_onoff_server.c, 274, ASCII Message: Hello
    <t: 169760>, generic_onoff_server.c, 280, length of buffer_RX: 5
    <t: 169770>, generic_onoff_server.c, 325, Status : 0
    <t: 172383>, generic_onoff_server.c, 274, ASCII Message: Hello
    <t: 172385>, generic_onoff_server.c, 280, length of buffer_RX: 5
    <t: 172395>, generic_onoff_server.c, 325, Status : 0

    2) To send large data through the mesh, I used ".force_segmented = true" option in the definition of my message, allowing me to send 360-byte data. Is this way correct?
    Is there any solution to send more bytes?

    3) Is it possible to send the data to a specific node? Actually, how can I send my message to a specific device, and how can I set the address inside the codes? 

    Br,
    Sama

Related