NOTE:
If you plan to use an example from the nRF5 SDK in combination with the mesh stack, move the mesh stack repository into the Nordic nRF5 SDK examples folder and include the necessary source files in the Nordic nRF5 SDK project that you want to use.
To do so, make the following changes:
patch -p3 < ../nRF5_SDK_14.2.0_17b948a.patch
(modify to point to your actual patch file location)core
, prov
, access
, dfu
, nrf_mesh_weak.c
, external/micro-ecc
, relevant model
and example
files, and (if used) serial
files and their include paths to the Nordic nRF5 SDK project.nrf_mesh_sdk
module (they will be replaced by corresponding functionality in the nRF5 SDK):app_error_handler
HardFault_Handler
SD_EVT_IRQHandler
softdevice_assert_handler
mesh_softdevice_enable
mesh_softdevice_setup
(including the call to it in mesh_core_setup
)m_ble_evt_buffer
NRF_MESH_LOG_ENABLE
to be NRF_LOG_USES_RTT
in nrf_mesh_config_core.h
, because the logging in the mesh stack relies on RTT.simple_hal
in the mesh stack may need to be updated to use the Nordic nRF5 SDK module bsp
. It is possible to use both, but in this case GPIOTE_IRQHandler
must be removed from one of the files and only one of the modules may register callback functions.fstorage
in the Nordic nRF5 SDK, add the following code block to nrf_mesh_config_core.h
: #error
message in top of file. Make other appropriate changes to file content, like adjusting ACCESS_ELEMENT_COUNT and ACCESS_MODEL_COUNT to the required number of elements and models.If there is no particular nRF5 SDK example that you want to start with, but instead you want to use some of the nRF5 SDK modules, it might be easier to move the respective nRF5 SDK modules into the mesh stack repository and create an example project using one of the methods provided by the mesh stack repository.
Using nRF5 SDK modules such as fstorage
, pstorage
, or ble_flash
for writing to flash may be problematic due to long timeslot
events occupied by the mesh stack. Use the Flash manager module provided by the mesh stack instead.
Furthermore, when writing to flash, ensure to not write or erase areas utilized by the mesh stack modules and the bootloader (if present). By default, the mesh modules utilize the last x
number of pages before the start of the bootloader, if present, or the last x
number of pages of the available flash on the Nordic SoC. The value of x
depends on the configuration of the mesh stack and can be calculated by:
The mesh stack relies on receiving the events generated by the SoftDevice for proper functioning. The SoftDevice may generate events relevant only to the application, only to the mesh stack, or both for application and the mesh stack. Therefore, it is important that the SoftDevice events reported via SD_EVT_IRQHandler
and extracted via sd_evt_get
are processed by the mesh stack as well as the relevant application handlers.
By design, the SoftDevice activity is prioritized over mesh activity. Therefore, you should keep the connection and advertisement intervals used by the SoftDevice as large as possible (i.e. infrequent) when using Bluetooth low energy connections. If scanning, keep the scan duty cycle as low as possible. You should also reduce mesh activity while the SoftDevice is doing fast advertising and continue normal activity after a connection is established.