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

Attempting to merge base sdk ble_app_blinky with mesh sdk sensor/server example.

I am trying to merge the following projects:

SDK versions: 17.0.2 and 5.0

I have taken the contents of the mesh example sensor/server and merged it into the ble_blinky_example.

I am running into timer related merge issues.

I have successfully compiled but am confused on how to merge the following files.

From the ble_blinky_example I have the following timer related files and defines:

APP_TIMER_V2

APP_TIMER_V2_RTC1_ENABLED

/components/libraries/timer/app_timer2.c
from the mesh example I have the timer related files
/components/mesh/external/app_timer/app_timer_mesh.c">
./components/mesh/external/app_timer/app_timer_workaround.c">
Long story short, I was able to compile the two projects together with all source, but only by excluding the mesh related timer functions files, app_timer_mesh and app_timer_workaround. If I do this the base ble_blinky_app functions as normal and I can connect to it.
However, if I bring in the initialize() function from the mesh example, I have missing functions inside app_timer_mesh.c and app_timer_workaround.c.
I get multiple definitions such as this if I included everything:

  Linking ble_app_blinky_pca10056_s140.elf
    Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer_mesh.o: in function `app_timer_init':
    multiple definition of `app_timer_init'; Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer2.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\libraries\timer/app_timer2.c:525: first defined here
    Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer_mesh.o: in function `app_timer_create':
    multiple definition of `app_timer_create'; Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer2.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\libraries\timer/app_timer2.c:561: first defined here
    Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer_mesh.o: in function `app_timer_start':
    multiple definition of `app_timer_start'; Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer2.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\libraries\timer/app_timer2.c:573: first defined here
    Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer_mesh.o: in function `app_timer_stop':
    multiple definition of `app_timer_stop'; Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer2.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\libraries\timer/app_timer2.c:598: first defined here
    Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer_mesh.o: in function `app_timer_stop_all':
    multiple definition of `app_timer_stop_all'; Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer2.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\libraries\timer/app_timer2.c:606: first defined here
    Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer_mesh.o: in function `rtc1_counter_get':
    multiple definition of `app_timer_cnt_get'; Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer2.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\libraries\timer/app_timer2.c:626: first defined here
    Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer_mesh.o: in function `ticks_diff_get':
    multiple definition of `app_timer_cnt_diff_compute'; Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer2.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\libraries\timer/app_timer2.c:621: first defined here
    Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer_mesh.o: in function `app_timer_pause':
    multiple definition of `app_timer_pause'; Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer2.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\libraries\timer/app_timer2.c:631: first defined here
    Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer_mesh.o: in function `app_timer_resume':
    multiple definition of `app_timer_resume'; Output/Release/Obj/ble_app_blinky_pca10056_s140/app_timer2.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\libraries\timer/app_timer2.c:636: first defined here
    Output/Release/Obj/ble_app_blinky_pca10056_s140/simple_hal.o: in function `button_event_handler':
    undefined reference to `timer_now'
    S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\mesh\examples\common\src/simple_hal.c:88: undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/transport.o: in function `sar_ctx_tx_complete':
    undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/transport.o: in function `tx_retry_timer_reset':
    undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/transport.o: in function `rx_incomplete_timer_reset':
    undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/transport.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\mesh\mesh\core\src/transport.c:519: more undefined references to `timer_now' follow
    Output/Release/Obj/ble_app_blinky_pca10056_s140/timer_scheduler.o: in function `setup_timeout':
    undefined reference to `timer_start'
    S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\mesh\mesh\core\src/timer_scheduler.c:171: undefined reference to `timer_stop'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/timer_scheduler.o: in function `flag_event_cb':
    undefined reference to `timer_now'
    S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\mesh\mesh\core\src/timer_scheduler.c:178: undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/timer_scheduler.o: in function `fire_timers':
    undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/timer_scheduler.o: in function `timer_sch_init':
    undefined reference to `timer_init'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/timer_scheduler.o: in function `timer_sch_schedule':
    undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/timer_scheduler.o: in function `timer_sch_abort':
    undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/timer_scheduler.o: in function `timer_sch_reschedule':
    undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/timeslot_timer.o: in function `ts_timer_on_ts_begin':
    undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/heartbeat.o: in function `heartbeat_subscription_set':
    undefined reference to `timer_now'
    Output/Release/Obj/ble_app_blinky_pca10056_s140/net_beacon.o:S:\Desktop\remote_swedar\nRF5_SDK_17.0.2_d674dde\components\mesh\mesh\core\src/net_beacon.c:278: more undefined references to `timer_now' follow
