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

Two SPI interfaces, compilation error

Hi,


I have the same issue as in here: https://devzone.nordicsemi.com/f/nordic-q-a/62676/2-spi-devices-nordic-nrf52382
but for me the Debug/Release-toggle does not work.

I use SDK 15.3 and Softdevice s132 with a BC832. I try to connect (in the end 3 but for now) 2 SPI devices to the BC832. Since they might send data simultaneously and I don't need the GPIO pins otherwise, I would prefer having an interface for each of them and other threads mention that it is possible.

Segger Embedded Studio (V4.52) gives this error:
‘NRF_DRV_SPI_INSTANCE_1’ undeclared here (not in a function); did you mean ‘NRF_DRV_SPI_INSTANCE_0’?
in nrf_drv_spi.h in line 120 (which reads: "#define NRF_DRV_SPI_INSTANCE_(id)   NRF_DRV_SPI_INSTANCE_ ## id")
whenever I add the second SPI instance. (I have not tried the third yet.)

code used:

#define SPI_INSTANCE_0  0
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE_0);  /**< SPI instance. */
#define SPI_INSTANCE_1  1
static const nrf_drv_spi_t spi1 = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE_1);  /**< SPI instance. */


SPI0_ENABLED, SPI1_ENABLED and SPI2_ENABLED are all set to 1. see config file: sdk_config.h

what am I doing wrong? Appreciate any suggestions/help.

(btw, if I only use SPI_INSTANCE_0 and set it to 1 or 2 and comment out the last two lines of the code above, it of cause gives the same error!)

  • Hi,

    redownloading the SDK resolved the issue and also the original project compiles with several SPI instances. Thank you very much for the tip!

    best wishes

    (and sorry for the long silence, was on vacation)

  • Hello,

    OS Na said:
    (and sorry for the long silence, was on vacation)

    No problem at all!  

    OS Na said:
    redownloading the SDK resolved the issue and also the original project compiles with several SPI instances. Thank you very much for the tip!

    I am happy to hear that this resolved your issue.
    To avoid this issue in the future, please make sure that you are not modifying the SDK files directly, but rather making renamed copies of the files you would like to change, and adding them to a separate location in your project directory. This way, it will also be easier for someone else to familiarize with your code in the future.

    I hope you had a great vacation, and that you are well!

    Please do not hesitate to open a new ticket if you should encounter any issues or questions in the future.

    Best regards,
    Karl

Related