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

How to add mesh into nRF5 SDK v14.1/v15 BLE application ?

What do I need to know to add mesh functionality into a normal BLE application ?

Parents
  • This is an update for combining Mesh SDK v2.0.1 and nRF5 SDK v15

     

    In Mesh SDK v2.0.1 it's now easier to be used concurrently with the SDKv15. There is only a few modification needed. 

    To add mesh into your BLE project you would need:

    • Extract a fresh copy of nRF Mesh SDK to \components\mesh

    • Include all the source file from Mesh example you want to clone. 

    • Include all header folders from Mesh example in Project Option -> Common -> Preprocessor -> Include Directories

    • Include Preprocessor Definitions in mesh example ( same setting tab as above).

    • Remove mesh_softdevice_init.c and any call to it in main.c The softdevice is handled by nrf_sdk_ble module already. 
    • Edit main.c to add mesh init functions and defines.
    • Add nrf_mesh_evt_handler to SOC observer list with NRF_SDH_SOC_OBSERVER for example:

      void nrf_mesh_evt_handler(uint32_t sys_evt, void * p_context) {

       nrf_mesh_on_sd_evt(sys_evt);
      

      }

      NRF_SDH_SOC_OBSERVER(m_nrf_mesh_observer, 0, nrf_mesh_evt_handler, NULL);

    • Increase BLE advertising interval. We are seeing Mesh performance affected when advertising interval <100ms. 

     

    Attached here is an example combining ble_app_uart with light switch server. To test this you would need:

    • Extract nRF Mesh SDK into \SDKv15\components\mesh
    • Extract the example into \SDKv15\examples\ble_peripheral
    • Test it using the mesh's light switch provisioner and client in Mesh SDK v2.0.1

     

    ble_app_uart_mesh_SDK2_0_1.zip

     

     

     

     

     

     

Reply
  • This is an update for combining Mesh SDK v2.0.1 and nRF5 SDK v15

     

    In Mesh SDK v2.0.1 it's now easier to be used concurrently with the SDKv15. There is only a few modification needed. 

    To add mesh into your BLE project you would need:

    • Extract a fresh copy of nRF Mesh SDK to \components\mesh

    • Include all the source file from Mesh example you want to clone. 

    • Include all header folders from Mesh example in Project Option -> Common -> Preprocessor -> Include Directories

    • Include Preprocessor Definitions in mesh example ( same setting tab as above).

    • Remove mesh_softdevice_init.c and any call to it in main.c The softdevice is handled by nrf_sdk_ble module already. 
    • Edit main.c to add mesh init functions and defines.
    • Add nrf_mesh_evt_handler to SOC observer list with NRF_SDH_SOC_OBSERVER for example:

      void nrf_mesh_evt_handler(uint32_t sys_evt, void * p_context) {

       nrf_mesh_on_sd_evt(sys_evt);
      

      }

      NRF_SDH_SOC_OBSERVER(m_nrf_mesh_observer, 0, nrf_mesh_evt_handler, NULL);

    • Increase BLE advertising interval. We are seeing Mesh performance affected when advertising interval <100ms. 

     

    Attached here is an example combining ble_app_uart with light switch server. To test this you would need:

    • Extract nRF Mesh SDK into \SDKv15\components\mesh
    • Extract the example into \SDKv15\examples\ble_peripheral
    • Test it using the mesh's light switch provisioner and client in Mesh SDK v2.0.1

     

    ble_app_uart_mesh_SDK2_0_1.zip

     

     

     

     

     

     

