BLE Service Discovery Start log is printed twice even though it's called once

Hello there

In the project of the company I work for, we have a device working as a BLE central which connects to a nearby device and checks if that device is registered with our desiring Service. Hence we call the ble_db_discovery_start (ONLY ONCE). But when checking the logs in Debug mode I see that the log which indicates the Service Discovery Start is printed twice. I tracked the printed log and ended up with a variable named m_num_of_handlers_reg which all of a sudden comes to be 2 (ble_db_discovery.c file).

Can anyone tell me why this variable is suddenly 2 while there is only one handler registered and registered_handler_set function (which is the only function that increases the value of m_num_of_handlers_reg) is never called?

SDK version: 17.1.0

Softdevice version 6.1.1

  • Hi

    So you have only registered one handler with the discovery module? Have you seen where the registered_handler_set() function has been called from? As it generally has to be called from another function because the application thinks it needs to increase the number of handlers registered.

    Do you have any logs or information on the registered_handler_set() function in your application?

    It's also worth noting that SoftDevice v6.1.1 and SDK v17.1.0 are not tested with each other and it's recommended to move to SoftDevice v7.2.0 or 7.3.0.

    Best regards,

    Simon

  • Thanks for your response Simon

    I tried moving to the latest version of the SoftDevice but it did not work. I only did the Memory adjustment stuff. Is there anything else I'm supposed to do?

  • Hi

    Can you explain what you mean about using the newest SoftDevice "did not work"? In the downloaded SoftDevice you have there should be a section/file of migration notes/guide that tells you if there is anything else that needs to be done than adjusting the FLASH/RAM start/size preprocessor settings.

    Best regards,

    Simon

  • Hello Simon
    I thought I answered this question but it looks like the answer was not posted...

    About "did not work" I mean not even the code executes after changing the Vector Table in Linker configuration in IAR project settings.

    What that I did was replacing the header files in sdk/components/softdevice/s140/headers directory and changing the allocated flash and RAM according to the documentation. 

    ROM start = 0x2700 (which previously was 0x2600)

    RAM start = 0x20001678 (which previously was 0x20001628)

    I also tried changing the preprocessor NRF_SD_BLE_API_VERSION from 6 to 7.

    Then I programmed the DK board using nrfConnect Programmer and the HEX file that built using IAR along with the Softdevice HEX file. But nothing happens after that. I even tried building the HEX in debug mode but no log is printed. It looks like nothing works at all after changing the .intvec start in IAR Linker configuration settings (Picture attached).
    And if I don't change the .intvec start, there is collision between application and softdevice hex files in nrfConnect Programmer!

    What is .intvec start in IAR linker configurations?
    The documentation does not say anything about changing preprocessors or something similar. Is there anything specific I have to do?

  • This issue was caused by a bug in my application code.

    About the Softdevice upgrade, I fixed my issue by allocating the RAM as shown in attached picture:

Related