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

How do nRF mesh serial listening heartbeat message from a node in network?

Hi,

I'm building a gateway using nrf mesh serial, and I want to monitoring devices status in the network by listening heartbeat messages from devices, but when I set publication address on devices to gateway address, but in a gateway not show heartbeat messages from devices. what is the solution for this problem?

  • Hi Duan, 

    I would suggest testing receiving the heartbeat message on a normal example before testing it on the serial project. 
    By default the serial firmware should forward the event when receiving heartbeat (NRF_MESH_EVT_HB_MESSAGE_RECEIVED)  as SERIAL_OPCODE_EVT_MESH_HEARTBEAT_RECEIVED (0xD8). 

    Please try testing if you can receive the NRF_MESH_EVT_HB_MESSAGE_RECEIVED event on a normal example first. What you need to do is to setup the heartbeat subscription. This include the address of the node you are planning to receive the heartbeat from. In addition the period how long you would listen to heartbeat message (it can't listen forever for heatbeat). Please have a look at section 4.2.18 Heartbeat Subscription in the Mesh spec. 

    Basically you need to configure the config server to listen to heartbeat using the CONFIG_OPCODE_HEARTBEAT_SUBSCRIPTION_SET (handled by handle_heartbeat_subscription_set()) 

    This is an example I made long ago on Mesh SDK v2 but it might be useful: devzone.nordicsemi.com/.../ble-mesh-heartbeat-example

Related