NCS - Devicetree & nrfx coexistence

Hi,

I have an application based on the "peripheral_uart" sample code (nRF52840DK, NCS2.70)

As I use interchangeably the same pins as GPIOs and UARTE1, I use UARTE1 with NRFX drivers:

nrfx_uarte_t uarte1_inst = NRFX_UARTE_INSTANCE(1)

This seems to work well.  Note that UARTE1 is not defined in the default devicetree file (nrf52840dk_nrf52840.dts) so I didn't modify app.overlay

My questions are -

  1. What should I do if I want to use NRFX peripherals that ARE defined in the default dts file (specifically - TWIM0 & TWIM1)
    I added the following to prj.cnf
    CONFIG_I2C=y
    CONFIG_I2C_NRFX=y
    CONFIG_NRFX_TWI0=y
    CONFIG_NRFX_TWI1=y
    But I fail to instantiate TWI instance:
        nrfx_twim_t twim_inst = NRFX_TWIM_INSTANCE(0); // Macro expansion error
  2. Is there a way to make a 'pure' NRFX project and get rid of all Devicetree references?

Thanks

Related