Troubleshooting nRF Mesh Heartbeat Feature Configuration in Version 5

"Hello, I'm trying to set up the Heartbeat feature in my nRF Mesh network using the nRF Mesh app. I've provisioned and configured both a server and a client, and I've set up the Heartbeat Publication and Subscription addresses as well as the Heartbeat Subscription Period. However, I'm not seeing any Heartbeat messages and I'm not sure what to do next.

I'm using nRF Mesh version 5 and I've checked that both devices have the Heartbeat feature enabled. I've also confirmed that the addresses I'm using for the Publication and Subscription are unique and not already in use by other devices in the network.

One thing I'm not sure about is where to see the result of the Heartbeat feature once it's configured. I've checked the app and I don't see any Heartbeat log or message feature. Is there somewhere else I should be looking?

Any advice or troubleshooting tips would be greatly appreciated. Thank you!"

Parents Reply Children
  • Hello Hieu,

    1)

    I have two Nordic Development Kits/boards, and I am using a sensor server example as the starting point for my project. My task is to check the heartbeat functionality on these devices.

    To begin, I completed the mesh network setup by assigning the publish and subscription addresses for successful communication between the server and client nodes using the Mesh app. After ensuring that the mesh network is working as expected, I proceeded to configure the heartbeat feature on the devices.

    For the source and destination addresses of the heartbeat feature, I used the unique addresses that were assigned during provisioning. The unique address for the sensor server node is 0x00E5, and the unique address for the sensor client node is 0x00E9.

    in mesh app -> server node -> configuration server -> scroll down to the heartbeat publication setup as shown in below pic

    Now in mesh app go to the client node -> configuration server -> scroll down to the subscription heartbeat and sitting as below

    and save then 

    that is the configuration for heartbeat feature.

    2)

    Your second question how to determine if a message has been received or not. To detect this, I used a J-Link debugger and also monitored the output of the client node using the serial port in Putty. I was able to confirm that communication between the nodes was established since the sensor server successfully published its data and the client node received the data without any issues.

    summary:

    1. How does the heartbeat feature work?
    2. How do I configure the heartbeat feature correctly?
    3. Is the unicast address that I assign correct?
    4. How do I confirm that the heartbeat feature works, and what output should I expect to see?

     

  • Hello Muhammad,

    The answer to your questions could be found in the Mesh Profile Bluetooth Specification. The latest version, 1.0.1 as of time of writing, can be found here: Mesh Profile – BluetoothRegistered Technology Website.

    In particular, you will want to read the following sections:

    3.6: Heartbeat
    4.2.17: Heartbeat Publication
    4.2.18: Heartbeat Subscription

    If there are anything unclear from there, please don't hesitate to ask and I will try my best to support.

  • Thank you for your response, Hieu.

    I have read the documents you provided. After that, I tested the heartbeat feature again and I would like to share my configuration setup for both nodes with you, as shown below.

    sensor client configuration for heartbeat message is here

    sensor server configuration for heartbeat is here

    After configuring everything, I checked the J-Link debugger for the output result, but unfortunately, there was no response. Additionally, there is nothing in the app to show me the output message for the heartbeat message.

    My Questions:

    1. "Could you please provide a step-by-step guide or a screenshot of how to configure the heartbeat feature using the nRF Mesh app?"

    2. "What types of output messages are displayed in the log or app when the heartbeat feature is used, and could you please provide a screenshot or an example?"

    3. "If you have access to a development kit, would it be possible for you to test the heartbeat feature and provide me with the output messages? This would be very helpful as I have already configured the feature but am unsure where the output messages will be displayed or what they will look like."

  • Hello Muhammad, 

    From your questions and screenshot, I think perhaps you still misunderstand the concept of "period" in the Heartbeat Subscription.

    In Heartbeat Publication, the term "period" refers to the amount of time between each heartbeat message being sent.
    After sending each heartbeat message, "count" is decrement. When count is 0, no heartbeat message is sent.

    In Heartbeat Subscription, the term "period" refers to the window of time during which the node will subscribe to heartbeat messages. 
    After receiving each heartbeat message, "count" is increment.

    From that, let's think about what would be a good setup to, as a human, see heartbeat (HB) in action. One good strategy is to quickly setup

    1. HB Publication with
            1.1. Moderately short <Publication Period>
            1.2. Big <Publication Count>
    2. HB Subscription with a big <HB Subscription Period>.

    I emphasis the "as a human" part because the suggestion "short" or "big" is only so that a human manually configuring the nodes can see what happen.
    As a node running an application, any combination of the above configurations can be supported.

    With that in mind, let's go into the details you requested.

    Muhammad Kashif said:
    • "Could you please provide a step-by-step guide or a screenshot of how to configure the heartbeat feature using the nRF Mesh app?"

    • "What types of output messages are displayed in the log or app when the heartbeat feature is used, and could you please provide a screenshot or an example?"

    In my mesh, after provisioning, there are two nodes running the sensor server example as followed:

    On node 1, I decide that:

    1. Node 0x0002 will send HB Publication with
            1.1. HB Publication Period of 4 seconds
            1.2. HB Publication Count of 1024
            1.3. Destination: 0x0003
    Screenshot of Node 0x0002 > Configuration Server Model > Heartbeat Publication > Set Publication


    2. Node 0x0003 will send HB Subscription with
            2.1. HB Subscription Period of 34 minutes 8 seconds (2048s)
            2.2 Source: 0x0002
            2.3 Destination: 0x0003
    Screenshot of Node 0x0003 Configuration Server Model > Heartbeat Subscription > Subscribe

    Now, repeatedly hit Refresh in node 0x0003's Heartbeat Subscription area and observe that Subscription Count is going up and Subscription Period is going down.
    It should increase from 1, to 2...3, then 4...7.
    This is how count is reported, as a range between power of 2. (2n ... 2n-1)

    You can also go back to node 0x0002's Heartbeat Publication area and hit Refresh to see that Publication Count is going down. Publication Period remains the same.
    You might want to setup another publication with smaller count to see the result faster.

    That is a setup similar to yours. Once you are familiar with that, we can try a slightly faster setup. I will skip the screenshots on these.

    Experiment 1: On node 0x0003, set HB Publication with Period of 1s, and Count of 16. Press Refresh repeatedly to see Count decreases rapidly.

    Experiment 2:
    On node 0x0003, set HB Publication with Period of 1s, and Count of 1024, destination 0x0003.
    On node 0x0003, set HB Subscription with Period of 16s, source 0x0003, destination 0x0003.
    Hit Refresh repeatedly on HB Subscription to see Count increases rapidly, and stop after 16 seconds.

    Muhammad Kashif said:
    "If you have access to a development kit, would it be possible for you to test the heartbeat feature and provide me with the output messages? This would be very helpful as I have already configured the feature but am unsure where the output messages will be displayed or what they will look like."

    By default, there is no log at all.

    I don't think there is anything to get to see the Publication without modifying the SDK to add more logging.
    There is one callback setup, but using it would also break the Configuration Server feature.
    If you are really motivated, you can study heartbeat.c and add logging to heartbeat_send().

    If you do decide to modify the SDK, I recommend to make a copy of the SDK for such experiments, perhaps even delete once you are done. It is not rare that people have issues because of a change to the SDK they make two months prior.

    For Subscription, you can use nrf_mesh_evt_handler_add() and look for event type NRF_MESH_EVT_HB_MESSAGE_RECEIVED.

    Example code here:

    void c303185_nrf_mesh_evt_handler_cb(const nrf_mesh_evt_t * p_evt)
    {
        static uint32_t cntr = 0;
        if (p_evt->type == NRF_MESH_EVT_HB_MESSAGE_RECEIVED)
        {
            cntr++;
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,
                  "c303185_nrf_mesh_evt_handler_cb - %d\n",
                  cntr);
    
            const heartbeat_subscription_state_t* t_p_hb_sub_state = heartbeat_subscription_get();
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "c303185_nrf_mesh_evt_handler_cb - t_p_hb_sub_state\n");
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "\t\t src      = 0x%04x\n", t_p_hb_sub_state->src);
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "\t\t dst      = 0x%04x\n", t_p_hb_sub_state->dst);
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "\t\t count    = %d\n", t_p_hb_sub_state->count);
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "\t\t period   = %d\n", t_p_hb_sub_state->src);
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "\t\t min_hops = %d\n", t_p_hb_sub_state->min_hops);
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "\t\t max_hops = %d\n", t_p_hb_sub_state->max_hops);
    
        }
    }
    
    nrf_mesh_evt_handler_t c303185_nrf_mesh_evt_handler = 
    {
        .evt_cb = c303185_nrf_mesh_evt_handler_cb
    };
    
    
    static void initialize(void)
    {
        [...]
        nrf_mesh_evt_handler_add(&c303185_nrf_mesh_evt_handler);
    }

  • Hi Muhammad,

    I noticed you had four follow-up questions but have now deleted them and closed this DevZone thread. I'm sorry if the wait made you make that decision. I was double-checking something with my team before answering you.

    I hope everything is working fine for you now.

Related