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

sdk_config.h difference nrf_ and nrfx_/Peripheral vs. Legacy

Hello,

I am trying to configure the SAADC for the NRF52810. I read that I have to enable it via the sdk_config.h. Here I find an entry for:

NRFX_SAADC_ENABLED - nrfx_saadc - SAADC peripheral driver

and

 SAADC_ENABLED - nrf_drv_saadc - SAADC peripheral driver - legacy layer

1. Which one do I choose?

2. Why is there no documentation on the usage and configuration of the SAADC?

3. What is the difference between "Drivers", "nrf_" files and "nrfx_" files?

  • Hi,

    1. It does not matter for the SAADC, but I recommend you go for the nrf_drv_saadc.

    2. You can find documentation for the SAADC peripheral here and the SAADC driver here.

    3. The old nrf_drv drivers were split in nrfx and a "legacy" layer to make it easier to integrate the low-level part (nrfx) in other software platforms. In some cases using nrfx directly is not a good idea, therefore you should usually use the integration layer, which is the "legacy" drivers in the nRF5 SDK.

    Some more details:

    The nrfx_saadc driver and the nrf_drv_saad driver are in practice identical, since the nrf_drv_saadc is mapped to nrfx_saadc by the preprocessor (see integration\nrfx\legacy\nrf_drv_saadc.h). This means that it does not matter what you use, you will end up with exactly the same result.

    This does not apply for all other drivers though, and my general advice is to use nrf_drv_* instead of using nrfx_*. The term "Legacy" gives the wrong idea. It is better to think of it like this: nrfx is a platform-independent low-level driver package, and the nrf_drv drivers are an integration layer for integrating it into the nRF5 SDK. Other platforms, such as for instance Zephyr, use nrfx as well, with its own integration and its own API. 

  • Einar,

    " This does not apply for all other drivers though, and my general advice is to use nrf_drv_* instead of using nrfx_*. "

    Your statement contradicts your colleagues as well as the sdk 16 documentation, all of them recommend to use nffx drivers instead of nrf (legacy) drivers since nrf drivers are being deprecated. Depending on the Nordic employee, we are getting a different opinion for the same question. Some consistency on this topic is really appreciated.

Related