BLE Mesh Friendship gets terminated when node sleeps/reboots

ZacDaMan
Posts: 47
Joined: Wed Dec 22, 2021 7:40 pm

BLE Mesh Friendship gets terminated when node sleeps/reboots

Postby ZacDaMan » Wed Nov 16, 2022 2:50 am

I'm trying to get two nodes working in a Friend/LPN configuration, but when I restart or deep-sleep the LPN (which has the BLE settings set to persist, ie the node automatically rejoins the mesh and remembers the friendship), I see the Friend node terminate the friendship, sometimes even after the LPN has restarted and been on for a few seconds. Currently they are only set to be Friend/LPN in menuconfig, I haven't started adding any lines of code specific to that yet. How can I prevent this from happening? Time doesn't seem to be the entire issue as the friendship will be terminated even if the LPN wakes up again almost immediately, ie pushing the reset button.

The friendship is usually rapidly re-established, but it shouldn't be lost in the first place.
Last edited by ZacDaMan on Wed Nov 16, 2022 3:54 am, edited 2 times in total.

ZacDaMan
Posts: 47
Joined: Wed Dec 22, 2021 7:40 pm

Re: BLE Mesh Friendship gets terminated when node sleeps

Postby ZacDaMan » Wed Nov 16, 2022 2:55 am

Potentially related - every now and then (not consistently), when the LPN wakes up it will come up with

Code: Select all

W (16372) BLE_MESH: Retrying the first Friend Poll, 1 attempts
W (16802) BLE_MESH: Retrying the first Friend Poll, 2 attempts
W (17222) BLE_MESH: Retrying the first Friend Poll, 3 attempts
W (17652) BLE_MESH: Retrying the first Friend Poll, 4 attempts
W (18082) BLE_MESH: Retrying the first Friend Poll, 5 attempts
E (18512) BLE_MESH: Timeout waiting for the first Friend Update
W (18522) EXAMPLE: FRIENDSHIP TERMINATED
W (25102) EXAMPLE: FRIENDSHIP ESTABLISHED
And on the Friend side of things, I'll sometimes see the corresponding messages

Code: Select all

W (1554539) BLE_MESH: Existing LPN re-requesting Friendship
W (1554539) EXAMPLE: FRIENDSHIP TERMINATED
W (1554929) BLE_MESH: No matching LPN addr 0x0012
W (1555329) BLE_MESH: No matching LPN addr 0x0012
W (1555769) BLE_MESH: No matching LPN addr 0x0012
W (1555879) BLE_MESH: Friendship not established with 0x0012
W (1563849) EXAMPLE: FRIENDSHIP ESTABLISHED
or (at different times)

Code: Select all

W (135069) BLE_MESH: Friendship lost with 0x0012

bungdz99
Posts: 1
Joined: Thu Nov 17, 2022 5:42 am

Re: BLE Mesh Friendship gets terminated when node sleeps/reboots

Postby bungdz99 » Thu Nov 17, 2022 5:46 am

Can you give me the code of this project. I have an assignment for this part, but I don't know how to implement.

ZacDaMan
Posts: 47
Joined: Wed Dec 22, 2021 7:40 pm

Re: BLE Mesh Friendship gets terminated when node sleeps/reboots

Postby ZacDaMan » Sun Nov 20, 2022 8:03 pm

bungdz99 wrote:
Thu Nov 17, 2022 5:46 am
Can you give me the code of this project. I have an assignment for this part, but I don't know how to implement.
It's just the onoff_client and onoff_server examples, but with friend and low power enabled in menuconfig, respectively

ZacDaMan
Posts: 47
Joined: Wed Dec 22, 2021 7:40 pm

Re: BLE Mesh Friendship gets terminated when node sleeps/reboots

Postby ZacDaMan » Mon Nov 21, 2022 11:15 pm

This is still puzzling me; I added a call to

Code: Select all

esp_ble_mesh_lpn_poll()
on startup, which returns ESP_OK first try, meaning the friendship is present and remembered when the device starts, but a few seconds later it will still be terminated by the Friend node. Can I adjust the PollTimeout? Or do I need to be manually polling more frequently? Once the friendship is lost and then re-established, it won't be lost again until I restart the device, which is confusing.

ZacDaMan
Posts: 47
Joined: Wed Dec 22, 2021 7:40 pm

Re: BLE Mesh Friendship gets terminated when node sleeps/reboots

Postby ZacDaMan » Thu Nov 24, 2022 3:12 am

On further inspection, calling esp_ble_mesh_lpn_poll() returns ESP_OK both before and after the friendship is terminated, and again when the friendship is re-established, leaving me unsure what the purpose of this function is.

Who is online

Users browsing this forum: No registered users and 130 guests