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.
  • Hello,

    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.

    This is because the app_timer used for the mesh is a slight modification of the app_timer existing in the SDK, which leads to your multiple definitions. However, since the ble_blinky example just uses the app_timer to monitor the button presses, you could rather change this to use the modified version of the app_timer from the mesh sdk, rather than trying to having each trying to use their own.

    What functionality are you trying to achieve with the merging of these two examples?
    Please know that it is not straight forward to merge BLE functionality into an existing Mesh example, since the mesh will use the radio 100% of the time, leaving no time for the BLE part.

    From the functionality description you've provided above, it sounds like it might be helpful for you to take a look at the light switch example from the mesh SDK. This basically implements the ble_blinky functionality in a mesh implementation.

    Best regards,
    Karl

  • Interesting.

    This is surprising!

    Our application is using BLE to probe/query/interact with a nrf52840 device but we also want to include that device inside a mesh network which is sharing sensor data (very small amounts) across multiple nodes.

    This suggests that enabling mesh and well as standard BLE is not advisable, or that the project would need to be completely moved to mesh protocols? Is there any way to back off the mesh use of the radio to allow more time for standard BLE?

    Appreciated!

  • ccasebeer said:
    Our application is using BLE to probe/query/interact with a nrf52840 device but we also want to include that device inside a mesh network which is sharing sensor data (very small amounts) across multiple nodes.

     Thank you for elaborating, this helps me understand your application use-case and issues.

    ccasebeer said:
    This suggests that enabling mesh and well as standard BLE is not advisable, or that the project would need to be completely moved to mesh protocols? Is there any way to back off the mesh use of the radio to allow more time for standard BLE?

    Sorry, I see now that my previous comment perhaps makes it seem like this is not possible - this is not the case - I was just trying to emphasize that merging BLE functionality into an existing mesh example is not necessarily straight forward, but it is possible. It is done as you mention, by using radio timeslots, so that the BLE communications can happen every so often in between the mesh radio usage. This works, since the BLE protocol is made to minimize the time the RADIO is in use.
    If you want to start looking at this, I recommend that you start by looking into the coexistance examples from the mesh SDK. These two examples demonstrate how BLE can be slotted into a mesh node.
    For the functionality you describe it sounds like you should take a look at the UART coexistence example.
    Using this example as a starting point, you can begin to implement both the mesh and BLE features you were seeking to achieve by merging ble_app_blinky into a mesh example.

    Please do not hesitate to ask if any part of my answer should be unclear!

    Best regards,
    Karl

  • I suppose I'm just trying to wrap my mind around if this is even a good idea, whether I should proceed with the merge of BLE and mesh/modify a coexistence example or not.

    The BLE usage is basically for setup and query at infrequent interval....perhaps once a week or month. However, the mesh would be turned on and left on. Beaconing maybe once every 10 minutes or 60 minutes or possibly even less. Data isn't 100% locked in right now, but 1-5floats seems appropriate on the mesh.

    Are there other stats on the BLE ormesh functionality which could help me gauge the ability of BLE to coexist with Mesh.

    My gut says to keep going with the merge and/or the coexistence and see what falls out.

    Another option that came to mind is having two firmwares. A BLE firmware and a mesh firmware and switch/boot/install between the two based on what is needed (setup vs running), or leverage two 52840's inside the device....one doing strictly mesh and the other doing strictly BLE.

    Appreciate the guidance.

  • I decided to look at the coexistance example as indicated. However, the project files are for a different board (not the 10056)

    So I decided to start with the ble_uart app project for the 10056 and add in the mesh similarly to how the coexistance project does it.

    I get right back to where I was with attempting to merge the mesh into the ble_blinky app.

    If I sub app_timer2.c in the base sdk

    for

    app_timer_mesh.c and app_timer_workaround.c in the mesh sdk

    the ble portion of the app no longer works. By no longer works, I  no longer am able to see the board advertising inside any of the nrF IOS utility apps.

    If I sub back in app_timer2.c along with the two preprocessor defines:

    APP_TIMER_V2

    APP_TIMER_V2_RTC1_ENABLED

    I am able to run the ble_uart demo in full.

    I have compiled in all mesh sdk source (except app_timer_mesh and app_timer_workaround) needed for coexistance, I just don't call any of it in main in both instances.

    Much appreciated.

Related