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

How to send packet of data through mesh application

i am working on mesh application using two nrf51822 and one nrf2832. I started from light-switch examples. nrf51 set as two server and  nrf52 as a client . In server side integrated with i2c sensor so in mesh application also integrated with ble application (nrf51 SDK V14.2.0 ) for I2C. I want to send sensor data from server to client then from client to android phone. From client side based app_uart example i implemented custom services. So i can able to send data from client to phone through custom services.

My question is how to send data from server to client ?? right now i'm using  " access_model_publish(access_model_handle_t handle, const access_message_tx_t * p_message) " to send data from server to client and  " static void handle_status_cb(access_model_handle_t handle, const access_message_rx_t * p_message, void * p_args) " to receive in client side. Is this correct way ?? Using this method i cant send data  in fast. Or i want to implement custom services from server side also???

Pls help to solve this issue!!!   

Pls give me some tutorial how to send data through mesh application ??  !!

  • Thank for fast response.

    Why i need mesh is, i want to start both server sensor data reading at same time. Through mesh i can operate both node at same dime without any delay.

    In 4th point , u didn't understand the exact issue. when im sending 33bytes packet there is any wrong order inside this 33byte i can receive same data at client.  The issue is when continuously sending 33byte of data at 50ms interval , first 33bytes packets getting second or third at client and second 33byte packets getting first.

    5th question- im using light switch example and only have two nodes(nrf51822) and server(nrf52Dk)  .i dint get even 3kbps. i measured speed it around 0.25Kbps(kilo bytes per sec) .  While sending in 50ms interval most of the time  access_model_publish return 0x04 error code (NRF_ERROR_NO_MEM ). Around 10times its failing then one time its success.  That means this will sending data withing each 500ms gap. Why this is happening

    this error NRF_ERROR_NO_MEM means 'No Memory for operation' . Is it because of nrf51822 has full flash memory??

    Also this 3kbps throughput you have tested with nrf52 or nrf51 ?? because my server side is nrf51

  • Hi, 

    I'm not so sure using mesh is the best way to achieve time synchronization. Of course time synchronization has something to do with a broadcast message as the beacon for syncing. But in a mesh network it harder to control that due to the re-broadcast nature. For time sync application we would suggest to use proprietary protocol, such as in this blog

    4. Yes, because sending 33bytes in  50ms is not possible with the current configuration of mesh network ( advertising interval is 20ms and each packet only has 11byte payload including overhead, NRF_MESH_UNSEG_PAYLOAD_SIZE_MAX) .

    Any packet with size larger than 11 bytes will be split into segmented messages. When sending segmented messages, there will be a chance that one of the segment of packet #1 went missing and comes after all the segments of packet #2 already arrive. This results in the reversed order, of packet #2 arrive before packet #1. 

    5. It was tested with nRF52 and Mesh v2.0.1 stack. The reason you have No Mem error is related to what I explained in #4. The default advertising interval is 20ms and with 11 bytes payload (including header) So the theoretical max throughput of a node is 4.4kbps. I would suggest to start trying with sending 11 bytes payload  (including opcode, company id) every 50ms to check if you still see the NO MEM error. 

     

  • Hi,

    As I was testing Mesh I also got NRF_ERROR_NO_MEM, the reason for getting this was because I was sending each packet before the packets before were sent, resulting in a no memory. The solution to this was to add a callback for the method and when the transmission is done I sent next packet, see this post

    This can be achieved by doing as the heartbeat callback in heartbeat.c (heartbeat_core_evt_cb)

    Hope it helps!

  • Hi all
    I'm using nRR52832 + nrf5_SDK_for_Mesh_v2.0.1 and Light switch example. I want to send data from server to client. But, I don't  know how to get data at client because interrupt received and how to use static void handle_status_cb .

    Thanks

  • Hi Tinh, 

    Please read this guide.

    You send data from server to client by using client to send a  SIMPLE_ON_OFF_OPCODE_GET and wait for the handle_status_cb() to be called. 

    Another option is to have another client on the same server node (but different element) and a server on the client node (add another element to the client node). This way you don't need to wait for the client to send the GET command to send data.. 

Related