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 ??  !!

  • Hi ,

    Yes, you can send data from server to client by publishing the server data to the publication address and then on the client you subscribe to that publication address. A server can only publish to one single publication address when the client can subscribe to different addresses.

    I would suggest you to get familiar with the light switch code. Start first with publishing the status of the LED to the client. To do that you need to set the publication address of the server to the client's address . Or you can try to publish it to the group address 0xCAFE. To know how to set the publication address you can refer to how we do that in access_setup () in main.c in the client (SDK v1.0.1)

    However, for your product development, I would suggest to start with SDK v2.0.1 and nRF52 as NRF51 won't be support in the furture.

    In SDK v2.0.1 we have a proxy example that you can use the phone to do provisioning and set-up publication/subscription address, you may want to have a look here.

    The demo code can be found here

  • Thanks Hung Bui.

    I can able to send data from server to client usng access_model_publish function. Now im sending at 1000ms speed, thats working fine but if  i increase the speed to 10ms then most of the time it returning error code 0x04 (NRF_ERROR_NO_MEM ). I want to send around 8MB of data so i need to send in 10ms. Pls help ??

    Also one more doubt is I am sending 33bytes packet of data through access_model_publish  at one time. How is this possible?? Because nrf51 has maximum packet of data can send only 20bytes. right??

  • Hi Nidhin, 

    BLE Mesh wasn't created for streaming data. It's first designed to mainly just turn off and on light blubs :) You can find that in the list of defined SIG's models. 

    The minimum advertising interval mesh using now is 20ms. If we go lower than that, we can face bad interference between nodes. Mesh is all about broadcasting and re-broadcasting. So with 8MB you sent, it will be rebroadcasted all over the network. You should expect longer time it needed to send data in mesh compare to normal BLE.

    Do you really need mesh in your application ? The current softdevice from us can support up to 20 links at the same time. 

    For higher throughput application requiring mesh, we suggest you to try Instaburst. It's using extended advertising feature in Bluetooth v5.0. It's proprietary to Nordic and can be tested by just enabling EXPERIMENTAL_INSTABURST_ENABLED in Cmake configuration. 

  • Thanks Hung Bui.

    1. I didnt understand re-broadcasting? because im sending data from each server to client.

    2. We need mesh in our application because we need to synchronize time in both sever.

    3. I will try instaburst method. For this just enabling EXPERIMENTAL_INSTABURST_ENABLED in Cmake configuration is enough or anything else need to add or change ??My server side nrf51822 so i can use this method??

    4. One main issue is while sending data (33byte packet)  from server to client using access_model_publish function at 50ms rate , data not receive in order at client side. But data is not missing.

    Eg: When i send 10 packet(each 33byte) from server to client 1,2,3,4,5,6,7,8,9,10 order ,but in client side it received not same order as i sent,

    getting like this 2,3,4,1,5,8,6,7,10,9 but there is no any data loose. i need to receive in same order as i send from server.  Why this is happening??

    5. What is the maximum throughput in mesh??

  • Hi, 

     

    1. It's the nature of Bluetooth Mesh, it's a flooding mesh network. Every packet is retransmitted at every node in the network. 

    2. I don't understand why synchronize time requires mesh. Also Bluetooth Mesh has no time synchronization as of now. 

    3. No nRF51822 is not supported in SDK v2.0.1. For future development, we suggest to use nRF52

    4. Since your packet is 33 bytes, it will be splitted into 4 packets and sent as segmented packets. Segmented packets can arrive at the destination in wrong order (one packet of the first segmented packet may went missing and message 2 actually arrive (in full) before message 1. 
    What you can do to restore the correct order is to use one extra byte as the transaction id. This is what we already implemented in our simple on off model, please look for the "tid" field in simple_on_off_msg_set_unreliable_t

     

    5. There isn't a clear number of throughput in mesh  as it depends a lot on mesh set up and how many node in the network, how the node is connected together. For 4-8 nodes for example, in our test the throughput is about 3kbps on one node. 

Related