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

spi0 and twi0 are used in one project , compile wrong

Hi all

           I am using the spi0 to storage the data and twi0 to get sensor data . But after I add the file nrf_drv_twi.c  and compile , it complies wrong :.

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

Search the code as below: 

#define TWI0_IRQ_HANDLER    SPI0_TWI0_IRQHandler

#define SPI0_IRQ_HANDLER    SPI0_TWI0_IRQHandler

How can I do ?

I know spi0 and twi0 are using the same hardware address , but I won't use it at the same time  .

  • Hi,

    I would recommend to use e.g. TWI0 and SPI1 instead, that will be easier for you. But if for some reason that is not an option, then take a look at this post.

  • Hi,

    Thanks for your suggest . In this project I will use twi0 and twi1 at the same time . So it cannot avoid this problem . 

    I enable PERIPHERAL_RESOURCE_SHARING_ENABLED  in sdk_config.h , but it also tells the same compile error .

    I'm using the demo:

    nRF5_SDK_12.3.0_d7731ad\examples\ble_peripheral\experimental_ble_app_buttonless_dfu


    // <e> PERIPHERAL_RESOURCE_SHARING_ENABLED - nrf_drv_common - Peripheral drivers common module
    //==========================================================
    #ifndef PERIPHERAL_RESOURCE_SHARING_ENABLED
    #define PERIPHERAL_RESOURCE_SHARING_ENABLED 1
    #endif
    #if PERIPHERAL_RESOURCE_SHARING_ENABLED
    // <e> COMMON_CONFIG_LOG_ENABLED - Enables logging in the module.
    //==========================================================
    #ifndef COMMON_CONFIG_LOG_ENABLED
    #define COMMON_CONFIG_LOG_ENABLED 0
    #endif
    #if COMMON_CONFIG_LOG_ENABLED
    // <o> COMMON_CONFIG_LOG_LEVEL - Default Severity level
    // <0=> Off
    // <1=> Error
    // <2=> Warning
    // <3=> Info
    // <4=> Debug

    #ifndef COMMON_CONFIG_LOG_LEVEL
    #define COMMON_CONFIG_LOG_LEVEL 3
    #endif

  • It works fine here. I assume you have TWI_ENABLED, TWI0_ENABLED , SPI_ENABLED and SPI0_ENABLED set to 1 as well. Did you save the sdk_config.h file after you modifed it, and re-compiled the project?

Related