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

Issue adding FDS module from BLE stack to the Mesh application

Hello, I'm trying to add a Peer Manager functionality to the Mesh Provisioner application.

I'm using nRF52832 devkit, Segger Embedded Studio, nRF5 SDK for Mesh 2.0.0 and nRF5 SDK 15.1.0.

Currently I've managed to add some BLE functionality to the Mesh application: connection and services. But to add password in order to secure the connection it's required to use the Peer Manager module, which in turn uses FDS library. Mesh uses its own flash library Flash Manager, so I applied a fix from the Infocenter (coexistence with nRF5 SDK BLE functionality) and added the following code in nrf_mesh_config_app.h:

#include "fds.h"
#include "fds_internal_defs.h"
#define FLASH_MANAGER_RECOVERY_PAGE_OFFSET_PAGES FDS_PHY_PAGES
The behavior is now the following: after reflashing the kit, the program crashes shortly after pm_init() with no error message, but after 3 manual restarts it proceeds further. 
I've discovered that function causing this behavior is fds_init(). It turns out that mesh initialization doesn't matter. Even if I try to simply initialize FDS like this in a mesh app, the program crashes:
fds_register(fds_evt_handler); // some user-defined handler
ERROR_CHECK(fds_init());
Could somebody explain what is causing such behavior and how to correctly use FDS in a mesh application? Thanks.
Related