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
  • Hello,

    I have the same problem, but when 2 declared different instance number of TWI and SPI, it still didn't work, bellow is my code :

    #include "spi.hpp"
    #include "nrf_drv_spi.h"
    
    #define CS_PIN 6
    #define DQ0 22
    #define DQ1 19
    #define DQ2 20
    #define DQ3 24
    #define CLK 23
    
    #define     SPI_INSTANCE  1 
    #define     SPI1_USE_EASY_DMA 1
    
    static const nrf_drv_spi_t spi1 = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); 
    static bool spi_xfer_done;  /**< Flag used to indicate that SPI instance completed the transfer. */
    static nrf_drv_spi_xfer_desc_t xfer_desc;
    
    static uint8_t rxBuffer[100], txBuffer[100];
    
    void spi_event_handler(nrf_drv_spi_evt_t const *p_event)
    {
        switch (p_event->type)
        {
            case NRF_DRV_SPI_EVENT_DONE:
            nrf_drv_spi_xfer(&spi1, &xfer_desc, 0);
            spi_xfer_done = true;
        }
    }
    
    void initSPI()
    {
            xfer_desc.p_tx_buffer = txBuffer;
            xfer_desc.p_rx_buffer = rxBuffer;
            xfer_desc.tx_length   = 100;
            xfer_desc.rx_length   = 100;
    
            nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
    
            spi_config.ss_pin   = CS_PIN;
            spi_config.miso_pin = DQ1;
            spi_config.mosi_pin = DQ0 ;
            spi_config.sck_pin  = CLK;
    
            nrf_drv_spi_init(&spi1, &spi_config, spi_event_handler);
            nrf_drv_spi_transfer(&spi1,txBuffer , 100, NULL, 0);
    }
    
  • Hello You say you use both TWI and SPI, but the code you posted is only about the SPI. Could you please post the code relating to the TWI as well?

Reply Children
No Data
Related