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 again,

    johndoeaa1 said:
    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. 

    No worries at all - I am happy to help!

    johndoeaa1 said:
    Q1: I enabled the APP_TIME_ENABLED. It was already defined as 0. I changed it to 1. The error seems to have disappeared.

    Great, I am glad to hear that those errors are now resolved.

    johndoeaa1 said:
    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?

    I am not sure about the last part of your question, when you are asking which functions needs to be enabled, but in general you will need to enable each driver or module that you add to your project. In addition to enabling the driver or module you may also configure it in the sdk_config. An easy way to do this is to look up an existing example that uses the module already, and see what its relevant sdk_config configuration is - this way, you will get a working default configuration right off the bat, and you do not have to set all the configurations yourself.

    johndoeaa1 said:
    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.
    johndoeaa1 said:
    However, now most of my errors are multiple definitions. What should I do? 

    This is a good step in the debugging of the issue.
    Looking at the attached project I see that you have #included a .c file.

    #include "BLEUtil.c"

    You should never do this, and instead just include header files. Please take a look at this stackoverflow answer for more detail.
    Try to create a headerfile for your BLEUtil file, and include that instead. Also make sure that you have not included .c files anywhere else in your code as well.
    Try this, and let me know if it resolves your multiple definition errors.

    johndoeaa1 said:
    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).

    No problem at all! I recommend starting out from an existing example whenever possible / available - this is far better than writing everything from scratch to 'reinvent the wheel'. This approach might be slightly more boring than making it from scratch since it requires more studying of the existing code rather than writing it on your own at the beginning of the development, but overall I think this approach should be used whenever possible in order to save time.

    johndoeaa1 said:
    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.

    Yes, Sumair's tutorials are excellent for learning how to use the nRF5 SDK specifically, and how to make use of all the features of the nRF52 series. However, he does not cover general C errors and issues, since it is not specific to nRF development.
    I am not sure what to recommend you for general C issues, but my main recommendation would be to google the error messages you get when you try to compile your project and look at stackoverflow answers to see what the errors root cause might be. Then go through your code to see if you might have done anything similar.

    Best regards,
    Karl

  • Hello,

    Thanks a lot for your suggestions. It turns out that I had to remove some files from the Freertos folder in SEGGER to eliminate the multiple function declaration issue. The only issue I'm having is the undefined reference.

    The way I solved this issue is that I'd go to the example in the nRF5_SDK_14.2.0 folder and run the example ble_app_beacon. When a function is undefined in my ss_twr_resp example, I'd add the existing file, and add the file path to the preprocessor. This was enough to get rid of most of the undefined references.

    However, although I added the necessary files to SEGGER and double-checked my preprocessor path list, SEGGER doesn't detect them. The necessary files are there, such as "nrf_sdh_ble.h" for the nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start) issue, but SEGGER is not detecting it. I Googled the error and found sources, such as https://stackoverflow.com/questions/5559250/c-error-undefined-reference-to-function-but-it-is-defined. I don't think this is a general C issue, but might be a SEGGER one. I'd appreciate any kind of advice, and thanks a lot for your help man, I'd been making progress! Here's also my project in case I missed a detail:

    SPLICEDWM1001-Dev.rar

  • Hello,

    johndoeaa1 said:
    It turns out that I had to remove some files from the Freertos folder in SEGGER to eliminate the multiple function declaration issue.

    Great, I am glad to hear that you were able to identify and resolve those issues!

    johndoeaa1 said:
    However, although I added the necessary files to SEGGER and double-checked my preprocessor path list, SEGGER doesn't detect them. The necessary files are there, such as "nrf_sdh_ble.h" for the nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start) issue, but SEGGER is not detecting it

    Could you make sure that the path to these files does not exceed the 260 char limit set by Windows? Please also make sure that you have no trailing white-spaces anywhere in your User Included Directories - this will likely break the paths.
    In general, it is also recommended to make sure that you do not have any white-spaces in the paths provided, but this is more of a general c tip.

    johndoeaa1 said:
    Thanks a lot for your suggestions.
    johndoeaa1 said:
    thanks a lot for your help man, I'd been making progress!

    No problem at all - its great to see that you are progressing with identifying and resolving the issues!

    Looking forward to resolving these last undefined reference errors!

    Best regards,
    Karl

  • In the user included directory, I double-checked for trailing spaces and 260 character limits. I copied the user included directory to a text file and used control-F to find any spaces and it seems clear. I especially moved my project to my C: directory to get the shortest path possible. However, I'm still getting the same errors.

  • Great, thank you for letting me know.

    Could you confirm that you are making these changes in the options for the common build configuration? All other build configurations inherits from the common one, so if you make the change here it will apply to all your build configurations.

    If you are already doing this in the common build configuration, could you send me your SES project file so I may take a look, and also let me know what the absolute path to the file is in your system?

    johndoeaa1 said:
    I especially moved my project to my C: directory to get the shortest path possible.

    This is good. Could you confirm that you have moved the entire SDK to the top of the C: drive, and not just your project folder?
    I assume the former is the case, but I ask in order to rule out any misunderstandings here.
    The reason why the whole SDK must be moved is that the SDK examples all use relative paths in their included directories.

    Best regards,
    Karl

Reply
  • Great, thank you for letting me know.

    Could you confirm that you are making these changes in the options for the common build configuration? All other build configurations inherits from the common one, so if you make the change here it will apply to all your build configurations.

    If you are already doing this in the common build configuration, could you send me your SES project file so I may take a look, and also let me know what the absolute path to the file is in your system?

    johndoeaa1 said:
    I especially moved my project to my C: directory to get the shortest path possible.

    This is good. Could you confirm that you have moved the entire SDK to the top of the C: drive, and not just your project folder?
    I assume the former is the case, but I ask in order to rule out any misunderstandings here.
    The reason why the whole SDK must be moved is that the SDK examples all use relative paths in their included directories.

    Best regards,
    Karl

Children
Related