Send string with Bluetooth Mesh and NRF Connect SDK V1.9.0

Hi all!

I'm new to mesh bluetooth technology and I'm stuck with some bugs. 

I am using the development boards nrf52dk and my goal is to create a network of about 6 nodes and send a string (maximum 60 characters) to all of them.

I'm currently using the NRFConnect v1.9.0 SDK and I've been relying on the provided examples of "mesh chat", "Light control" and documentation related to creating custom mesh models.
With these 3 sources I modified the Light control example and I made to compile it and run.

However, after doing the provisioning process (through nordic mesh app) and trying to send a string I get the following warning and errors:

"<wrn> bt_mesh_transport: No matching TX context for ack<ESC>"
"<err> bt_mesh_transport: No multi-segment message contexts available<ESC>"
"<err> bt_mesh_access: Failed to publish (err -16)<ESC>"

Someone can please tell me what the problem could be? (Besides I'm a newbie :P)
Is there any other example that I should base myself on?

Thanks in advance to anyone who can help me.

Parents Reply Children
  • Hi Mttrinh,

    First, I apologize for the late response and thank you in advance for your help.

    After reading your answer I created a new version of my code based only on the "mesh chat" example.
    So I simplified some of the functionality of the chat example, being only interested in the functionality of sending messages to all nodes (at the same time) and receiving messages.

    My goal is to send a string (maximum 60 characters) to all nodes on the network after an event occurs, such as pressing a button.

    As in the previous approach I can compile the code and run it in the DK. However, after performing the provisioning process, I still receive some warnings as you can see from the logs.
    I'm doing something wrong in the provisioning process in the NRF Mesh app?

    Do you think generating an interrupt by pressing the button to send the message to all nodes on the network is a good idea? Or it may generate problems in the mesh network's operability?

    Thank you once again.

    Best Regards,
    ISilva

    My app logs:

    *** Booting Zephyr OS build v2.7.99-ncs1  ***<CR><LF>
    Initializing...<CR><LF>
    Initializing Bluetooth...<CR><LF>
    Bluetooth initialized<CR><LF>
    >>> Bluetooth Mesh Messges Ready <<<<CR><LF>
    
    Mesh initialized<CR><LF>
    [00:00:00.015,319] <ESC><inf> fs_nvs: 8 Sectors of 4096 bytes<ESC><CR><LF>
    [00:00:00.015,319] <ESC><inf> fs_nvs: alloc wra: 0, fe8<ESC><CR><LF>
    [00:00:00.015,350] <ESC><inf> fs_nvs: data wra: 0, 0<ESC><CR><LF>
    [00:00:00.015,472] <ESC><inf> sdc_hci_driver: SoftDevice Controller build revision: <CR><LF>
                                             0e e7 c5 66 67 18 3c ac  b3 d2 cc 81 a3 dc f1 c0 |...fg.<. ........<CR><LF>
                                             c0 36 02 22                                      |.6."             <ESC><CR><LF>
    [00:00:00.018,585] <ESC><inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)<ESC><CR><LF>
    [00:00:00.018,585] <ESC><inf> bt_hci_core: HW Variant: nRF52x (0x0002)<ESC><CR><LF>
    [00:00:00.018,585] <ESC><inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 14.50663 Build 1008232294<ESC><CR><LF>
    [00:00:00.018,890] <ESC><inf> bt_hci_core: No ID address. App must call settings_load()<ESC><CR><LF>
    [00:00:00.024,932] <ESC><inf> bt_hci_core: Identity: CE:64:4C:47:69:E0 (random)<ESC><CR><LF>
    [00:00:00.024,963] <ESC><inf> bt_hci_core: HCI: version 5.2 (0x0b) revision 0x12fe, manufacturer 0x0059<ESC><CR><LF>
    [00:00:00.024,963] <ESC><inf> bt_hci_core: LMP: version 5.2 (0x0b) subver 0x12fe<ESC><CR><LF>
    [00:00:00.025,177] <ESC><inf> bt_mesh_prov_device: Device UUID: 00000000-0000-0080-b34d-252ed3d4a4d8<ESC><CR><LF>
    The mesh node is provisioned. The client address is 0x0002.[00:01:03.487,060] <ESC><inf> bt_mesh_main: Primary Element: 0x0002<ESC><CR><LF>
    [00:01:03.487,091] <ESC><dbg> bt_mesh_main.bt_mesh_provision: net_idx 0x0000 flags 0x00 iv_index 0x0000<ESC><CR><LF>
    [00:01:04.563,262] <ESC><dbg> bt_mesh_health_srv.attention_off: <ESC><CR><LF>
    [00:01:09.828,582] <ESC><dbg> bt_mesh_cfg_srv.dev_comp_data_get: net_idx 0x0000 app_idx 0xfffe src 0x0001 len 1: ff<ESC><CR><LF>
    [00:01:09.828,613] <ESC><dbg> bt_mesh_cfg_srv.dev_comp_data_get: Composition page 255 not available<ESC><CR><LF>
    [00:01:10.323,455] <ESC><wrn> bt_mesh_transport: No matching TX context for ack<ESC><CR><LF>
    [00:01:10.413,543] <ESC><dbg> bt_mesh_cfg_srv.default_ttl_get: net_idx 0x0000 app_idx 0xfffe src 0x0001 len 0: <ESC><CR><LF>
    [00:01:11.988,525] <ESC><dbg> bt_mesh_cfg_srv.net_transmit_set: net_idx 0x0000 app_idx 0xfffe src 0x0001 len 1: 0a<ESC><CR><LF>
    [00:01:11.988,555] <ESC><dbg> bt_mesh_cfg_srv.net_transmit_set: Transmit 0x0a (count 2 interval 20ms)<ESC><CR><LF>
    [00:01:13.610,107] <ESC><dbg> bt_mesh_cfg_srv.app_key_add: AppIdx 0x0000 NetIdx 0x0000<ESC><CR><LF>
    [00:01:25.714,111] <ESC><dbg> bt_mesh_cfg_srv.get_model: Company 0x0059 ID 0x000a addr 0x0002<ESC><CR><LF>
    [00:01:25.714,141] <ESC><dbg> bt_mesh_cfg_srv.mod_bind: model 0x200007b0 key_idx 0x000<ESC><CR><LF>
    [00:01:25.714,172] <ESC><dbg> bt_mesh_cfg_srv.mod_app_bind: status 0x00<ESC><CR><LF>
    [00:01:51.048,889] <ESC><dbg> bt_mesh_cfg_srv.mod_pub_set: elem_addr 0x0002 pub_addr 0xc000 cred_flag 0<ESC><CR><LF>
    [00:01:51.048,919] <ESC><dbg> bt_mesh_cfg_srv.mod_pub_set: pub_app_idx 0x000, pub_ttl 255 pub_period 0x4a<ESC><CR><LF>
    [00:01:51.048,919] <ESC><dbg> bt_mesh_cfg_srv.mod_pub_set: retransmit 0x00 (count 0 interval 50ms)<ESC><CR><LF>
    [00:01:51.048,950] <ESC><dbg> bt_mesh_cfg_srv.get_model: Company 0x0059 ID 0x000a addr 0x0002<ESC><CR><LF>
    [00:01:51.048,950] <ESC><dbg> bt_mesh_cfg_srv._mod_pub_set: period 10000 ms<ESC><CR><LF>
    [00:01:51.542,266] <ESC><wrn> bt_mesh_transport: No matching TX context for ack<ESC><CR><LF>
    [00:01:54.917,053] <ESC><dbg> bt_mesh_cfg_srv.mod_sub_add: elem_addr 0x0002, sub_addr 0xc000<ESC><CR><LF>
    [00:01:54.917,083] <ESC><dbg> bt_mesh_cfg_srv.get_model: Company 0x0059 ID 0x000a addr 0x0002<ESC><CR><LF>
    [00:01:54.917,114] <ESC><dbg> bt_mesh_cfg_srv.send_mod_sub_status: status 0x00 elem_addr 0x0002 sub_addr 0xc000<ESC><CR><LF>
    [00:02:01.050,384] <ESC><wrn> bt_mesh_net: Unable to allocate loopback<ESC><CR><LF>
    [00:02:01.050,628] <ESC><wrn> bt_mesh_net: Unable to allocate loopback<ESC><CR><LF>
    [00:02:11.054,565] <ESC><wrn> bt_mesh_transport: Duplicate SDU from src 0x0002<ESC><CR><LF>
    [00:02:12.122,314] <ESC><wrn> bt_mesh_net: Unable to allocate loopback<ESC><CR><LF>
    [00:02:12.122,589] <ESC><wrn> bt_mesh_net: Unable to allocate loopback<ESC><CR><LF>
    [00:03:10.989,868] <ESC><wrn> bt_mesh_transport: No free slots for new incoming segmented messages<ESC><CR><LF>
    [00:03:11.051,757] <ESC><wrn> bt_mesh_net: Unable to allocate loopback<ESC><CR><LF>
    [00:03:11.052,001] <ESC><wrn> bt_mesh_net: Unable to allocate loopback<ESC><CR><LF>
    [00:03:11.052,978] <ESC><wrn> bt_mesh_net: Unable to allocate loopback<ESC><CR><LF>
    [00:03:11.053,192] <ESC><wrn> bt_mesh_transport: Duplicate SDU from src 0x0002<ESC><CR><LF>
    [00:03:11.119,720] <ESC><wrn> bt_mesh_transport: No free slots for new incoming segmented messages<ESC><CR><LF>
    [00:03:11.243,469] <ESC><wrn> bt_mesh_transport: No free slots for new incoming segmented messages<ESC><CR><LF>
    [00:03:12.170,715] <ESC><wrn> bt_mesh_net: Unable to allocate loopback<ESC><CR><LF>

    proj.conf file:

    # nothing here
    #CONFIG_NCS_SAMPLES_DEFAULTS=y
    CONFIG_GPIO=y
    
    # General configuration
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    CONFIG_HWINFO=y
    CONFIG_DK_LIBRARY=y
    
    # Bluetooth configuration
    CONFIG_BT=y
    CONFIG_BT_COMPANY_ID=0x0059
    CONFIG_BT_DEVICE_NAME="Mesh Test"
    CONFIG_BT_L2CAP_TX_MTU=69
    CONFIG_BT_L2CAP_TX_BUF_COUNT=8
    CONFIG_BT_OBSERVER=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_SETTINGS=y 
    
    # Disable unused Bluetooth features
    CONFIG_BT_CTLR_DUP_FILTER_LEN=0
    CONFIG_BT_CTLR_LE_ENC=n
    CONFIG_BT_DATA_LEN_UPDATE=n
    CONFIG_BT_PHY_UPDATE=n
    CONFIG_BT_CTLR_CHAN_SEL_2=n
    CONFIG_BT_CTLR_MIN_USED_CHAN=n
    CONFIG_BT_CTLR_PRIVACY=n
    
    # Bluetooth Mesh configuration
    CONFIG_BT_MESH=y
    CONFIG_BT_MESH_RELAY=y
    CONFIG_BT_MESH_FRIEND=y
    CONFIG_BT_MESH_ADV_BUF_COUNT=13
    CONFIG_BT_MESH_RX_SEG_MAX=10
    CONFIG_BT_MESH_TX_SEG_MAX=10
    CONFIG_BT_MESH_PB_GATT=y
    CONFIG_BT_MESH_GATT_PROXY=y
    CONFIG_BT_MESH_DK_PROV=y
    
    # Enable Bluetooth mesh models debug logs
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_MESH_DEBUG=y
    CONFIG_BT_MESH_DEBUG_MODEL=y

  • Hi,

    ISilva said:
    I'm doing something wrong in the provisioning process in the NRF Mesh app?

    Can you describe steb-by-step how you are doing the provisioning? Are you configuring device after you done provisioning? When do you get these warnings?

    ISilva said:
    Do you think generating an interrupt by pressing the button to send the message to all nodes on the network is a good idea? Or it may generate problems in the mesh network's operability?

    Typo: It shouldn't cause any problems. Our examples from the SDK are already doing this.

  • Hi!

    Thanks for answering my question.

    As I said before my “code base” is the chat example. In the future, the objective is to connect a “custom specific sensor” to all nodes and send the information from this sensor (among other informations) via string. For now, the goal is just to configure the entire mesh network and push a button on one node and the string will be sent to all other nodes.

    So, from this example I removed the shell functions and replaced it with a simple "printk" just to check that everything is working fine, I also comment out some "bt_mesh_chat_cli_handlers" that I won't need:


    static const struct bt_mesh_chat_cli_handlers chat_handlers = {
    .start = handle_chat_start,
    // .presence = handle_chat_presence,
    .message = handle_chat_message,
    // .private_message = handle_chat_private_message,
    // .message_reply = handle_chat_message_reply,
    };

    Now answering your questions:

    Can you describe step-by-step how you are doing the provisioning?

    1. After building the code, I program all the nodes (I'm currently using only 3);
    2. Next, I use the “nrf mesh app” on my smartphone to configure the network and do the provisioning process;
    3. I start by creating a new group and then add all the non-provisioned nodes;
    4. For the OOB type, I select the option “No OOB” and then I receive a popup message informing that the configuration is complete;
    5. Next, in the node elements, I choose the supplier module and bind an “appKey” (key1, I use the same for all 3 nodes);
    6. Now, I configure the publish settings: the address with the group address created earlier, the publication period is set to an interval of 10 seconds, and I disable the publication relay (the Retransmission count and interval fields are disabled);
    7. To finish the node configuration, I subscribe to the group created earlier;
    8. Repeat this process once for each node.

     

    Are you configuring device after you done provisioning?

    Yes, I do this after point 4 I mentioned earlier

     

    When do you get these warnings?

    I got these warnings a few seconds after setting up the mesh network, even without pressing any buttons on the development board.


    Thanks again

  • Hi.

    Looking at the provisioning process, it looks like everything is done correcly. Not exactly sure why you get these warnings, are you unable to publish after you get those warnings?

    I would suggest you try with an unmodified version of the "mesh chat" example and see that everything works fine then make small implementation/changes and check that everything is working fine until you see the same issue. This way at least you know where and what is causing these warnings. 

  • Hi! Thanks for answering my questions once again. I will follow your advice. Then I'll let you know how it went.

    One last question, I know that there is an example that indicates how to execute the provisioning process, but what about configuring each node to which group it can publish or subscribe?

    For my project it would be necessary to perform these actions without having to use the nrf mesh app on the smartphone.

    Thanks.

Related