Topics

Low power node and friend #bluetoothmesh


Diana Rivera
 

Hello,

I'm currently trying to implement a bluetooth mesh that includes not only relay nodes but low power nodes and their respective friends. So far I'm having a bit of trouble trying to do this. Is there an existent sample code for this functionality? Otherwise, could you please let me know the steps needed to establish a friendship?
Finally, I read in https://www.zephyrproject.org/announcing-bluetooth-mesh-support-in-zephyr-project/ that the friend functionality hadn't been implemented yet. Has this changed? Or am I trying to do something that's still not being supported?

Thanks in advance!

DRV


Johan Hedberg
 

Hi DRV,

On Mon, Apr 23, 2018, drv3007@... wrote:
I'm currently trying to implement a bluetooth mesh that includes not
only relay nodes but low power nodes and their respective friends. So
far I'm having a bit of trouble trying to do this. Is there an
existent sample code for this functionality?
At least the mesh shell supports both Friend and LPN roles, so you could
start off with tests/bluetooth/mesh_shell. The actual shell command
handlers are implemented in subsys/bluetooth/host/mesh/shell.c.

Otherwise, could you please let me know the steps needed to establish
a friendship?
It depends on whether you want to be Friend or LPN. For Friend you need
to use the configuration model to enable the feature. For LPN you need
to call bt_mesh_lpn_set(true) to make the local node start looking for
Friend nodes. For both features you also need to have the respective
Kconfig options enabled. The high-level Friend and LPN Kconfig options
have also several sub-options that let you fine-tune various parameters.

Finally, I read in https://www.zephyrproject.org/
announcing-bluetooth-mesh- support-in-zephyr-project/ (
https://www.zephyrproject.org/announcing-bluetooth-mesh-support-in-zephyr-project/
) that the friend functionality hadn't been implemented yet. Has this
changed? Or am I trying to do something that's still not being
supported?
That was when Bluetooth Mesh for Zephyr was originally announced, i.e.
for the Zephyr 1.9 release. We're at 1.11 now, with 1.12 around the
corner. If I remember right, the Friendship support debuted with 1.10.

Johan


Diana Rivera
 

Hi Johan,

Thank you for your prompt response.

"It depends on whether you want to be Friend or LPN. For Friend you need
to use the configuration model to enable the feature. For LPN you need
to call bt_mesh_lpn_set(true) to make the local node start looking for
Friend nodes. For both features you also need to have the respective
Kconfig options enabled. The high-level Friend and LPN Kconfig options
have also several sub-options that let you fine-tune various parameters."

Could you elaborate a little bit more on this, please? How could you integrate both a LPN and its friend to an existent "samples" code such as mesh or mesh_demo? Which modifications should be done to the codes previously mentioned for both friend and LPN?

I've been through subsys/bluetooth/host/mesh/shell.c and it doesn't really show how to integrate LPN and friends to a bluetooth mesh.

Once again, thank you in advance,
DRV

On Mon, Apr 23, 2018 at 5:37 PM, Johan Hedberg <johan.hedberg@...> wrote:
Hi DRV,

On Mon, Apr 23, 2018, drv3007@... wrote:
> I'm currently trying to implement a bluetooth mesh that includes not
> only relay nodes but low power nodes and their respective friends. So
> far I'm having a bit of trouble trying to do this. Is there an
> existent sample code for this functionality?

At least the mesh shell supports both Friend and LPN roles, so you could
start off with tests/bluetooth/mesh_shell. The actual shell command
handlers are implemented in subsys/bluetooth/host/mesh/shell.c.

> Otherwise, could you please let me know the steps needed to establish
> a friendship?

It depends on whether you want to be Friend or LPN. For Friend you need
to use the configuration model to enable the feature. For LPN you need
to call bt_mesh_lpn_set(true) to make the local node start looking for
Friend nodes. For both features you also need to have the respective
Kconfig options enabled. The high-level Friend and LPN Kconfig options
have also several sub-options that let you fine-tune various parameters.

> Finally, I read in https://www.zephyrproject.org/
> announcing-bluetooth-mesh- support-in-zephyr-project/ (
> https://www.zephyrproject.org/announcing-bluetooth-mesh-support-in-zephyr-project/
> ) that the friend functionality hadn't been implemented yet. Has this
> changed? Or am I trying to do something that's still not being
> supported?

That was when Bluetooth Mesh for Zephyr was originally announced, i.e.
for the Zephyr 1.9 release. We're at 1.11 now, with 1.12 around the
corner. If I remember right, the Friendship support debuted with 1.10.

Johan


Diana Rivera
 

Hi Johan,

With the hints you've given me, I've understood that to configure a Friend, it should be enough to add in the configuration model something as:

#if defined(CONFIG_BT_MESH_FRIEND)
.frnd = BT_MESH_FRIEND_ENABLED,
#else
         .frnd = BT_MESH_FRIEND_NOT_SUPPORTED,
#endif

As well, as enabling the Friend functionality in the prj.conf file through the line CONFIG_BT_MESH_FRIEND=y
Is this correct? 

As for the LPN, I'm still not sure on where should the bt_mesh_lpn_set(true) function be called. According to subsys/bluetooth/host/mesh/Kconfig, bt_mesh_lpn_set(true) is used to manually enable BT_MESH_LPN_AUTO. Therefore, if I set CONFIG_BT_MESH_LOW_POWER=y in the prj,conf file, shouldn't this functionality be enabled by default, without me needing to add anything else in the main code? If I'm wrong, where should the function be called?

Thanks for your help,
DRV

 


Johan Hedberg
 

Hi Diana,

On Tue, Apr 24, 2018, Diana Rivera wrote:
With the hints you've given me, I've understood that to configure a
Friend, it should be enough to add in the configuration model
something as:

# if defined(CONFIG_BT_MESH_FRIEND)
. frnd = BT_MESH_FRIEND_ENABLED,
# else
         . frnd = BT_MESH_FRIEND_NOT_SUPPORTED,
# endif

As well, as enabling the Friend functionality in the prj.conf file
through the line CONFIG_BT_MESH_FRIEND=y
Is this correct? 
Yes, that's correct. The 'frnd' variable can also be controlled through
the configuration model (normally operated from the provisioner device).

As for the LPN, I'm still not sure on where should
the bt_mesh_lpn_set(true) function be called. According
to subsys/bluetooth/host/mesh/Kconfig, bt_mesh_lpn_set(true) is used
to manually enable BT_MESH_LPN_AUTO. Therefore, if I
set CONFIG_BT_MESH_LOW_POWER=y in the prj,conf file, shouldn't this
functionality be enabled by default, without me needing to add
anything else in the main code? If I'm wrong, where should the
function be called?
If you set CONFIG_BT_MESH_LPN_AUTO=y then you don't need to call
bt_mesh_lpn_set(true), rather the node starts looking for Friend nodes
automatically after provisioning (and CONFIG_BT_MESH_LPN_AUTO_TIMEOUT
number of seconds has passed - it defaults to 15).

Johan