This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nrf5340 TWIS (nrfx) support for Zephyr

Hi everybody,

We are trying to port our previous firmware from nrf52840 to nrf5340. The first issue we encountered is TWIS support. It looks like something is missing as we get the following compile errors (and many more, but for example). 

error: unknown type name 'NRF_TWI_Type'; did you mean 'NRF_TWIS_Type'?
    NRF_STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type *p_reg,
                                              ^~~~~~~~~~~~
                                               NRF_TWIS_Type

static const nrfx_twis_t s_twis = NRFX_TWIS_INSTANCE(1);

void i2c_isr_installer(void)
{
    IRQ_CONNECT(DT_IRQN(DT_NODELABEL(i2c1)),
                DT_IRQ(DT_NODELABEL(i2c1), priority),
                nrfx_isr, nrfx_twis_1_irq_handler, 0);
}

The rest follows the example, and was working perfectly for the nrf5284 soc. It looks like to us that the only way to use TWIS is Nordic's HAL and not Zephyr I2C slave library.

The config options:

CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_NRFX_TWI=y
CONFIG_NRFX_TWIS=y
CONFIG_NRFX_TWIS1=y

Thanks for the help in advance.

Regards,

Milan

Parents
  • Hi,

    If you are not using the Zephyr driver, then set CONFIG_I2C=n, this config is only for the Zephyr driver and usually gets in the way when using nrfx directly. But if it was working on the nRF52840 with the nRF Connect SDK, then it might not be an issue.

    I think CONFIG_I2C_NRFX is also used by the zephyr driver, so it may be a good idea to remove that as well if you remove CONFIG_I2C.

    The TWI peripheral is deprecated, and replaced by the TWIS and TWIM peripherals. The nRF5340 only supports TWIS and TWIM, so remove CONFIG_NRFX_TWI=y.

Reply
  • Hi,

    If you are not using the Zephyr driver, then set CONFIG_I2C=n, this config is only for the Zephyr driver and usually gets in the way when using nrfx directly. But if it was working on the nRF52840 with the nRF Connect SDK, then it might not be an issue.

    I think CONFIG_I2C_NRFX is also used by the zephyr driver, so it may be a good idea to remove that as well if you remove CONFIG_I2C.

    The TWI peripheral is deprecated, and replaced by the TWIS and TWIM peripherals. The nRF5340 only supports TWIS and TWIM, so remove CONFIG_NRFX_TWI=y.

Children
Related