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

Error #5: cannot open source input file "nrf_sdh_ble.h": No such file or directory

Hello,

I'm trying to send and receive data between the nRF52832 chip and a phone by following this tutorial:

https://github.com/bjornspockeli/custom_ble_service_example

everything was going very well until I got to the end of point 5, where I have to add: 

NRF_SDH_BLE_OBSERVER(_name ## _obs,                                                                 
                     BLE_HRS_BLE_OBSERVER_PRIO,                                                     
                     ble_cus_on_ble_evt, &_name)

in ble_cus.h file, under:
#define BLE_CUS_DEF(_name)                                                                          
static ble_cus_t _name; 

after adding this part of code, I get an error in the .main file in BLE_CUS_DEF():

investigating, is apparently because I'm missing a define:         #include "nrf_sdh_ble.h"

after adding that definition, the error in BLE_CUS_DEF() disappears, but a new one appears in: #include "nrf_sdh_ble.h" :

I knew that this is because the library has not been added to the project or because the path has to be added, however, in the Manage Run Time Environment section there is no _sdh_ package (referring to the softdevice). I added to the path the address to the common file, where the file nrf_sdh_ble.h is located, but I keep coming up with the same error

I first added the full address to the path:

However, I found this link: https://devzone.nordicsemi.com/f/nordic-q-a/47294/i-am-getting-error-nrf_section_iter-h-no-such-file-or-directory-found-though-that-header-file-is-included-please-help-me-how-to-solve-this which explains that "Windows has a default path length limit of 256 characters" so I made a change and shortened the address:

But it was useless, I keep getting the same mistake, could someone please help me and tell me what's going on?

Thank you very much for your time and help!

  • I found the solution to the previous problem: "Switching to SEGGER Embedded Studio instead of using Keil"

    With SEGGER I followed the Custom Service Tutorial (github.com/.../custom_ble_service_example) and everything was going well, however at the end of step 8 a new problem arose:

    Implicit declaration of function 'ble_cus_init' [-Wimplicit-function-declaration]   (In function services_init(void))

    Besides, I'm using the nRF52 DK development board, halfway through the tutorial it advertised very well and I was able to connect via bluetooth, however it is NOT advertising anymore, could someone please help me with these problems please?

  • Hi.

    joshu2991 said:
    however it is NOT advertising anymore

    Did you leave it advertising until it reached the adveertising timeout? By default this might be 180s. After that the device will stop advertising and go to sleep. Waking the device using a button, or restart should restart the advertising.

    If that doesn't work, you might need to debug your device to see if there is an error keeping your device from advertising.

    Best regards,
    Joakim

  • Hi, first of all I'm sorry for the late response. I was checking and had a problem importing the .h and .c files from ble_cus, my error was that I was putting them directly into the folder from the file browser, but the correct way is:

    First add the files ble_cus.h and ble_cus.c inside the root folder custom_ble_service_example, once the files were already deposited there, I changed to Segger Embedded Studio.

    Within Segger, right click on the Application folder-> Add existing file-> browse and select the files we put in the root folder before.

    Once I added the files directly in the file browser (not with Add existing file in Segger) they appeared inside Segger anyway, but somehow they can't be read, in fact they don't appear with the little pink icon in the lower left corner. By doing it the way I explained it, this problem was solved. 

Related