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

How to add mesh to BLE device

Hi,

I am currently working on a project, where I am porting an existing application to the NRF52840.
The porting of the functionality have been rather smooth, but i struggling now with adding MESH to my project and i wondoer if my use case is even possible to achieve.

The project is based on a copy of the enocean switch example from NRF MESH SDK. I use the following SDK versions: "nRF5 SDK 16.0.0" and "nrf5 SDK for Mesh v4.0.0"

The existing project is a BLE peripheral device, where we have a mobile app which can connect to the device and do commissioning and other setup of the device.
The device is capable of of exchanging data with other nearby devices, where we use the manufacturer specific data part of both the advertisement packet and scan response packet.
This sho9uld now be extended with MESH functionality. So taht the devices can be part of a BLE MESH network. The device must be able to function as node/relay node/proxy node.
Modelwise we currently only need generic on/off and generic level.

According to the following link, i get the impression that the above is possible:
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v4.0.0%2Fmd_doc_getting_started_how_to_nordicSDK.html&cp=7_2_1_8

Section: "Concurrent SoftDevice and mesh activity"

Quote: "When advertising with the SoftDevice, try using the highest advertising interval your usage scenario can tolerate.
If possible, turn off the SoftDevice advertiser when it is not needed, and activate it only when you expect to receive a connection request. If you only need to send non-connectable,
non-scannable advertisements (for example, for third party beacon protocols), use the Mesh Advertiser API, as it is optimized for minimal context switching when used together with the Mesh."

My application needs to transmit both connectable/scannable and non-connectable_scannble advertisment telegrams continually (no timeout), therefore is not possible to use the "Mesh Advertiser API" correct?
My application currently advertises with an interval of 200ms, so there should be time to do mesh advertisement.

I do as metioned here and use mesh rc callback:

"SoftDevice-based scanning has the biggest impact on the Mesh performance of all the SoftDevice activity.
The Mesh is not able to receive packets while the SoftDevice is scanning, so every SoftDevice scan window replaces Mesh scanning.
SoftDevice scanning should only be used when trying to establish connections or when active scanning is required.
If general passive BLE scanning is required (for listening for beacons or other third party activity), hook into the Mesh scanner by setting an RX callback with the nrf_mesh_rx_cb_set function."

The above has been has been tested on the DK and this seems to work.

It took sometime for me to understand that the nRF Mesh app, does not show devices which only uses ADV bearers. -> please mention that somewhere, like in the App.
I had to refer to the light switch demo to actually come to the conclusion that when i have configured my system using only ADV bearer, that it can be scanned and almost be provioned be the light switch provisoner.

As mentioned above the device must be able to function as a proxy node and there need to make the following settings: ( in my ADV bearer application those were set to 0 )

/**
 * @defgroup MESH_CONFIG_GATT GATT configuration defines
 * @{
 */
/** PB-GATT feature. To be enabled only in combination with linking GATT files. */
#define MESH_FEATURE_PB_GATT_ENABLED                    (1)
/** GATT proxy feature. To be enabled only in combination with linking GATT proxy files. */
#define MESH_FEATURE_GATT_PROXY_ENABLED                 (1)
/** @} end of MESH_CONFIG_GATT */

This compiles and runs, until app_error_handler is called from function mesh_adv_data_set() in mesh_adv.c with error code 4 (ERROR_NO_MEM). Looking at the code, I see that it uses the same API i use in the application to
do advertisement. Is that the reason for this or is there a setting somewhere i need to change/increase to get rid of this error. Note that from the description in the link above, I assume that the MESH code doers not run/advertise
while it is done in the BLE peripheral part.

Please advise, thank you.

Parents
  • Hi,

    As far as I can see this should be possible to do.

    My application needs to transmit both connectable/scannable and non-connectable_scannble advertisment telegrams continually (no timeout), therefore is not possible to use the "Mesh Advertiser API" correct?

    Yes, that is correct.

    It took sometime for me to understand that the nRF Mesh app, does not show devices which only uses ADV bearers. -> please mention that somewhere, like in the App.

    I will suggest to the developers to add something that mention this in the app.

    You will receive error code 4 (ERROR_NO_MEM) when you run out of memory, you can try allocate more memory, adjust the RAM size. See if that helps.

    I assume that the MESH code doers not run/advertise
    while it is done in the BLE peripheral part.

    Your assumption is correct. While the Softdevice is advertising the Mesh won’t be able to advertise. Like it is mentioned in the documentation, the SoftDevice activity will reduce the amount of time the Mesh gets on-air, and in order to maintain a consistently good Mesh performance, the SoftDevice radio parameters must be set as conservatively as possible.

    I also suggest you have a look at the coexistence examples if you haven’t already.

Reply
  • Hi,

    As far as I can see this should be possible to do.

    My application needs to transmit both connectable/scannable and non-connectable_scannble advertisment telegrams continually (no timeout), therefore is not possible to use the "Mesh Advertiser API" correct?

    Yes, that is correct.

    It took sometime for me to understand that the nRF Mesh app, does not show devices which only uses ADV bearers. -> please mention that somewhere, like in the App.

    I will suggest to the developers to add something that mention this in the app.

    You will receive error code 4 (ERROR_NO_MEM) when you run out of memory, you can try allocate more memory, adjust the RAM size. See if that helps.

    I assume that the MESH code doers not run/advertise
    while it is done in the BLE peripheral part.

    Your assumption is correct. While the Softdevice is advertising the Mesh won’t be able to advertise. Like it is mentioned in the documentation, the SoftDevice activity will reduce the amount of time the Mesh gets on-air, and in order to maintain a consistently good Mesh performance, the SoftDevice radio parameters must be set as conservatively as possible.

    I also suggest you have a look at the coexistence examples if you haven’t already.

Children
No Data
Related