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

libopenthread-nrf52840-sdk is reserving a SPI instance

Hello,

I cannot add SPI0 to my application because OpenThread library was built with it without any interest of that. Could you fix it please ? (I need the 3 SPI peripherals)

Linking target: _build/nrf52840_xxaa.out
../../../../../10_Tools/nRF5_SDK_for_Thread_and_Zigbee_2.0.0_29775ac/external/openthread/lib/gcc/libopenthread-nrf52840-sdk.a(libopenthread_nrf52840_sdk_a-spi-slave.o): In function `SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler':
/build/KNGP-TOLL1-JOB1/openthread/examples/../examples/platforms/nrf52840/spi-slave.c:191: multiple definition of `SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler'
_build/nrf52840_xxaa/nrfx_spim.c.o:F:\Git\Leolab\Projects\Clairvoyant\6_Sources\ble_thread_swi_template\pca10056\s140\armgcc/../../../../../10_Tools/nRF5_SDK_for_Thread_and_Zigbee_2.0.0_29775ac/modules/nrfx/drivers/src/nrfx_spim.c:676: first defined here
collect2.exe: error: ld returned 1 exit status
../../../../../10_Tools/nRF5_SDK_for_Thread_and_Zigbee_2.0.0_29775ac/components/toolchain/gcc/Makefile.common:292: recipe for target '_build/nrf52840_xxaa.out' failed
mingw32-make: *** [_build/nrf52840_xxaa.out] Error 1

Parents Reply Children
  • Hello,

    Yes. The openthread library that is included in SDK for Thread and Zigbee 2.0.0 uses SPI0 by default. This is because our SDK has examples where the nRF acts as a Network Co Processor (NCP). This is why the openthread library that is built for the SDK is using the SPI0. 

    Now, if you need to use SPI0, you must rebuild the openthread library. How to do this is described here. As it says near the top of that page, you would need to add DISABLE_SPI=1 in platform-config.h before building the library. Also note that if you build the latest release of openthread, it would cause all (at least most) of the examples to break. To still be able to use the examples as they are in the SDK, you would need to build the same version that is used with the SDK. The version that is used is mentioned in the file:

    SDK_for_thread_and_zigbee_2.0.0\external\openthread\project\readme.txt

    Now, if possible, the easier workaround is probably to not use SPI0 or TWI0 in your application. If possible, you may use SPI1, SPI2 or SPI3 instead. 

    Best regards,

    Edvin

  • Hello,

    Thank you for your response.

    I need all spi /twi so i cannot move to another one.

    I will see how to rebuild it but this problem looks generic for me. I think that will be interesting to propose a no ncp (and without spi) version of build in sdk because a great number of users are not in a ncp configuration.

Related