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

NRF_MESH_EVT_MESSAGE_RECEIVED mesh event behaviour

Hi all!

I am using mesh sdk v4.10 and sdk 16.0 with an nrf52840 custom hardware. I have a question regarding the mesh event handler. I am seeing something weird which I don't understand.

I have added the mesh event handler by doing the following:

  m_evt_handler.evt_cb = SM_mesh_event_handler;
  nrf_mesh_evt_handler_add(&m_evt_handler);
  
 void SM_mesh_event_handler(const nrf_mesh_evt_t *p_evt)
{
    switch (p_evt->type)
    {
    case NRF_MESH_EVT_MESSAGE_RECEIVED:
    {
        system_monitor.message_rx_count++;
    }
    break;

    case NRF_MESH_EVT_TX_COMPLETE:
    {
        system_monitor.message_tx_count++;
    }
    break;


    default:
    {
    /*Do nothing here*/
    }
    break;
    }
}

I have a node which publishes sensor status messages. The node is publishing to group 0xC000. What I am seeing is the following:

1. Node publishes the message and repeats it 2 times

2. NRF_MESH_EVT_TX_COMPLETE occurs

3. The weird part, NRF_MESH_EVT_MESSAGE_RECEIVED  occurs as well. The number of times this happens is exactly half of the NRF_MESH_EVT_TX_COMPLETE count.

There are no other nodes turned on. Also, the nrf52840 is half duplex.

Could someone please explain this behavior to me?

Regards

Chris

Parents Reply Children
  • I just tried it with the light lightness client example, adding an event handler by using:

    nrf_mesh_evt_handler_add()

    It does not seem to happen in this example!

    I do have another codebase which consists of Nordic implemented client models:

    1. Generic on/off client

    2. Generic level client

    3. Generic on/power up client

    4. Light Lightness client

    5. Light LC client

    The exact same thing is happening with all these models as well, every time I publish a message i.e generic on/off set, I get the  NRF_MESH_EVT_MESSAGE_RECEIVED event on the node that sent the message.

    Here is a snip of the Call Stack:

    Going all the way down to static bool loopback_process(void) in core_tx_local.c, I see there is some "loopback" source called .source = NRF_MESH_RX_SOURCE_LOOPBACK, so it seems like the node is "echoing" it's transmitted messages, almost like a simple UART test where you connect TX with RX, just with the radio of course. This looks like some debugging functionality....

    Perhaps it's something you can disable in the stack?

Related