Hi,
I want to use two SPI instances (0 and 1) in my project. I am able to modify the example SPI project to use 2 SPI instances as in the code below and setting #define SPI1_ENABLED 1 in sdk_config.h.
#define SPI_INSTANCE0 0 /**< SPI instance index. */ static const nrf_drv_spi_t spi0 = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE0); /**< SPI instance. */ #define SPI_INSTANCE1 1 /**< SPI instance index. */ static const nrf_drv_spi_t spi1 = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE1); /**< SPI instance. */
I can then go on and configure SPI_1 similar to the example for SPI_0.
However, when I try to add a second SPI instance to a project I have already been working on, I get the following compilation error:
Compiling ‘main.c’ process_data.h main.c 'NRF_DRV_SPI_INSTANCE_1' undeclared here (not in a function); did you mean 'NRF_DRV_SPI_INSTANCE_0'? in expansion of macro 'NRF_DRV_SPI_INSTANCE_' in expansion of macro 'NRF_DRV_SPI_INSTANCE' Compiling ‘process_data.c’ process_data.h process_data.c 'NRF_DRV_SPI_INSTANCE_1' undeclared here (not in a function); did you mean 'NRF_DRV_SPI_INSTANCE_0'? in expansion of macro 'NRF_DRV_SPI_INSTANCE_' in expansion of macro 'NRF_DRV_SPI_INSTANCE' Build failed
I have ensured that the relevant parts of sdk_config.h for nrf_drv_spi and nrfx_spi match in the example and my project (attached).
I am not using TWI which is the only peripheral that shares a base address with the SPI instances.
I would like to be able to fix my existing project and understand what is causing this error as the project is quite large and starting from scratch would be time consuming.
Thanks,
Daragh