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

confusing about nrfx. How should I use it without legacy with old and do I need it?

I read somewhere for new project we should use nrfx driver because in future old nrf_drivers will not be support and improve. All examples in sdk15.3 as I understand used old nrf_drv..... Can I guess I used new abilities of new nrfx driver just replace

1. nrf_drv.... to nrfx.....

2. add to project existing file  from nRF5_SDK_15.3.0_59ac345\modules\nrfx\drivers\src\..... needed nrfx drivers

3. turn according nrfx driver in sdk_config.

or I need do something else (other)

Maybe there's clear manual how to transfer to the new nrfx world

Parents
  • Depending on who responds from Nordic you’ll get a number of different answers. The last answer I saw a few weeks ago suggested that nrfx shouldn’t be used because it isn’t SoftDevice safe. Apparently nrfx is lower level than nrf_drv and nrf_drv uses nrfx behind the scenes. It’s confusing as hell because apparently nrf_drv being “depreciated” doesn’t really mean it shouldn’t be used according to Nordic. 

Reply
  • Depending on who responds from Nordic you’ll get a number of different answers. The last answer I saw a few weeks ago suggested that nrfx shouldn’t be used because it isn’t SoftDevice safe. Apparently nrfx is lower level than nrf_drv and nrf_drv uses nrfx behind the scenes. It’s confusing as hell because apparently nrf_drv being “depreciated” doesn’t really mean it shouldn’t be used according to Nordic. 

Children
  • I could not find the answer you referred to (about nrfx not being SoftDevice safe). Could you provide a link?

  • Hi Simon,

    Here is the thread I was referring to. My reply may have been overly general as I made the comment without going back to look at the linked thread. A more accurate statement on my part would have been that not all of the nrfx drivers play nicely with the SoftDevice. I think Einar also implies that there is really no reason to switch from nrf_drv_* to nrfx_*, and I have seen this point of view in other threads that I do not have time to find. This has not stopped me from using nrfx_* in some of my libraries but it does create confusion.

  • UPDATE 7/21/2020:

    There have been some discussions internally and it seems like the answer provided below is not correct. There are no strong recommendations to use the NRFX drivers.

    Earlier in the SDK 15.2.0 NRFX migration guide, it said the following:

    "The legacy layer will no longer be supported in the future SDK releases."

    However, in the SDK 17.0.0 NRFX migration guide, this is updated to the following:

    "The migration process is not required and often results in exactly the same functionality. Consider migration only if you want to take advantage of the new features offered by nrfx."


    You are right Patrick, the answers regarding the use of the NRFX vs. the legacy drivers are not consistent. However, the SDK 15.0.0 migration guide strongly recommends to use the NRFX API for new applications. The justification is that the legacy layer will be deprecated and removed in future SDK releases.

    My recommendation is that one should use pick the drivers that fits their specific product and future plans. If you are planning to update your solution as new SDK's are released and want to decrease the amount of future work, you should use the NRFX drivers. If not, just use the SDK as it is, with the legacy "glue" layer.

    Regarding Einar's answer, you should take a look at the SDK 15.0.0 migration guide, where all the nrf_drv drivers which can't be easily swapped with NRFX functions, are listed. E.g. the nrf_drv_clock driver contains SoftDevice dependent code.

    The migration to NRFX drivers shouldn't be too difficult, if you follow the appropriate migration guide correctly you should be good, since you will be warned about the drivers that is difficult/can't be easily switched out, and the corresponding legacy drivers should be used. 

    Best regards,

    Simon

Related