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

Using nrf BLE with DWM1001-DEV

I'm using DWM1001-DEV, which has UWB and nrf BLE features, and my ultimate goal is replicating Apple's Airtag with DWM1001-DEV. For this, I have to ensure the power consumption is small, and a coin battery should be enough for a year just like the Airtag. Therefore, I thought having the UWB feature sleep until woken up would be a good strategy. I thought I'd have the nrf listen to beacons at all times, and only activate the UWB when needed.

I downloaded DWM1001-DEV's example folder from https://github.com/Decawave/dwm1001-examples that includes the 14.2.0 nrf SDK folder as well. I'm using the example ss_twr_resp, and I'm trying to integrate BLE scanning into the board. However, I'm having some issues. 

I copied the main file source code from the ble_app_beacon example from nrf SDK to a new file in ss_twr_resp example to integrate BLE with UWB and give a demonstration (I haven't advanced to the scanning yet just trying to get BLE and UWB working together). I added all necessary files through SEGGER using "add existing file". Furthermore, for every file I added, I also went to the options of the project, into preprocessor, and added the folder path to "User included Directories". When I build the project, I get the following:

Mainly, I see two errors. Error 1 indicates there are two definitions of specific functions. I'm quite sure I did not define them twice. However, I don't know how to approach this problem.

Error 2 indicates undefined references, which are functions that cannot be found. Although I included the necessary file in SEGGER through "add existing file", and preprocessing, I still get this error (for instance app_timer.h is added, but app_timer_init() still is undefined, according to SEGGER). This is how I solved the same other errors I was getting, but these ones seem to persist.

Can anyone help me with this issue, please? I'd appreciate any comments or suggestions. Let me know if you need any other information. I hope my question was clear.

Parents
  • Hello,

    Thank you for your patience with this.

    I added all necessary files through SEGGER using "add existing file". Furthermore, for every file I added, I also went to the options of the project, into preprocessor, and added the folder path to "User included Directories".

    Great! Could you confirm whether you also enabled the different added modules in the sdk_config.h file?

    I still get this error (for instance app_timer.h is added, but app_timer_init() still is undefined, according to SEGGER).

    For example, when adding the application timer library to your project you will need to add the source file and include path (which you have already done), but you will also need to define APP_TIMER_ENABLED 1 in your sdk_config.h for the app_timer.c code to be compiled and included in your project.
    You will need to do this for all nrfx driver etc. that you will be using as well.
    Please also make sure that there is only a single *_ENABLED defined for each module. I.e do not have both TIMER_ENABLED and NRFX_TIMER_ENABLED defined (comment one of them out or remove it all together, do not just define it to 0) in your sdk_config as this may cause some trouble with which version of the drivers you are using.

    Mainly, I see two errors. Error 1 indicates there are two definitions of specific functions. I'm quite sure I did not define them twice. However, I don't know how to approach this problem.

    It is hard for me to comment on the multiple definition here without seeing the code, but it looks to be the an issue with a variable or function called 'advertise', which you should take a closer look at.

    Looking forward to resolving these issue together!

    Best regards,
    Karl

  • Thanks, man. Your answers are very clear I think. However, I'm a noob with SEGGER so please forgive me if I miss something obvious or inundate you with more questions. 

    Q1: I enabled the APP_TIME_ENABLED. It was already defined as 0. I changed it to 1. The error seems to have disappeared. However, now most of my errors are multiple definitions. What should I do? 

    Q2: I'm a little lost about sdk_config.h. I know what it does. However, when I add a file to my project, how can I know what to enable in that file or which functions need to be enabled?

    Q3: I changed my function name to advertise123 to ensure I'm not overlapping with any built-in variable/function name. However, the issue still seems to persist.

    I don't want to dump my project on your desk, but here's the zip file in case if you need more details. I modified the example ss_twr_resp (which I should have created my own project sorry).

    SPLICEDWM1001-Dev.zip

    Also, feel free to recommend me tutorials on these kinds of issues. I think the best tutorial in the field is https://www.youtube.com/watch?v=6__nNtWKYc4&ab_channel=Sumair%27sEmbeddedEngineering. However, I didn't think it went too much in detail about the issues I'm having.

    Best Regards.

     

  • Hello,

    I haven't been doing the preprocessor changes to the common, but just fixed that. However, the same errors seem to persist. I attached my project here:

    8688.SPLICEDWM1001-Dev.rar

    The nrf SDK folder is inside this project. So, It's relatively close to the C: drive

  • Hello again,

    Did it not make any difference when you moved all the changes to the common build configuration?
    What build configuration are you building your project with?
    What errors are you currently facing, is it still the undefined references to the FreeRTOS files?

    Best regards,
    Karl

  • Yes, I'm still getting the undefined errors only. Here's a screenshot:

    Though I'm not getting any RTOS errors I think

  • Can you make sure that you have defines in sdk_config such as NRF_SDH_BLE_ENABLED set to 1?
    Undefined references will often be the case if a file is not included correctly, or if the corresponding _ENABLED define is not set so that the file is not included in the compilation.

    Best regards,
    Karl

  • Hello, the change doesn't seem to clear the undefined errors I'm getting. Though it seems to resolve one of the errors as I'm getting only 1 error. These are the current errors I'm getting:

    The sdk_config file is very hard to modify as I'm not sure which variable I need to change when I use what specific functions. My current project state is:

    3414.SPLICEDWM1001-Dev.rar

Reply Children
  • I see that you have an undefined reference to sd_ble_gap_address_get and __app_ram_start__.
    Could it be that you have not included the necessary SoftDevice files, such as nrf_sdh.c, nrf_sdh_ble.c, nrf_sdh_soc.c, or similar, for example?

    Best regards,
    Karl

  • I already have all those files in Segger in my nRF_SoftDevice folder. I checked the ble_app_beacon project to find where all those functions belong. Afterwards, I added them to my current project. 

      

    Softdevice is included above in my project.

  • Please search your entire project (ctrl + shift + f) and search for the undeclared references. Are you able to find the undeclared functions in your project?
    If so, are they grayed out in the editor, or perhaps not showing up in the project index?
    If this is the case, look through the file to see if there is a define needed to enable the code, and if there is, make sure this define is defined in your sdk_config.

    You might also have to change your project defines if you have not already done so.
    What is the contents of your preprocessor defines in the project options for the common configuration?

    Best regards,
    Karl

  • I did that. It seems that the xPort error was converted into multiple definitions. However, I deleted the function xPortSysTickHandler from freertos to resolve it. Thankfully, no additional errors were produced, but I don't know if that's the correct way.

    I attempted to follow the same method with "undefined reference to `__app_ram_start__'". However, __app_ram_start__ is defined in several files and seems to be already declared. So, I'm not sure there is an undefined reference error.

    For the sd_ble_gap_address_get error that happens in ble_advdata.c, it's a function that's in ble_gap.h. However, ble_gap.c does not exist in the project after I did a search with control-f you recommended. My current errors are:


    And my current project is:

    3617.SPLICEDWM1001-Dev.rar

  • Hi,

    Karl is OoO so I have taken a look. Looking at your project and there are quite a few issues. I see that the Decawave example you have started with is quite stripped and there is a need for a significant amount of adjustments.

    I expect it will be faster and better to start of with a nRF5 SDK example that use a SoftDevice, and then copy in the Decawave related code. (Also, it looks to me like the Decawave specific code is easily portable to a newer nRF5 SDK, so if you intend to make a real product in the end that would make sense to get the latest bug fixes etc. But if you just want to get something working, then taking a BLE example form SDK 14.2 would probably be the fastest.)

Related