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

Adding a new sdk module is too hard.

Isn't there an easier way to use the SDK?

For example, to use pwm, you need to change nrf_pwm_enable to 1 and nrfx_pwm_enable, nrfx_pwm0_enable, load_mode, step_mode, base_clock, and so on.

Not only that, you have to add the pwm driver file to the project.

Of course, if you want to use pwm only, you can import sdk_config.h of pwm sample and use it, but what if the project uses both ble and pwm at the same time?

Yesterday, I was just going to add USB charging detection function to the ble project.
It was easy to modify the main function.
All I had to do was add usbd initialization function and event handler.

But of course that doesn't work usbd alone.

I spent the whole day trying to figure out how to change the sdk_config.h file and which file to add to the project.

Tired of the build error, I eventually added all the files with the name usbd in the sdk folder to the project.

Still, there was another build error, so I added all the files with the name of clock and the name of power.

I changed sdk_config.h so much that I don't even remember what I changed.

The infocenter describes the function of the function and does not elaborate on these settings.

I think this is a little unreasonable. Or I'm working in an inappropriate way.

Today, I will make a program to compare two sdk_config.h files.
But I don't know if I should go this far.

Adding a new sdk module is too scary.
Let me know if there's a better way.

  • We all struggle with this <sigh> Maybe check out some other posts compare-sdk_config-files or (even more scary) switch to zephyr projects ;-)

  • Hi 

    As mentioned by Hugh this is familiar complaint, and is also discussed in this case

    It was reported internally back then, but improving this in the nRF5 SDK was never given priority, in part because of the large amount of work required to make an architectural change like this. 

    These days we are migrating more and more focus to the Zephyr based NCS platform (nRF Connect SDK), which has a much stronger configuration system than the nRF5 SDK, but since the build system and most of the software libraries differ it is not straight forward to migrate code from the nRF5 SDK to NCS. 

    Several software features (such as support for Bluetooth 5.2) and many hardware devices (nRF53 series or nRF91 series for instance) will only be supported by NCS, and if you want to leverage any of these then migrating to NCS is necessary. 

    Back to the nRF5 SDK, my own basic method for adding peripheral libraries to an SDK project is to open the example project side by side, and try to merge all the required code and configuration from the peripheral example into my own example. 

    I start by just copying the peripheral code from main.c into my own, which will lead to various build errors, and then I need to handle the errors one by one. 

    Compilation errors typically arise from missing include directories and missing configuration parameters in sdk_config.h

    Linker errors arise from missing source files, and drivers not being enabled in sdk_config.h

    If you are using BLE you should definitely start out with one of the BLE examples, rather than merge BLE from another example, as adding all the libraries used by the BLE stack is very time consuming. 

    If you are still struggling to merge the examples please let me know which examples you are trying to merge, and I will try to do it myself and send you a diff. 

    Best regards
    Torbjørn

Related