This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to switch a node into provisioning/configuration mode (to configure with nRFMesh App) and then into coexistence mode with simultaneous BLE Central and BLE Mesh functionality?

Application Summary:  My application is a mesh node that also implements a BLE central (to periodically connect to a BLE peripheral) and acts as a mesh relay with custom mesh models to send data across the mesh to a gateway node.

Environment:  I am using nRF Mesh Stack v3.2.0 on the nRF52832 (SDK 15.3.0) with soft device v6.1.1.  Development environment is Segger Embedded Studio.

I originally based my application off one of the Coexistence examples in the Mesh SDK, and the application works fine as described above.  Currently, to provision and configure a new node with the nRF Mesh App I create a separate build of code with MESH_FEATURE_PB_GATT_ENABLED and MESH_FEATURE_GATT_PROXY_ENABLED both set to 1.  In this mode, the central is not initialized and the mesh stack is initialized with the necessary GATT functionality to allow the nRF Mesh app to provision and configure the device.  After provisioning/configuration I rebuild the code with PG-GATT/GATT-Proxy defines set to 0 and the app works without issue. I found that the app will not work properly with the defines left set to 1 probably due to conflicts with multiple gatt instances, etc.

The problem I need to solve:

I'd like to avoid loading a separate build of code to provision/configure the device but instead do something like hold a button on powerup which runs the code with the PB-GATT/Proxy functionality enabled.  After provisioning/configuring the device, just reset it and the normal app code (BLE Central + Mesh) runs. 

I found this post https://devzone.nordicsemi.com/f/nordic-q-a/46793/problems-with-coexisting-examples-for-mesh-nrf52832-ios-nrf-mesh where it is mentioned doing what I am looking to do " ....in order to support PB-GATT, the most practical way to do so is to let the device enter one of two states, depending on whether it is provisioned into a network or not.  On startup, if the device is not part of a mesh network, it should initialize provisioning over GATT Bearer, but not initialize the other (normal) BLE services. That way, the mesh stack can be used to provision the device. Once provisioned, the device should reset."

The issue is that the PB_GATT/Proxy functionality is enabled by a set of defines (in nrf_mesh_config_prov.h and nrf_mesh_config_core.h) and these defines are used to conditionally compile code throughout files in the mesh stack.  What is the recommended way to go about selecting PB-GATT/Proxy vs. run the mesh+BLE app on startup?  There's got to be a better way than replacing the #defines in the stack with a flag of some sort that indicates if the button was pushed or not.

Regards,

rich_l

Parents Reply Children
Related