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

How to use NRFX_TWIM and NRFX_SPIM together

Hi,

I have started a new project that will use I2C and SPI devices. As a starter I took the example at /examples/peripheral/gfx/pca10040 since I am using a ST7735 based TFT.

I've seen that GFX library uses nrfx_spim driver under the hood. So far everything has gone great until I try to use also nrfx_twim.

I get a compiler error for an IRQ_Handler redefinition:

/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_twim.o: in function `SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler':

/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_twim.c:847: multiple definition of `SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler';

/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_spim.o: /nRF5_SDK_17.0.2_d674dde/modules/nrfx/hal/nrf_spim.h:560: first defined here

I guess TWIM defines one handler, but SPIM another.

Which is the way of being able to use both ?

Parents
  • Hi Pablo

    Indeed, a few peripherals use the same instances. You can see an overview here of peripherals with shared IDs in the nRF52832. As you can see, there are only 3 SPI instances in total, and two of them are shared with the TWI instances as well, so it won't be possible to use 2 SPI instances and 2 TWIM instances on the nRF52832. You will need to move to the nRF52833 or nRF52840 to do more than 2+1.

    Best regards,

    Simon

Reply
  • Hi Pablo

    Indeed, a few peripherals use the same instances. You can see an overview here of peripherals with shared IDs in the nRF52832. As you can see, there are only 3 SPI instances in total, and two of them are shared with the TWI instances as well, so it won't be possible to use 2 SPI instances and 2 TWIM instances on the nRF52832. You will need to move to the nRF52833 or nRF52840 to do more than 2+1.

    Best regards,

    Simon

Children
Related