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

Merging project issue

I have used the ble_peripheral/ble_app_uart example and add TWIM functionality to communicate with 2 I2C sensors.

I have used the peripheral/serial project to communicate back and forth through the UARTE1.

Both work fines. 

Now i want to merge the two projects but cannot get the thing working.

When i merge the TWI functionality to the serial and cannot compiled and come back with the following error. Which i do not understand as i am not using SPI.

multiple definition of `SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler'; Output/Debug/Obj/IoTFabrica_Multi_pca10056/nrfx_twim.o:D:\WATERNET_DEVICE_DRIVE\nRF5_SDK_15.3.0_59ac345\modules\nrfx\drivers\src/nrfx_twim.c:676: first defined here

When i merge the serial onto the BLE_UART. the project compiled but the serial does not work anymore. I do not see any error in all the return. 

Please help.

  • Hi,

    You cannot use multiple peripheral instances that share the same IDs/base addresses at the same time, so if you want to use e.g. TWI and SPI at the same time, you should use e.g. TWI0 and SPI1. Here is the table of which IDs/base address the different peripheral instances use.

    It could be that you have e.g. SPI0_ENABLED or something similar enabled in sdk_config.h ? I can take a look at your sdk_config.h file if you post it here.

  • 5516.sdk_config.h

    I don't believe that i have both SPI and TWI in the sdk_config.h but please check. The sdk_config.h is a huge pain to manage between project. I also see that there is multiple sdk_config.h in project. One in the project and one related to other c file. Very hard to understand what is happening there. I find the programming more time consuming due to sdk_config alignment, importing the right file instead of programming functionality. Please advise how to deal with this. 

  • I don't see anything wrong in the sdk_config.h that you uploaded.

    Laurent L said:
    I also see that there is multiple sdk_config.h in project

     There should only be 1 file called sdk_config.h in the project.

    From nrfx_irqs_nrf52840.h we have this:

    #define nrfx_spim_0_irq_handler     SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
    #define nrfx_spis_0_irq_handler     SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
    #define nrfx_twim_0_irq_handler     SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
    #define nrfx_twis_0_irq_handler     SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
    #define nrfx_spi_0_irq_handler      SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
    #define nrfx_twi_0_irq_handler      SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler

    You have nrfx_twim_0_irq_handler linked&compiled in, here:

    multiple definition of `SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler'; Output/Debug/Obj/IoTFabrica_Multi_pca10056/nrfx_twim.o:D:\WATERNET_DEVICE_DRIVE\nRF5_SDK_15.3.0_59ac345\modules\nrfx\drivers\src/nrfx_twim.c:676: first defined here


    Could you search your project for the others:

    nrfx_spim_0_irq_handler
    nrfx_spis_0_irq_handler
    nrfx_twim_0_irq_handler
    nrfx_twis_0_irq_handler
    nrfx_spi_0_irq_handler
    nrfx_twi_0_irq_handler

    Either you somehow have 2 of the nrfx_twim_0_irq_handler, or one of the others are getting linked&compiled as well.

Related