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

Are there any differences between SDK15 and SDK17 in configuring Custom Services?

Hi,

I'm trying to add a custom service to a working application that has a working battery service.

I have followed https://github.com/NordicPlayground/nRF52-Bluetooth-Course

I'm using SDK17.0.2 but does that make any difference in the way you should set up a Custom Service compared to SDK15?

Parents
  • Hi Jerker, 

    I don't think there is a big difference between SDK v15 and SDK v17 with regard to the customer service. 

    My suggestion is that you can go through the Course with SDK v15. Just to make sure all the steps work as they should. 

    After that you can start your development on SDK v17. It should be very very similar if not identical. 

    One good source of reference when you work on SDK v17 is to have a look at the ble_app_uart where we define and use a custom service called NUS. You can use that as an example. 

  • Hi Bui,

    I installed nRF5_SDK_15.3.0_59ac345 and after going over the steps in the course I got the FW running on my nRF52840-DK. (And I'm using s140).

    The device is visible if I look at my phone but I cannot connect to it, and nor can I bond to it, The first time I try to bond with it the debugger stops like in the attached snapshot:

    No error codes are printed what I can see.

  • Hi Bui,

    Yes, I'm following the debugging guide and I have tested a number of the examples in particular the ones concerning ble and yes, I understand that when debugging the code might crash if you continue to single step after a break point. You run the code from a restart to the break point where you can check your registers and variables etc with minimum impact to the integrety of the data you want to look at.

    But what was happening was not that I had any break point set, but rather that the the code frooze in the middle of some binary code when I tried to bond or connect, and that is a bit puzzeling.

    How ever, I have already tried with nRF5_SDK_15.0.0_a53641a but still not successful.

    I follow your suggestion and set a break point at BLE_GAP_EVT_CONNECTED and see if I can understand what goes wrong.

    Thx

    J

  • The course was a bit old and the person who created the course has left us so I don't have much experience with the code. 

    Please check and make sure the ble_app_template works for you. You may want to test by disable the calls that initialize the service/characteristic that you added. Adding a service/characteristic shouldn't really affect how the device react when get connected. 

    Be careful when you do bonding, try to test without any bonding and try to erase the chip before testing, just in case there's some previous bonding information left. 

  • No worries.

    ble_app_template works. I can connect to it from my mobile.

    I did not bond the device.

  • The only difference I can think of between https://github.com/NordicPlayground/nRF52-Bluetooth-Course and my own efforts is that I'm trying to do it on a nRF52840 SoC not a nRF52832. That leads me to use another softdevice:

    components/softdevice/s140/hex/s140_nrf52_6.0.0_softdevice.hex

    When I load and start my version of the custom_ble_service_example i get the following printouts in the Debug Terminal:

    err_code=0x0  // err_code printouts are RTT logs I added in the code I've written.
    err_code=0x0
    err_code=0x0
    err_code=0x0
    <info> app: Template example started.
    <info> app: Fast advertising.
    err_code=0x2006                                                 // If I wait long enough I get this printout:
    <error> app: ERROR 8198 [Unknown error code] at /home/jerrymek/src/avalon/precure/nRF5_SDK_15.0.0_a53641a/examples/ble_peripheral/custom_ble_service_example/main.c:474
    PC at: 0x00030D1D

    And the LED's stop blinking.

  • What are the correct memory setup for the nRF52840?

    The settings from the .emProject file are for nRF52832 as specified by the BT course:

    linker_section_placement_macros="FLASH_PH_START=0x0;FLASH_PH_SIZE=0x100000;RAM_PH_START=0x20000000;RAM_PH_SIZE=0x40000;FLASH_START=0x26000;FLASH_SIZE=0xda000;RAM_START=0x20002220;RAM_SIZE=0x0000dde0"

Reply Children
  • If you use ble_app_template for nRF52840 (PCA10056) you can find that the linker configuration as follows: 

    FLASH_PH_START=0x0

    FLASH_PH_SIZE=0x100000

    RAM_PH_START=0x20000000

    RAM_PH_SIZE=0x40000

    FLASH_START=0x26000

    FLASH_SIZE=0xda000

    RAM_START=0x20002210

    RAM_SIZE=0x3ddf0

    The RAM_START and RAM_SIZE may differ depends on your application configuration (number of custom services).

    Please follow the debug log when you get an issue. Please check what you have at main.c line 474.

    Most likely it's trying to enter deep sleep mode after advertising timeout but since you were running in debug mode (probably) it didn't sleep and enter the error NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN. This is normal.

    Please try to connect and check which error you have. 

  • Thanks for the FLASH and RAM configuration.

    Please see my previous answer this morning, I got it to work on RF5_SDK_15.0.0_a53641a.

    What remains now is to convert the solution to SDK17.

Related