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

Legacy (NRF) and NRFX drivers

Hi,

While going through some of the peripheral examples in 'nRF5_SDK_17.0.2', I found it puzzling to see that

  • the legacy (nrf_drv_*) and nrfx_* drivers are simultaneously enabled in the sdk_config.h.
  • In some examples, source files for both type of drivers are included while in others only one type.

Following is a screen-shot for gpiote example.

Why it is not sufficient to just include & enabled NRFX components (wherever available) in sdk_config.h file and include only the NRFX source file in a project? If not, is there a guide that describes when both NRFX and  NRF drivers and/or source files are needed.

Kind regards

Parents
  • Hi,

    the legacy (nrf_drv_*) and nrfx_* drivers are simultaneously enabled in the sdk_config.h.

    If the legacy drivers are enabled in the sdk_config.h file, the NRFX configs are overwritten in the file "apply_old_config.h". I think that the reason for both configs being included is to ease the transition for users wanting to switch to using the NRFX driver APIs directly. Note that the legacy configs needs to be completely removed from the sdk_config.h file if you want to use the NRFX driver, otherwise the configs are still overwritten even it the legacy configs are set to disabled (0).

    In some examples, source files for both type of drivers are included while in others only one type.

    The legacy driver APIs are still using the NRFX driver implementations in the bottom layer, most APIs are a simple redirect to the NRFX implementation, while some APIs require special translations/features. If the NRFX source files are not included, the legacy driver APIs will not function correctly.

    Why it is not sufficient to just include & enabled NRFX components (wherever available) in sdk_config.h file and include only the NRFX source file in a project? If not, is there a guide that describes when both NRFX and  NRF drivers and/or source files are needed.

    Many of the examples and libraries in the SDK still uses the legacy APIs, even if the NRFX driver is available. Migrating all examples and libraries to the nex NRFX APIs would require a lot of work, and in most cases it will not provide any increase in performance. There is a Migration guide for nrfx drivers available in the driver documentation.

    Best regards,
    Jørgen

     

  • Hi Jørgen,

    Thanks for the response. It cleared quite some ambiguity. So, if I enable only NRFX configs in sdk_config.h file (and exclude any mention of legacy configs), then it is sufficient to include only the NRFX source files in my project?

    Kind regards

Reply Children
No Data
Related