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
  • Hi, 

    Do you enable CONFIG_BT_MESH_LPN_ESTABLISHMENT

    If yes, then what you see is designed behavior. The node will only do some scanning for friendship when LPN_ESTABLISHMENT is enabled, but still misses most of the incoming messages as scanning at a low duty cycle. You should set `n` to enable the scanner out of friendship or friendship establishing as the "normal" mesh node.  

    config BT_MESH_LPN_ESTABLISHMENT
    	bool "Perform Friendship establishment using low power"
    	default y
    	help
    	  Perform the Friendship establishment using low power, with
    	  the help of a reduced scan duty cycle. The downside of this
    	  is that the node may miss out on messages intended for it
    	  until it has successfully set up Friendship with a Friend
    	  node.
    

    Regards,
    Amanda H.

  • hi, Amanda Hsieh

    I tried to use CONFIG_BT_MESH_LPN_ESTABLISHMENT=n, but it didn't solve the problem. Instead, it turned out that node c couldn't receive messages when it entered low-power node mode again after exiting low-power mode.

    My understanding of this option is to start using low-power mode without establishing a friendship, so this option should not be effective without enabling low-power mode? It only works when low-power mode is turned on and no friendship has been established.I don't know if my understanding is correct.

  • yes, I set CONFIG_BT_MESH_LPN_ESTABLISHMENT to n.

    This is the code in the key callback.

    There are two nodes here, left and right. The window on the right is for testing low-power nodes. At this time, the node on the right has not yet turned on low-power mode. I asked the node on the left to send a test message to the node on the right, and everything is normal

    Then I pressed the button on the right node to turn it into a low-power node, and it automatically established a friendship with its friend node (the third node, not the one on the left). I once again asked the left node to send a test message to the low-power node on the right. After a period of time, the right node also successfully received this message, indicating that the low-power node is working properly.

    Finally, I pressed the button on the low-power node again to exit the low-power mode. It can be seen that both bt_mesh_lpn_set(0) and bt_mesh_scan_enable returned 0, but at this point, the left node was asked to send a test message, but the right node could not receive it, and the left node returned an error message after a short period of time

  • In addition, if I set the CONFIG_BT_MESH_LPN_ESTABLISHMENT to y, at least the node on the right can still receive messages when exiting low-power mode and entering low-power mode again

  • Got it. I have reported to the internal team to investigate the issue. 

  • hi

    Is there any progress now?

    I accidentally noticed that sometimes when I exit from low-power node mode, there are a bunch of logs about clearing the mesh message cache. After this log appears, when I enter low-power node mode again and exit again, the node can receive messages normally. But I haven't found the pattern, and I don't know the reason why he has returned to normal

    And after this log appears, it cannot be immediately restored to normal. Instead, it needs to re-enter and exit the low-power node in order to receive messages sent by other nodes immediately like a regular node

Reply
  • hi

    Is there any progress now?

    I accidentally noticed that sometimes when I exit from low-power node mode, there are a bunch of logs about clearing the mesh message cache. After this log appears, when I enter low-power node mode again and exit again, the node can receive messages normally. But I haven't found the pattern, and I don't know the reason why he has returned to normal

    And after this log appears, it cannot be immediately restored to normal. Instead, it needs to re-enter and exit the low-power node in order to receive messages sent by other nodes immediately like a regular node

Children
No Data
Related