Children
  • hi

    I tried your  ble_app_uart_mesh_SDK2_0_1.zip

    I am getting this error

    C:\nordic_semi\AAMergeSDK\nRF5_SDK_15.0.0_a53641a\examples\components\libraries\experimental_log\src\nrf_log_default_backends.c: No such file or directory

  • Hi, priya123.

    Did you encounter the problem of no such file or directory for "simple_on_off_server.h" and "hal.h"?

    If you have, may you tell me your solution? I tried to search, but i couldn't find it.

  • Hi

    I tried building the attached example using SES, it fails while linking

    Building ‘ble_app_uart_pca10040_s132’ from solution ‘ble_app_uart_pca10040_s132’ in configuration ‘Release’
    1> Assembling ‘thumb_crt0.s’
    2> Compiling ‘nrf_log_backend_rtt.c’
    3> Compiling ‘nrf_log_backend_serial.c’
    4> Compiling ‘nrf_log_default_backends.c’
    1> Compiling ‘nrf_log_frontend.c’
    3> Compiling ‘nrf_log_str_formatter.c’
    4> Compiling ‘app_button.c’
    2> Compiling ‘app_error.c’
    2> Compiling ‘app_error_handler_gcc.c’
    3> Compiling ‘app_error_weak.c’
    1> Compiling ‘app_fifo.c’
    4> Compiling ‘app_scheduler.c’
    2> Compiling ‘app_timer.c’
    3> Compiling ‘app_uart_fifo.c’
    1> Compiling ‘app_util_platform.c’
    4> Compiling ‘hardfault_implementation.c’
    1> Compiling ‘nrf_assert.c’
    3> Compiling ‘nrf_atfifo.c’
    2> Compiling ‘nrf_atflags.c’
    4> Compiling ‘nrf_atomic.c’
    1> Compiling ‘nrf_balloc.c’
    3> Compiling ‘nrf_fprintf.c’
    4> Compiling ‘nrf_fprintf_format.c’
    2> Compiling ‘nrf_fstorage.c’
    1> Compiling ‘nrf_fstorage_sd.c’
    3> Compiling ‘nrf_memobj.c’
    4> Compiling ‘nrf_pwr_mgmt.c’
    2> Compiling ‘nrf_section_iter.c’
    1> Compiling ‘nrf_strerror.c’
    2> Compiling ‘retarget.c’
    3> Assembling ‘ses_nRF_Startup.s’
    4> Assembling ‘ses_nrf52_Vectors.s’
    3> Compiling ‘system_nrf52.c’
    4> Compiling ‘boards.c’
    1> Compiling ‘nrf_drv_clock.c’
    2> Compiling ‘nrf_drv_uart.c’
    3> Compiling ‘nrfx_clock.c’
    2> Compiling ‘nrfx_gpiote.c’
    4> Compiling ‘nrfx_power_clock.c’
    1> Compiling ‘nrfx_prs.c’
    3> Compiling ‘nrfx_uart.c’
    4> Compiling ‘nrfx_uarte.c’
    1> Compiling ‘bsp.c’
    2> Compiling ‘bsp_btn_ble.c’
    1> Compiling ‘main.c’
    3> Compiling ‘SEGGER_RTT.c’
    4> Compiling ‘SEGGER_RTT_Syscalls_SES.c’
    2> Compiling ‘SEGGER_RTT_printf.c’
    4> Compiling ‘ble_advdata.c’
    3> Compiling ‘ble_advertising.c’
    2> Compiling ‘ble_conn_params.c’
    4> Compiling ‘ble_conn_state.c’
    1> Compiling ‘ble_link_ctx_manager.c’
    3> Compiling ‘ble_srv_common.c’
    2> Compiling ‘nrf_ble_gatt.c’
    4> Compiling ‘nrf_ble_qwr.c’
    1> Compiling ‘ble_nus.c’
    3> Compiling ‘nrf_sdh.c’
    4> Compiling ‘nrf_sdh_ble.c’
    2> Compiling ‘nrf_sdh_soc.c’
    1> Compiling ‘mesh_provisionee.c’
    2> Compiling ‘rtt_input.c’
    4> Compiling ‘simple_hal.c’
    3> Compiling ‘mesh_app_utils.c’
    3> Compiling ‘nrf_mesh_weak.c’
    2> Compiling ‘assertion_handler_weak.c’
    4> Compiling ‘internal_event.c’
    1> Compiling ‘nrf_mesh_configure.c’
    2> Compiling ‘aes.c’
    1> Compiling ‘msg_cache.c’
    3> Compiling ‘transport.c’
    4> Compiling ‘event.c’
    2> Compiling ‘packet_buffer.c’
    1> Compiling ‘flash_manager_defrag.c’
    4> Compiling ‘fifo.c’
    2> Compiling ‘nrf_flash.c’
    4> Compiling ‘packet_mgr.c’
    3> Compiling ‘net_state.c’
    1> Compiling ‘mesh_flash.c’
    2> Compiling ‘nrf_mesh_utils.c’
    4> Compiling ‘nrf_mesh.c’
    1> Compiling ‘queue.c’
    3> Compiling ‘hal.c’
    2> Compiling ‘aes_cmac.c’
    4> Compiling ‘timer_scheduler.c’
    3> Compiling ‘timer.c’
    1> Compiling ‘ticker.c’
    1> Compiling ‘rand.c’
    2> Compiling ‘nrf_mesh_opt.c’
    4> Compiling ‘timeslot.c’
    3> Compiling ‘bearer_event.c’
    1> Compiling ‘enc.c’
    2> Compiling ‘network.c’
    3> Compiling ‘net_packet.c’
    4> Compiling ‘msqueue.c’
    1> Compiling ‘nrf_mesh_keygen.c’
    2> Compiling ‘cache.c’
    4> Compiling ‘uri.c’
    3> Compiling ‘list.c’
    2> Compiling ‘log.c’
    1> Compiling ‘flash_manager.c’
    4> Compiling ‘ccm_soft.c’
    3> Compiling ‘toolchain.c’
    2> Compiling ‘replay_cache.c’
    3> Compiling ‘beacon.c’
    2> Compiling ‘flash_manager_internal.c’
    4> Compiling ‘core_tx.c’
    1> Compiling ‘heartbeat.c’
    2> Compiling ‘net_beacon.c’
    3> Compiling ‘fsm.c’
    4> Compiling ‘core_tx_adv.c’
    1> Compiling ‘mesh_stack.c’
    3> Compiling ‘access_publish.c’
    4> Compiling ‘access.c’
    2> Compiling ‘access_reliable.c’
    1> Compiling ‘device_state_manager.c’
    3> Compiling ‘ad_listener.c’
    2> Compiling ‘ad_type_filter.c’
    2> Compiling ‘adv_packet_filter.c’
    4> Compiling ‘advertiser.c’
    3> Compiling ‘bearer_handler.c’
    1> Compiling ‘broadcast.c’
    2> Compiling ‘filter_engine.c’
    3> Compiling ‘gap_address_filter.c’
    4> Compiling ‘radio_config.c’
    4> Compiling ‘rssi_filter.c’
    1> Compiling ‘scanner.c’
    2> Compiling ‘uECC.c’
    3> Compiling ‘prov_provisionee.c’
    4> Compiling ‘nrf_mesh_prov.c’
    1> Compiling ‘provisioning.c’
    2> Compiling ‘prov_beacon.c’
    3> Compiling ‘prov_utils.c’
    4> Compiling ‘prov_bearer_adv.c’
    1> Compiling ‘composition_data.c’
    2> Compiling ‘config_server.c’
    3> Compiling ‘packed_index_list.c’
    1> Compiling ‘health_server.c’
    3> Compiling ‘simple_on_off_server.c’
    1> Generating linker script ‘ble_app_uart_pca10040_s132.ld’
    1> Linking ble_app_uart_pca10040_s132.elf
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/bearer_handler.o: In function `TIMER2_IRQHandler':
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\bearer\src/bearer_handler.c:236: multiple definition of `TIMER2_IRQHandler'
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/rtt_input.o:E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\examples\ble_peripheral\ble_app_uart_mesh\common\src/rtt_input.c:55: first defined here
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/access.o: In function `packet_tx':
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\access\src/access.c:378: undefined reference to `access_loopback_handle'
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\access\src/access.c:362: undefined reference to `is_access_loopback'
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/access.o: In function `access_init':
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\access\src/access.c:980: undefined reference to `access_loopback_init'
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/broadcast.o: In function `broadcast_start':
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\bearer\src/broadcast.c:136: undefined reference to `mesh_pa_setup_start'
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/broadcast.o: In function `prepare_last_tx':
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\bearer\src/broadcast.c:107: undefined reference to `mesh_pa_lna_setup_stop'
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/broadcast.o: In function `radio_irq_handler':
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\bearer\src/broadcast.c:188: undefined reference to `mesh_pa_lna_disable_start'
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/broadcast.o: In function `end_action':
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\bearer\src/broadcast.c:172: undefined reference to `mesh_pa_lna_cleanup'
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/broadcast.o: In function `prepare_last_tx':
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\bearer\src/broadcast.c:107: undefined reference to `mesh_pa_lna_setup_stop'
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/scanner.o: In function `radio_start':
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\bearer\src/scanner.c:227: undefined reference to `mesh_lna_setup_start'
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\bearer\src/scanner.c:229: undefined reference to `mesh_pa_lna_setup_stop'
    1> Output/ble_app_uart_pca10040_s132 Release/Obj/scanner.o: In function `radio_stop':
    1> E:\git_repo\Tools\nRF5_SDK_15.0.0_a53641a\components\mesh\mesh\bearer\src/scanner.c:209: undefined reference to `mesh_pa_lna_cleanup'
    Build failed
    

    Am I missing something?

Related