Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Error: Multiple definition when using 2 BLE Services BLE_NUS and BLE_NUS_C

Hello,

We are using nRF52832 DK with SES IDE and latest SDK 15.0 sd 132. We have developed one multiplink central device and modified ble_nus_c with our application to connect our multiple ble sensor node.

 Everything is working central device is scanning and ble peripherals connect and send data to central.

We want advertising as well as scanning in central device so we can able to connect Nordic UART app with them.

Problem:

  1. We have added advertising functionality in central device now in central device have 2 services ble_nus and ble_nus_c.
  2. When i add ble_nus with existing ble_nus_c the following errors coming:

Building ‘ble_app_multilink_central_pca10040_s132’ from solution ‘ble_app_multilink_central_pca10040_s132’ in configuration ‘Release’
  Linking ble_app_multilink_central_pca10040_s132.elf
    Output/ble_app_multilink_central_pca10040_s132 Release/Obj/ble_nus.o:(.log_dynamic_data_ble_nus+0x0): multiple definition of `m_nrf_log_ble_nus_logs_data_dynamic'
    (.log_dynamic_data_ble_nus+0x0): first defined here
    Output/ble_app_multilink_central_pca10040_s132 Release/Obj/ble_nus.o: In function `sd_ble_gatts_service_add':
    multiple definition of `m_nrf_log_ble_nus_logs_data_const'
    D:\Permanent_monitoring_system\nRF5_SDK_15.0.0_a53641a\components\ble\ble_services\ble_nus_c/ble_nus_c.c:56: first defined here
Build failed

Why this multiple defination error coming please anyone help me i have also attached of my SES snap shot:

How i can do scanning and advertising in central device at same time with NUS and NUS_C ble services. 

Thanks in advanced...!!!!

Parents
  • Hello,

    I have solved this error by modified Segger setting which is go to ---> project--->option---->linker---->allow to multiple definition replaced Yes.

    Is this above method is right way to solve this multi definitions  issues.

    After compiling program build is successful but now problem is when i connect Nordic UART android  app to central is connected and notification also enabled. Android phone connection is working well able to send message to central device. But after disconnect app connection central device is already scanning and our sensor device is connected to central but not sending data to central.

    Now getting following error: 

    <error> nrf_ble_gatt: sd_ble_gatts_exchange_mtu_reply() returned NRF_ERROR_INVALID_PARAM.
    <info> app: Discovery complete.
    <info> app: Connected to device with Nordic UART Service.
    <info> app: Disconnected.
    <info> app: NUS central link 0x0 disconnected (reason: 0x13

    Our sensor device is connected to central then got the above error and after few second it is disconnected automatically.

    Another thing is when i connect first sensor device to central is working and also sensor device sent all data to central. But if android phone connect then try to connect sensor device is not working got above error.

    Why this happen please help me to solved this issue.

    Thanks...!! 

  • No that  is not the right way to solve the multiple definitions issue. The right way to solve it is  to find why you have two routines named the same. Most likely you have two routines named the same which do entirely different things and the linker has just picked one of them so it doesn't work for the other case. 

    You need to actually read the code you're compiling and work out where the symbols are coming from, There is no magic wand, you have to do the work.  

  • Thanks for your reply.

    Actually i have read and understand whole code but unable to find where the multiple definitions has defined. 

    will you please help me How i can identify multiple definitions issue and used one of them for well working.  Because compiler not showing any line number or whatever where exactly multiple definitions defined.

    Thanks  

Reply
  • Thanks for your reply.

    Actually i have read and understand whole code but unable to find where the multiple definitions has defined. 

    will you please help me How i can identify multiple definitions issue and used one of them for well working.  Because compiler not showing any line number or whatever where exactly multiple definitions defined.

    Thanks  

Children
No Data
Related