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

SPI and TWI Error

I'm writing an nRF52 DK btle application using SDK 12. The DK comunicates with 2 external peripheral via SPI and I2C interfaces. Complilation fails with the error:

._build\spi_twi_example.axf: Error: L6200E: Symbol SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler multiply defined (by nrf_drv_twi.o and nrf_drv_spi.o).

Why? Thanks in advance.

Parents
  • Looks like you are trying to use both SPI0 and TWI0 in the same application, which will not work. You will have to change either SPI0 to SPI1, or TWI0 to TWI1. You do this with

    #define SPI_INSTANCE  1 /**< SPI instance index. */
    static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);  /**< SPI instance. */
    ...
    

    or

    #define TWI_INSTANCE     1 /**< TWI instance index. */
    static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE); /**< TWI instance. */
    ...
    

    This table in the Product Specification tells you which peripherals that cannot be used together.

  • Yes, that's correct. SPIM0, SPIS0, TWIM0, TWIS0, SPI0 and TWI0 all use the same peripheral hardware registers, so trying to configure more than one of these simultaneously will not work. If you first configure TWI0, and then SPI0, the SPI0 configuration would overwrite the TWI0 configuration.

Reply Children
No Data
Related