Build failed
I can eleaborate, but in general, does anyone have any overall suggestions on merging the timing from ble_app_blinky with the timing from the mesh sensor examples?
Kind Regards.
  • Well.

    I had edited, the SDK after all. After removing my edits....

    The mesh part of the example works great. Provisions and will send mesh updates to the on/off server. Works great. Provisioner and Server running on 52840 DKs. 

    I now run into in the BLE part of the example.

    <error> nrf_ble_gatt: sd_ble_gap_data_length_update() (request) on connection 0x0 returned NRF_ERROR_RESOURCES.
    <error> nrf_ble_gatt: The requested TX/RX packet length is too long by 178/178 octets.

    Upon connecting with two different devices using the nRF Toolbox, one android, one ios. Thinking it might have been the connecting device. Does this error point to any parts of the sdk_config.h?

    I noticed this post had a similar issue with coexistance:

    devzone.nordicsemi.com/.../coexist-example-does-not-connect-iphone

    I will triple check the SDK for edits again.

    I also have the ability to Wireshark a connection.

    Now I will need to port this demo forward to the nrf52840, then to our development board and finally add a different model to the demo, targeting the sensor server/client paradigm.

  • Hello again,

    ccasebeer said:

    Well.

    I had edited, the SDK after all. After removing my edits....

    I see. I am happy that you were able to figure out the root of that issue! :)
    In general, I highly recommend that you do not make modifications directly in the SDK components and drivers, but rather that you make a copy of the file that is local to your project code, and modify it instead. This also makes sharing your code easier, since all project specific code is in the same place, and the SDK will function as expected for other people that are already familiar with the SDK.
    If you modify the SDK components and drivers in-place, it may break the SDK in unexpected/unintended ways - such as breaking the other examples.

    ccasebeer said:
    The mesh part of the example works great. Provisions and will send mesh updates to the on/off server. Works great. Provisioner and Server running on 52840 DKs. 

    Great! Glad to hear that that there are no issues with the mesh part.

    ccasebeer said:
    Upon connecting with two different devices using the nRF Toolbox, one android, one ios. Thinking it might have been the connecting device. Does this error point to any parts of the sdk_config.h?
    ccasebeer said:
    I also have the ability to Wireshark a connection.

    This would have been an excellent opportunity to capture a sniffer trace to see what is being request by the central directly when this happens, if we didnt have the detailed error message already. From the error message it is apparent that the central has requested a TX/RX length much longer than what the peripheral can support.
    What is your peripheral's connection event length configured to, and what connection event length is your central asking for specifically?
    Also, what is the value of your BLE_GAP_DATA_LENGTH_AUTO set to?

    ccasebeer said:
    I will triple check the SDK for edits again.

    If you are uncertain of the SDK's integrity I would recommend that you download it again, so that you know that you have an unmodified and complete starting point.

    ccasebeer said:
    Now I will need to port this demo forward to the nrf52840, then to our development board and finally add a different model to the demo, targeting the sensor server/client paradigm.

    Lets first resolve the current issues, so that the example returns to the expected behavior, before starting this work. This will make the porting easier, when you can be certain what to expect from the example.

    Looking forward to resolving this together!

    Best regards,
    Karl

Related