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

Documentation about the sdk_config.h file; remove unnecessary project files.

I am trying to port an nRF51 project that runs on the nRF51 DK using Keil to the nRF52840 DK using Segger Embedded Studio. Clearly the best way to start is to take an example from the SDK which has all the Segger-specific stuff and hardware specific stuff and change those few files which the app developer actually writes (like main.c) and update for the new SoftDevice

In my case the Keil project uses SoftDevice calls for all the Bluetooth functionality and Flash. It handles the sd_ble_evt_get() and dispatching of events.  I know I will have to make a few modifications because there are changes in SoftDevice s130 to SoftDevice s140 but they are not extensive. However, the sdk_config.h file changes ARE huge and I don't know what 90% of it means. Is there any detailed documentation describing what all these config parameters mean? A few are obvious to me like turning off the service support like CTS, DIS, BATtery, etc. This project is an implementation of a proposed protocol and there is no support in the SDK for it. So I want to turn off all those items in the sdk_config.h file that I don't need, but I don't want to mess up something that will mess up that which is needed for the chip on the DK.

Eventually I want to remove all the files in the project that I don't need - that's not too easy either. It would be nice to have a final project which ONLY contains those files necessary to build this project.

How to proceed?

Parents
  • Hi, 

    nRF52840 is supported from SDK12.3, but only S132. S140 support nRF52840 started from SDK13.0. See SDKs and SoftDevices

    I would suggest you start from the ble_app_template in SDK12.3 then migrate to S140 of SDK13.0. You could use https://infocenter.nordicsemi.com/index.jsp to search for the configs in sdk_config.h to understand it. This Migrating from the nRF51 Series to the nRF52 Series might help. 

    -Amanda H.

  • I am using s140 and I am not using the SDK. Though I started with the hts project for segger from SDK 17.3.0 examples. I am trying to eliminate that what I don't need. Most of the content in the sdk_config.h file I do not understand.

  • I understand that NRF_BLE_GATT_ENABLED  enables the GATT module. That did not exist in 12.3.0 and since GATT has always been around, why is this present but not before. If I am using sd_ calls for ALL BTLE functions (think pc-ble-driver where ALL I have is sd_ methods) do I stilll need this GATT module? 

    Since these SDK_config.h options are not explained anywhere, I don't know what I need, and what I dont. What will cause conflicts if enabled but I don't use? If the advertisement module is enabled but I use sd_ calls to create and start my advertisments, will that cause a problem? Will it bloat the final built project? What is softdevice-only related versus SDK-only related? What is SOC related and still needed if one is just using sd_ calls? Some NRF stuff appears to be associated with SoftDevice, but others arent - like the clocks.

    Clearly I have looked through the infocenter. As many have stated the search engine is very weak and it is difficult to find topics unless you know EXACTLY where to look. If the search engine in the documentation was reasonable, far fewer people would need to ask so many questions on this site. The good thing is the responses are usually very timely. But no one can beat a decent search!

  • Hi, 

    brianreinhold said:
    That did not exist in 12.3.0 and since GATT has always been around, why is this present but not before.

    In SDK 13, a "GATT module" was introduced and is enabled by default. This module enables MTU request and Data Packet Length Extension (DLE). For all phones supporting BLE 4.2 and above, the examples in the SDK will work out of the box.

    For phones that support BLE 4.0 and/or BLE 4.1 only, MTU requests and DLE will not work. In that case, you will have to disable it in the SDK example: all you need to do is to comment out gatt_init(). See SDK13.0 Migration guide/GATT module 

    brianreinhold said:
    What will cause conflicts if enabled but I don't use? If the advertisement module is enabled but I use sd_ calls to create and start my advertisments, will that cause a problem? Will it bloat the final built project?

    To enable the configs in the SDK can let you use the specific modules/libraries/features/drivers. It won't cause an issue in that case. 

    Would you like to migrate the porject to SDK17.0.2  or start a new porject from SDK17.02? What is your application? I would suggest start from a similiar example to know what configs and features you would need. 

    -Amanda H.

  • In the end I ported my source code from Keil 12.3.0 (SoftDevice only for BTLE and Flash) to Segger 17.2.0 (SoftDevice only for BTLE and Flash), replacing the source files for the hts demo of 17.2.0. The part that caused me the greatest difficulty was the logging and the initialization of SoftDevice. In the end it turned out to be just two calls to SoftDevice that I needed and the removal of an SDK module that was getting called under the hood that was trapping and processing BTLE events before I could get them. Once I got logging and debugging to work I found that module was getting set up in the original ble_stack_init(). Otherwise the rest of SoftDevice API changes between s130 and s140 were minimal.

    By trial and error I have removed files from the build and have reduced the size considerably. Most of the options in SDK_config.h are now disabled. It turns out I need to enable FPRINTF in order to use NRF_LOG. I don't think this was intended but the NRF Log source file for strings makes calls into FPRINTF so enabling NRF_LOG and disabling FPRINT will give you build errors. I don't think the reverse is true.

    The project then built in Keil without an issue except it was 200 bytes too large to build in the size-limited free version that I have. Oh well, Segger does the job.

    I think it would be nice if you had an example that used JUST SoftDevice as there are many advantages of such a project - especially when migrating between versions and/or platforms. SoftDevice changes little -  the SDK changes dramatically and the footprint is much smaller.

    In my case I am working on a new standard for health devices and there is no support for it in the SDK. For experimental work, using SoftDevice only has great advantages!

  • Some examples under examples\peripheral just use SoftDevice. Hope they can help you. 

    -Amanda H. 

  • Which ones? There are a fair number!! I see mostly nrf_* SDK calls in the few I looked at. If there is a BTLE example using SoftDevice only that would be helpful though at this stage I have got it mostly working (but I may have done things that will come back and bite me).

    The best help I got was the example using the pc-ble-driver. My first work I did was to write a set of BLE health devices using the nrf52840 dongle with that package and that's all soft device. However, there are special initialization routines (clearly) in the pc-ble-driver which don't carry over to writing directly on the MCU. And that's where I encountered most of my difficulties. So seeing examples of that would still be advantageous.

Reply
  • Which ones? There are a fair number!! I see mostly nrf_* SDK calls in the few I looked at. If there is a BTLE example using SoftDevice only that would be helpful though at this stage I have got it mostly working (but I may have done things that will come back and bite me).

    The best help I got was the example using the pc-ble-driver. My first work I did was to write a set of BLE health devices using the nrf52840 dongle with that package and that's all soft device. However, there are special initialization routines (clearly) in the pc-ble-driver which don't carry over to writing directly on the MCU. And that's where I encountered most of my difficulties. So seeing examples of that would still be advantageous.

Children
Related