Bluetooth mesh how to return low-power nodes to normal node mode

I used a mesh example (the example name is "mesh") for testing, and enabled low-power nodes using CONFIG_BT_MESH_LOW_POWER=y, and disabled the automatic start of low-power node mode. 

I added bt_mesh_lpn_set to the button callback. When I press the button, it will call bt_mesh_lpn_set (1)  to enter low-power mode, and when I press it again, it will call bt_mesh_lpn_set(0) to return to normal node mode.

Additionally, I have prepared two devices for testing, one with a friend node enabled and the other as a regular node.So for now, the ordinary node is called node a, the friend node is called node b, and the low-power node to be tested is called node c

After powering on and configuring the three devices, node A can now send messages to node C normally. Then, I press the button on node C to put it into low-power mode. Node C automatically establishes a friendship with node B. When node A sends messages to node C again, node B can also cache and forward these messages normally.

But when I wanted node c to exit low-power mode and return to normal node, there was a problem. Call bt_mesh_lpn_set (0), the return value is 0, indicating successful execution. The log of node b also shows that the friendship has been disconnected. However, at this time, send a message to node c using node a, but node c will not receive it

At this point, I press the button again to call bt_mesh_lpn_set (1), and node b and node c will re-establish their friendship. Node a can successfully send messages to node c through node b

How should this problem be solved?

Parents
  • This is the bug fix with test: https://github.com/zephyrproject-rtos/zephyr/pull/88949

    However, the team said you are still not using it correctly.

    There are 2 options:

    1. CONFIG_BT_MESH_LPN_ESTABLISHMENT=n. Then, just calling bt_mesh_lpn_set(false) is sufficient. The LPN will initiate the friendship termination procedure, and after termination LPN leaves the scanner enabled.
    2. CONFIG_BT_MESH_LPN_ESTABLISHMENT=y (default). Then, calling bt_mesh_lpn_set(false) is not sufficient. Even more, calling  bt_mesh_scan_enable()after it will not help. Friendship termination will set the scanner in necessary to it state and leave the scanner disabled after termination. You have to register the LPN callback structure struct bt_mesh_lpn_cb with the implemented void (*terminated)(uint16_t net_idx, uint16_t friend_addr); callback over this macro BT_MESH_LPN_CB_DEFINE and wait for when the terminated callback is triggered. After this callback, the scanner should be enabled by you to call bt_mesh_scan_enable().  

  • Thank you for your help. After fixing this bug and setting CONFIG_BT_MESH_LPN_ESTABLISHMENT=n, lpn did indeed work as expected.

    Will this fix be added to the next NCS version?

Reply Children
No Data
Related