Issues for using nrfx libraries in nRF connect SDK

Hi,

At the "academy.nordicsemi.com", there are some study guides for nRF Connect SDK (Fundamentals).

In the nRF Connect SDK, there is a new type of sturct (not used in nRF5 SDK); device driver model

there are driver models for uart, i2c ...

Then, what is the difference between these drivers and

nrfx libraries, such as "drivers/i2c" and "nrfx_twi" ?

Then, when the nRF SoC control the peripheral module (such as uart, pwm, i2c, spi, etc.),

Is this right...?

1) if zephyr provide the driver models for nRF SoC -> use driver model,

2) if not provide, -> use nrfx_library ...?

I'm sorry about this weird question...

Thanks

Daewoong Kim

  • Hi Daewoong

    The nrfx libraries were made internally in Nordic specifically for our devices, and more or less every hardware peripheral in the nRF devices have a corresponding nrfx driver for using it. 

    The nrfx libraries are used by both the older nRF5 SDK and the newer nRF Connect SDK, and is a very low level driver that sits directly on top of the hardware. 

    The Zephyr drivers are generic drivers that work across all the different devices supported by Zephyr, not only Nordic devices. The Zephyr drivers go on top of the nrfx drivers, and ensures that you can interface the Nordic peripherals in the same way as any other device in Zephyr. 

    1) if zephyr provide the driver models for nRF SoC -> use driver model,

    2) if not provide, -> use nrfx_library ...?

    I would say this is a good starting point, yes. 

    Normally it is always recommended to use the standard Zephyr driver, but in the case where no Zephyr driver exists (like for the PPI controller), or where the Zephyr driver is missing some functionality that is critical for your application, then you can use the nrfx driver directly. 

    For reference, I made a small example to show how to use the nrfx_timer driver here, and one with nrfx_pwm here. 

    Best regards
    Torbjørn

  • Hi ovrebekk

    Thank you for giving much detailed answer, and also example.

    That's what i exactly want to know..!

    Have a nice day,

    Daewoong Kim

  • Hi Daewoong

    I am happy I could help out. The best of luck with your project Slight smile

    Best regards
    Torbjørn

  • Hi, sorry to revive this thread, but I thought it was very related. Just an small question:

    I'm also using the nrfx_pwm.h driver. I have also used CONFIG_NRFX_PWM0 = y (in Kconfig), to enable the PWM0 peripheral.

    Do I also have to do something in the devicetree regarding PWM0? or does nrfx_pwm ignores and overrides anything set for PWM0 in the devicetree file?

  • Hi 

    There is no need to set up anything in the device tree configuration in order to use the nrfx libraries, no, but if there is already something configured in the device tree that uses the same PWM controller then you might get a conflict. 

    Best regards
    Torbjørn

Related