I am working on nRF52-DK using the light client example under Mesh 2.1.1
I am trying to start and stop the listening for provisioning packets as the idea is to switch to provisioner role and then switch back to provisionee role.
The code is by default setup that it starts sending out unprovisioned beacons and this works nicely. After 10s I execute a call for nrf_mesh_disable() followed by nrf_mesh_prov_listen_stop(&m_prov_ctx);
No matter what I try after that doesn't start the sending unprovisioned beacons again.
First I tried calling the start function from the example that starts the mesh and initializes the listener, but that didn't go through as the p_bearer was already set, so the ASSERT got triggered
the list_compare_add was failing as there was a p_bearer left after executing nrf_mesh_prov_listen_stop. Mesh error number returend was 95.
Then I tried calling nrf_mesh_enable() followed by nrf_mesh_prov_listen(&m_prov_ctx, m_params.p_device_uri, 0, PROV_BEARERS) that should start the listening
This would return with NRF_SUCCESS and the software would continue running until it was time to dispatch the advertisement packet about 2s later. At this stage it would break with the following call stack with error number 95. Which I haven't figured out yet where to find the meaning
There seems to be something wrong with the advertisement packet struct and it fails when trying to free a packet.
Am I missing some function calls that should be done before or after calling the start and stop functions for listening?
Any help would be appreciated
Could you explain me a little bit more on what you plan to create ? You want to make a provisioner who also is a provisionee ? I'm not sure what is that for.
Why do you want to call nrf_mesh_disable() when you just want to stop listening ? Can you just call nrf_mesh_prov_listen_stop() ?
When you see an assert with an address (0x2C7C2 in your case) , you can call addr2line.exe -e yourelffile.elf 0x2C7C2 to see where the assertion occurs.
Thanks for a quick reply.
The customer has some special algorithm they want to employ on the mesh that requires that some devices switch roles from time to time. I cannot disclose the algorithm due to NDA stuff but essentially I need a functionality where a device switches roles. Preferably done inside of nRF52 chip. Otherwise maybe it would make more sense to use the serial API and just use nRF52 as a modem, any suggestions on that?
I have tried with and without calling nrf_mesh_disable, either way I get the error when after nrf_mesh_prov_listen_stop() I call the nrf_mesh_prov_listen() and I also get an error if I try to reinitialize by calling the mesh_provisionee_prov_start() after stopping it.
I have found where the assert happens. After I call the nrf_mesh_prov_listen(), which returns NRF_SUCCESS, and the time comes to send out an advertisement packet. For some reason when it tries to fetch the next packet if fails to do a buffer free function. It seems like some flag does't get reset/set when the listen is started again
Thanks in advance