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.

  • Hi, 

    It looks to me as if the current bt_mesh_lpn_set(false) disables Low Power Node mode and clears the friendship, but does not restart scanning when CONFIG_BT_MESH_LPN_ESTABLISHMENT=n. As a result, the node becomes unreachable and cannot receive messages directly, even though it should behave like a normal node after exiting LPN mode. So you can try to call  bt_mesh_scan_enable() in the button callback to see if that helps as a workaround for now.

    -Amanda H.

  • hi,

    I called bt_mesh_scan_enable() after calling bt_mesh_lpn_set(0), but the problem has not been solved

  • Did you set CONFIG_BT_MESH_LPN_ESTABLISHMENT to n?

    What does the bt_mesh_scan_enable return when you call bt_mesh_scan_enable() after calling bt_mesh_lpn_set(0)?

    Could you provide any log to help us debug?

    llly said:
    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.

    Your assumption is that the setting is only relevant when the LPN feature is enabled, but in fact (at least from what I understand) it affects all Bluetooth Mesh scanning, regardless of the status of the LPN feature.

Reply
  • Did you set CONFIG_BT_MESH_LPN_ESTABLISHMENT to n?

    What does the bt_mesh_scan_enable return when you call bt_mesh_scan_enable() after calling bt_mesh_lpn_set(0)?

    Could you provide any log to help us debug?

    llly said:
    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.

    Your assumption is that the setting is only relevant when the LPN feature is enabled, but in fact (at least from what I understand) it affects all Bluetooth Mesh scanning, regardless of the status of the LPN feature.

Children
  • 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. 

Related