Re: How to configure BLE Mesh FN and LPN?


Johan Hedberg
 

Hi Frank,

You need to have CONFIG_BT_MESH_FRIEND=y and/or CONFIG_BT_MESH_LOW_POWER=y enabled to get access to Friendship functionality. You might also want to look at the various BT_MESH_LPN_* and BT_MESH_FRIEND_* options found in subsys/bluetooth/host/mesh/Kconfig, however their default values should be enough to get you started.

As Friend there’s nothing special you need to do in your application, except enable the Kconfig option for it and make sure the corresponding Configuration Model State is enabled (either statically as the default value or by a configuration client).

As LPN you need to call bt_mesh_lpn_set(true) to go into Low Power mode. The reason why this is at runtime is to allow for devices that have variable power sources, e.g. an internal battery but may also be plugged to a stable external power source from time to time. The selection of Friend node happens automatically, but you can control the process by setting CONFIG_BT_MESH_LPN_RECV_WIN_FACTOR, CONFIG_BT_MESH_LPN_RSSI_FACTOR and CONFIG_BT_MESH_LPN_MIN_QUEUE_SIZE to desired values. To get a good understanding of these and how they influence the Friend Offer Delay calculation please refer to the Mesh specification (sections 3.6.6.3.1 and 3.6.6.4.1 in particular).

As for meshctl from BlueZ, I’m not sure if it has any Friendship features. It can definitely not act as a Friend or LPN since it is GATT-only (Friendship is an advertising-only concept in the current spec), but it might have Configuration Client support to toggle the Friend state at runtime (note: LPN has no matching Configuration Model state so you need to use the Zephyr API I mentioned earlier).

Johan

On 5 Dec 2018, at 19.02, frv <F.Vieren@televic.com> wrote:

Hallo Zephyr Community, Johan,

So far I'm very impressed with the possibilities Zephyr and its BT Mesh framework already offers.
I recently played around successfully with the Generic On/Off sample application deployed on multiple nRF boards creating a BLE Mesh network.
I modified a little bit the code to have the use case I wanted to implement.

As far as I can see in the current Mesh code base v1.13 there is already support for implementing a Lower Power and a Friend node.

I'm just wondering how configuration is actually done, I would think a lower power node must say which is his friend node or vice versa? Maybe I missed it but I can't see anything implemented in the meshctl tool for doing this. And beside setting some defines in the code, is there additional coding needed.

Any help is very welcome,
Thanks in advance,
Best regards,
Frank



Join devel@lists.zephyrproject.org to automatically receive all group messages.