Page 1 of 1
BLE Mesh Friendship gets terminated when node sleeps/reboots
Posted: Wed Nov 16, 2022 2:50 am
by ZacDaMan
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.
Re: BLE Mesh Friendship gets terminated when node sleeps
Posted: Wed Nov 16, 2022 2:55 am
by ZacDaMan
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
Re: BLE Mesh Friendship gets terminated when node sleeps/reboots
Posted: Thu Nov 17, 2022 5:46 am
by bungdz99
Can you give me the code of this project. I have an assignment for this part, but I don't know how to implement.
Re: BLE Mesh Friendship gets terminated when node sleeps/reboots
Posted: Sun Nov 20, 2022 8:03 pm
by ZacDaMan
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
Re: BLE Mesh Friendship gets terminated when node sleeps/reboots
Posted: Mon Nov 21, 2022 11:15 pm
by ZacDaMan
This is still puzzling me; I added a call to
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.
Re: BLE Mesh Friendship gets terminated when node sleeps/reboots
Posted: Thu Nov 24, 2022 3:12 am
by ZacDaMan
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.