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

Wrong usage of functions in examples? (SDK15.2.0)

Hello all,

I've recently started developing an nRF5 device (using Segger on Ubuntu, and SDK15.2.0), and for what I have read regarding peripheral drivers, I should be using functions starting with nrfx_, instead of nrf_drv_, since the latter ones are just left for legacy compatibility. Am I right?

If so, I don't know if I am not looking at the correct place, but I hardly find examples in the SDK which use nrfx_ naming, so I guess they have not been ported. Is this correct? I rely a lot in the examples to learn how this works, complementing it with the online documentation, but it's hard if they are "deprecated" and have to adapt them, with no guide or something (is there any?). All this comes from trying to develop some code and finding lots of errors from missing definitions. Apparently most of them come from configuring correctly the sdk_config.h file, but here I find definitions for both legacy and current functions...

Sorry if this is a very basic question, I have just been one week around, so I am doing my best to learn.

Thanks in advance!

  • Hi Halls,

                   I had the same problem. Very steep learning curve because a lot of knowledge is assumed. Yes lots of the examples have not been ported. There are also non Nordic examples - google them. Finally many of the nrfx functions are largely mirrored by the nrf series functions if you can find the right place. One thing is that there are about 4 ways of doing something for any specific thing. Essentially the same functionality or similar is implemented at different levels of abstraction.

    I found that the most useful tools were grep and the search function in my file manager. Between them I could generally find an example of what I wanted to do. Generally that was more useful than trying to find something in the stated examples or starting with the documentation. One big hole is the order and which things need to be done for each library/API. That information tends to only be in the code.

    After six weeks or so I am quite productive....

    Cheers Paul

  • Hi,

    Most of the nrfx drivers work like the old legacy drivers, you only need to change the name of the functions and configs. More details can be found in SDK 15.0.0 migration guide.

    I would recommend using the nrfx drivers, as these is the ones that will be updated in the future. If you do so, I recommend completely removing the legacy config from the sdk_config.h file, to avoid nrfx driver configs to be overwritten.

    Best regards,
    Jørgen

  • Thanks Paul and Jorgen for your replies, I will keep fighting while learning then :-) I will try to port the needed examples myself and see how they behave.

    Thanks for the tips!

Related