So I'm trying to implement Mesh OnOff server with BLE DFU supports. My implementation is as follows:
/* Copyright (c) 2010 - 2019, Nordic Semiconductor ASA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* HAL */
#include "boards.h"
#include "simple_hal.h"
#include "app_timer.h"
/* Core */
#include "nrf_gpio.h"
#include "nrf_mesh_config_core.h"
#include "nrf_mesh_gatt.h"
//#include "nrf_mesh_dfu.h"
#include "nrf_mesh_configure.h"
#include "nrf_mesh.h"
#include "mesh_stack.h"
#include "device_state_manager.h"
#include "access_config.h"
#include "proxy.h"
/* Provisioning and configuration */
#include "mesh_provisionee.h"
#include "mesh_app_utils.h"
/* Models */
#include "generic_onoff_server.h"
/* Logging and RTT */
#include "log.h"
#include "rtt_input.h"
/* Example specific includes */
#include "app_config.h"
#include "example_common.h"
#include "nrf_mesh_config_examples.h"
#include "light_switch_example_common.h"
#include "app_onoff.h"
#include "ble_softdevice_support.h"
#include "ble_dfu_support.h"
/* nRF5 SDK */
#include "nrf_soc.h"
#include "nrf_pwr_mgmt.h"
#define ONOFF_SERVER_0_LED (BSP_LED_0)
#define APP_ONOFF_ELEMENT_INDEX (0)
#define ONOFF_SERVER_0_LED_GPIO (NRF_GPIO_PIN_MAP(0,13))
#define LEDS_MASK_DFU_RUNNING (BSP_LED_0_MASK | BSP_LED_2_MASK)
#define LEDS_MASK_DFU_ENDED (BSP_LED_0_MASK | BSP_LED_1_MASK)
#define STATIC_AUTH_DATA {0x6E, 0x6F, 0x72, 0x64, 0x69, 0x63, 0x5F, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x5F, 0x31}
static bool m_device_provisioned;
static void app_onoff_server_set_cb(const app_onoff_server_t * p_server, bool onoff);
static void app_onoff_server_get_cb(const app_onoff_server_t * p_server, bool * p_present_onoff);
/* Generic OnOff server structure definition and initialization */
APP_ONOFF_SERVER_DEF(m_onoff_server_0,
APP_CONFIG_FORCE_SEGMENTATION,
APP_CONFIG_MIC_SIZE,
app_onoff_server_set_cb,
app_onoff_server_get_cb)
/* Callback for updating the hardware state */
static void app_onoff_server_set_cb(const app_onoff_server_t * p_server, bool onoff)
{
/* Resolve the server instance here if required, this example uses only 1 instance. */
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Setting GPIO value: %d\n", onoff)
nrf_gpio_cfg_output(ONOFF_SERVER_0_LED_GPIO);
if (onoff == true) {
nrf_gpio_pin_set(ONOFF_SERVER_0_LED_GPIO);
} else {
nrf_gpio_pin_clear(ONOFF_SERVER_0_LED_GPIO);
}
}
/* Callback for reading the hardware state */
static void app_onoff_server_get_cb(const app_onoff_server_t * p_server, bool * p_present_onoff)
{
/* Resolve the server instance here if required, this example uses only 1 instance. */
*p_present_onoff = nrf_gpio_pin_out_read(ONOFF_SERVER_0_LED_GPIO);
}
static void app_model_init(void)
{
/* Instantiate onoff server on element index APP_ONOFF_ELEMENT_INDEX */
ERROR_CHECK(app_onoff_init(&m_onoff_server_0, APP_ONOFF_ELEMENT_INDEX));
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App OnOff Model Handle: %d\n", m_onoff_server_0.server.model_handle);
}
//static bool fw_updated_event_is_for_me(const nrf_mesh_evt_dfu_t * p_evt)
//{
// switch (p_evt->fw_outdated.transfer.dfu_type)
// {
// case NRF_MESH_DFU_TYPE_APPLICATION:
// return (p_evt->fw_outdated.current.application.app_id == p_evt->fw_outdated.transfer.id.application.app_id &&
// p_evt->fw_outdated.current.application.company_id == p_evt->fw_outdated.transfer.id.application.company_id &&
// p_evt->fw_outdated.current.application.app_version < p_evt->fw_outdated.transfer.id.application.app_version);
//
// case NRF_MESH_DFU_TYPE_BOOTLOADER:
// return (p_evt->fw_outdated.current.bootloader.bl_id == p_evt->fw_outdated.transfer.id.bootloader.bl_id &&
// p_evt->fw_outdated.current.bootloader.bl_version < p_evt->fw_outdated.transfer.id.bootloader.bl_version);
//
// case NRF_MESH_DFU_TYPE_SOFTDEVICE:
// return false;
//
// default:
// return false;
// }
//}
//
//static const uint32_t * optimal_bank_address(void)
//{
// /* The incoming transfer has to fit on both sides of the bank address: First it needs to fit
// * above the bank address when we receive it, then it needs to fit below the bank address when
// * we install it. We want to put the bank address in the middle of the available application
// * code area, to maximize the potential transfer size we can accept. */
// const uint32_t * p_start;
// uint32_t dummy;
// ERROR_CHECK(mesh_stack_persistence_flash_usage(&p_start, &dummy));
//
// uint32_t middle_of_app_area = (CODE_START + (intptr_t) p_start) / 2;
//
// /* The bank can't start in the middle of the application code, and should be page aligned: */
// return (const uint32_t *) ALIGN_VAL(MAX(middle_of_app_area, CODE_END), PAGE_SIZE);
//}
//
//static void mesh_evt_handler(const nrf_mesh_evt_t* p_evt)
//{
// switch (p_evt->type)
// {
// case NRF_MESH_EVT_DFU_FIRMWARE_OUTDATED:
// case NRF_MESH_EVT_DFU_FIRMWARE_OUTDATED_NO_AUTH:
// if (fw_updated_event_is_for_me(&p_evt->params.dfu))
// {
// const uint32_t * p_bank = optimal_bank_address();
// __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Requesting DFU transfer with bank at 0x%p\n", p_bank);
//
// ERROR_CHECK(nrf_mesh_dfu_request(p_evt->params.dfu.fw_outdated.transfer.dfu_type,
// &p_evt->params.dfu.fw_outdated.transfer.id,
// p_bank));
// hal_led_mask_set(LEDS_MASK, false); /* Turn off all LEDs */
// }
// else
// {
// ERROR_CHECK(nrf_mesh_dfu_relay(p_evt->params.dfu.fw_outdated.transfer.dfu_type,
// &p_evt->params.dfu.fw_outdated.transfer.id));
// }
// break;
//
// case NRF_MESH_EVT_DFU_START:
// hal_led_mask_set(LEDS_MASK_DFU_RUNNING, true);
// break;
//
// case NRF_MESH_EVT_DFU_END:
// hal_led_mask_set(LEDS_MASK, false); /* Turn off all LEDs */
// hal_led_mask_set(LEDS_MASK_DFU_ENDED, true);
// break;
//
// case NRF_MESH_EVT_DFU_BANK_AVAILABLE:
// hal_led_mask_set(LEDS_MASK, false); /* Turn off all LEDs */
// ERROR_CHECK(nrf_mesh_dfu_bank_flash(p_evt->params.dfu.bank.transfer.dfu_type));
// break;
//
// default:
// break;
//
// }
//}
static void node_reset(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Node reset -----\n");
hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_RESET);
/* This function may return if there are ongoing flash operations. */
mesh_stack_device_reset();
}
static void config_server_evt_cb(const config_server_evt_t * p_evt)
{
if (p_evt->type == CONFIG_SERVER_EVT_NODE_RESET)
{
node_reset();
}
}
static void device_identification_start_cb(uint8_t attention_duration_s)
{
hal_led_mask_set(LEDS_MASK, false);
hal_led_blink_ms(BSP_LED_2_MASK | BSP_LED_3_MASK,
LED_BLINK_ATTENTION_INTERVAL_MS,
LED_BLINK_ATTENTION_COUNT(attention_duration_s));
}
static void provisioning_aborted_cb(void)
{
hal_led_blink_stop();
}
static void provisioning_complete_cb(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Successfully provisioned\n");
#if MESH_FEATURE_GATT_ENABLED
/* Restores the application parameters after switching from the Provisioning
* service to the Proxy */
gap_params_init();
conn_params_init();
#endif
#if BLE_DFU_SUPPORT_ENABLED
ble_dfu_support_service_init();
#endif
dsm_local_unicast_address_t node_address;
dsm_local_unicast_addresses_get(&node_address);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Node Address: 0x%04x \n", node_address.address_start);
hal_led_blink_stop();
hal_led_mask_set(LEDS_MASK, LED_MASK_STATE_OFF);
hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_PROV);
}
static void models_init_cb(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing and adding models\n");
app_model_init();
}
static void mesh_init(void)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Trying to init mesh stack\n");
mesh_stack_init_params_t init_params =
{
.core.irq_priority = NRF_MESH_IRQ_PRIORITY_LOWEST,
.core.lfclksrc = DEV_BOARD_LF_CLK_CFG,
.core.p_uuid = NULL,
.models.models_init_cb = models_init_cb,
.models.config_server_cb = config_server_evt_cb
};
uint32_t status = mesh_stack_init(&init_params, &m_device_provisioned);
switch (status)
{
case NRF_ERROR_INVALID_DATA:
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Data in the persistent memory was corrupted. Device starts as unprovisioned.\n");
break;
case NRF_SUCCESS:
break;
default:
APP_ERROR_CHECK(status);
}
// m_evt_handler.evt_cb = mesh_evt_handler;
// nrf_mesh_evt_handler_add(&m_evt_handler);
}
#if BLE_DFU_SUPPORT_ENABLED
/** Initializes Power Management. Required for BLE DFU. */
static void power_management_init(void)
{
uint32_t err_code = nrf_pwr_mgmt_init();
APP_ERROR_CHECK(err_code);
}
#endif
static void initialize(void)
{
__LOG_INIT(LOG_MSK_DEFAULT | LOG_SRC_DFU | LOG_SRC_APP | LOG_SRC_SERIAL, LOG_LEVEL_INFO, log_callback_rtt);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- Bluetooth OnOff Server with DFU support -----\n");
APP_ERROR_CHECK(app_timer_init());
hal_leds_init();
#if BLE_DFU_SUPPORT_ENABLED
ble_dfu_support_init();
power_management_init();
#endif
ble_stack_init();
#if MESH_FEATURE_GATT_ENABLED
gap_params_init();
conn_params_init();
#endif
#if BLE_DFU_SUPPORT_ENABLED
ble_dfu_support_service_init();
#endif
mesh_init();
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initialization complete!\n");
}
static void start(void)
{
if (!m_device_provisioned)
{
static const uint8_t static_auth_data[NRF_MESH_KEY_SIZE] = STATIC_AUTH_DATA;
mesh_provisionee_start_params_t prov_start_params =
{
.p_static_data = static_auth_data,
.prov_complete_cb = provisioning_complete_cb,
.prov_device_identification_start_cb = device_identification_start_cb,
.prov_device_identification_stop_cb = NULL,
.prov_abort_cb = provisioning_aborted_cb,
.p_device_uri = EX_URI_LS_SERVER
};
APP_ERROR_CHECK(mesh_provisionee_prov_start(&prov_start_params));
}
mesh_app_uuid_print(nrf_mesh_configure_device_uuid_get());
APP_ERROR_CHECK(mesh_stack_start());
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Mesh OnOff server with DFU support started!\n");
hal_led_mask_set(LEDS_MASK, LED_MASK_STATE_OFF);
hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_START);
}
int main(void)
{
initialize();
start();
for (;;)
{
(void)sd_app_evt_wait();
}
}
These are my app_config.h and nrf_mesh_config_app.h
/* Copyright (c) 2010 - 2019, Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form, except as embedded into a Nordic * Semiconductor ASA integrated circuit in a product or a software update for * such product, must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. Neither the name of Nordic Semiconductor ASA nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * 4. This software, with or without modification, must only be used with a * Nordic Semiconductor ASA integrated circuit. * * 5. Any software provided in binary form under this license must not be reverse * engineered, decompiled, modified and/or disassembled. * * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef APP_CONFIG_H__ #define APP_CONFIG_H__ /** Override default sdk_config.h values. */ #define NRF_SDH_ENABLED 1 #define NRF_SDH_BLE_ENABLED 1 #define NRF_SDH_SOC_ENABLED 1 #define APP_TIMER_ENABLED 1 #define APP_TIMER_KEEPS_RTC_ACTIVE 1 #define APP_TIMER_CONFIG_RTC_FREQUENCY 0 /** Controls if the model instance should force all mesh messages to be segmented messages. */ #define APP_CONFIG_FORCE_SEGMENTATION (false) /** Controls the MIC size used by the model instance for sending the mesh messages. */ #define APP_CONFIG_MIC_SIZE (NRF_MESH_TRANSMIC_SIZE_SMALL) /** Configuration for the BLE SoftDevice support module to be enabled. */ #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 69 #define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 1 #define NRF_SDH_BLE_SERVICE_CHANGED 1 #define NRF_BLE_CONN_PARAMS_ENABLED 1 /** Configuration for the BLE DFU support module to be enabled. */ #define FDS_ENABLED 1 #define NRF_BLE_GATT_ENABLED 1 #define NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS 0 #define NRF_DFU_TRANSPORT_BLE 1 #define NRF_FSTORAGE_ENABLED 1 #define NRF_PWR_MGMT_ENABLED 1 #define NRF_PWR_MGMT_CONFIG_AUTO_SHUTDOWN_RETRY 1 #define NRF_SDH_BLE_SERVICE_CHANGED 1 #define NRF_SDH_BLE_VS_UUID_COUNT 1 #define PEER_MANAGER_ENABLED 1 #define PM_CENTRAL_ENABLED 0 #define NRFX_POWER_ENABLED 0 #define POWER_ENABLED 0 #endif /* APP_CONFIG_H__ */
/* Copyright (c) 2010 - 2019, Nordic Semiconductor ASA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NRF_MESH_CONFIG_APP_H__
#define NRF_MESH_CONFIG_APP_H__
/**
* @defgroup NRF_MESH_CONFIG_APP nRF Mesh app config
*
* Application side configuration file. Should be copied into every
* application, and customized to fit its requirements.
* @{
*/
/**
* @defgroup DEVICE_CONFIG Device configuration
*
* @{
*/
/** Device company identifier. */
#define DEVICE_COMPANY_ID (ACCESS_COMPANY_ID_NORDIC)
/** Device product identifier. */
#define DEVICE_PRODUCT_ID (0x0000)
/** Device version identifier. */
#define DEVICE_VERSION_ID (0x0000)
/** @} end of DEVICE_CONFIG */
/**
* @defgroup ACCESS_CONFIG Access layer configuration
* @{
*/
/**
* The default TTL value for the node.
*/
#define ACCESS_DEFAULT_TTL (8)
/**
* The number of models in the application.
*
* @note To fit the configuration and health models, this value must equal at least
* the number of models needed by the application plus two.
*/
#define ACCESS_MODEL_COUNT (3)
/**
* The number of elements in the application.
*
* @warning If the application is to support _multiple instances_ of the _same_ model, these instances
* cannot be in the same element and a separate element is needed for each new instance of the same model.
*/
#define ACCESS_ELEMENT_COUNT (1)
/**
* The number of allocated subscription lists for the application.
*
* @note This value must equal @ref ACCESS_MODEL_COUNT minus the number of
* models operating on shared states.
*/
#define ACCESS_SUBSCRIPTION_LIST_COUNT (ACCESS_MODEL_COUNT)
/**
* The number of pages of flash storage reserved for the access layer for persistent data storage.
*/
#define ACCESS_FLASH_PAGE_COUNT (1)
/**
* @defgroup ACCESS_RELIABLE_CONFIG Configuration of access layer reliable transfer
* @{
*/
/** Number of the allowed parallel transfers (size of the internal context pool). */
#define ACCESS_RELIABLE_TRANSFER_COUNT (ACCESS_MODEL_COUNT)
/** @} end of ACCESS_RELIABLE_CONFIG */
/** @} end of ACCESS_CONFIG */
/**
* @ingroup HEALTH_MODEL
* @{
*/
/** The number of instances of the health server model. */
#define HEALTH_SERVER_ELEMENT_COUNT (1)
/** @} end of HEALTH_MODEL */
/**
* @defgroup DSM_CONFIG Device State Manager configuration
* Sizes for the internal storage of the Device State Manager.
* @{
*/
/** Maximum number of subnetworks. */
#define DSM_SUBNET_MAX (4)
/** Maximum number of applications. */
#define DSM_APP_MAX (8)
/** Maximum number of device keys. */
#define DSM_DEVICE_MAX (1)
/** Maximum number of virtual addresses. */
#define DSM_VIRTUAL_ADDR_MAX (1)
/** Maximum number of non-virtual addresses.
* - Generic OnOff publication
* - Health publication
* - Subscription address
*/
#define DSM_NONVIRTUAL_ADDR_MAX (8)
/** Number of flash pages reserved for the DSM storage. */
#define DSM_FLASH_PAGE_COUNT (1)
/** @} end of DSM_CONFIG */
/** @} */
/**
* @defgroup NRF_MESH_CONFIG_CORE Compile time configuration
* Configuration of the compilation of the core mesh modules.
* @ingroup CORE_CONFIG
* @{
*/
/**
* @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 */
/** Enable the Friend feature. */
#define MESH_FEATURE_FRIEND_ENABLED (0)
/** Enable Advertising-based provisioning bearer, PB-ADV. */
#define MESH_FEATURE_PB_ADV_ENABLED 0
/**
* @defgroup BLE_SOFTDEVICE_SUPPORT_CONFIG BLE SoftDevice support module configuration.
* @ingroup MESH_API_GROUP_APP_SUPPORT
* Configuration for compile time. Part of BLE SoftDevice support module.
*
* @{
*/
#define GAP_DEVICE_NAME "nRF5x Mesh Light"
/** @} end of BLE_SOFTDEVICE_SUPPORT_CONFIG */
/** Enable BLE DFU support module. */
#define BLE_DFU_SUPPORT_ENABLED 1
/** @} end of DFU_SUPPORT_CONFIG */
/** Enable RTT Input support. */
#define RTT_INPUT_ENABLED 1
/** @} end of RTT_INPUT_CONFIG */
/** Enable support for LEDs. */
#define SIMPLE_HAL_LEDS_ENABLED 1
/** @} end of SIMPLE_HAL_CONFIG */
/**
* @defgroup NRF_MESH_CONFIG_PROV_BEARER Provisioning Bearer Configuration
* Compile time configuration of the provisioning bearers.
* @{
*/
/**
* The default advertisement interval of the unprovisioned beacon. Meant for PB-GATT.
*
* @warning If the advertisement interval is set to below 200 ms, the mesh will not be able to
* allocate sufficiently large timeslots for its persistent backend from the SoftDevice.
*/
#define NRF_MESH_PROV_BEARER_GATT_UNPROV_BEACON_INTERVAL_MS 2000
/**
* Duration of the Mesh GATT Proxy Node Identity advertisements.
*
* @note Override the default duration (60 seconds) to save power.
*/
#define MESH_GATT_PROXY_NODE_IDENTITY_DURATION_MS 5000
/**
* Default Proxy state.
*
* @note This define overrides the default proxy state. If set to false, the device will advertise the Node
* Identity, but will not fall back to advertising the Network ID after provisioning.
*/
#define PROXY_ENABLED_DEFAULT (true)
/** @} end of NRF_MESH_CONFIG_PROV_BEARER */
/** @} end of NRF_MESH_CONFIG_CORE */
#endif /* NRF_MESH_CONFIG_APP_H__ */
I face this error when I debug it through Segger Studio:
<t: 0>, main.c, 311, ----- Bluetooth OnOff Server with DFU support ----- <t: 10797>, main.c, 272, Trying to init mesh stack <t: 11322>, app_error_weak.c, 108, Mesh assert at 0x0002D62E (:0)
Which is traced to this line inside flash_manager.c:
NRF_MESH_ASSERT(metadata_is_valid(&p_manager->config.p_area[i].metadata));
Any possible change that I can make? It was running fine before I made some changes to accomodate the DFU (borrowing idea from the experimental_lpn example).
My board is a custom NRF82540 board using Mesh SDK 3.2.0 with nRF SDK 15.3.0 and SoftDevice s140_nrf52_6.1.1, bootloader complied from the secure_bootloader example. I have "Erase All" before I run the debugging.