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

'NRF_DRV_SPI_INSTANCE_0' undeclared here (not in a function); did you mean 'NRF_DRV_SPI_INSTANCE_'?

Hello All.

I was facing this error when immigrate spi example of nordic to the embOS of Segger using the SES. I don't think it concern to the embOS envirement but still for the code. I found the following discussion 

https://devzone.nordicsemi.com/f/nordic-q-a/39990/nrf_drv_spi_instance_spi_instance_lis-undeclared-here-not-in-a-function-did-you-mean-nrf_drv_spi_instance_0

But in my case the SPI example is all ready in SDK 15 and I build the whole project שךדם ןמ SDK 15.

I see that in the original SPI example I get on the relevant define 

#define NRF_DRV_SPI_INSTANCE(id) NRF_DRV_SPI_INSTANCE_(id)
#define NRF_DRV_SPI_INSTANCE_(id) NRF_DRV_SPI_INSTANCE_ ## id
#if NRFX_CHECK(NRFX_SPIM0_ENABLED)
#define NRF_DRV_SPI_INSTANCE_0 \
{ 0, { .spim = NRFX_SPIM_INSTANCE(0) }, true }

But on the merge one 

#define NRF_DRV_SPI_INSTANCE(id) NRF_DRV_SPI_INSTANCE_(id)
#define NRF_DRV_SPI_INSTANCE_(id) NRF_DRV_SPI_INSTANCE_ ## id
#if NRFX_CHECK(NRFX_SPIM0_ENABLED)
#define NRF_DRV_SPI_INSTANCE_0 \
{ 0, { .spim = NRFX_SPIM_INSTANCE(0) }, true }  

The line on Red is not define so it doesn't make the function.

I check why and in the SPI example it follow to apply_old_config.h but I don't see this file include any where in the project, where on the merge one it follow to sdk_config.h where there the define 

#ifndef NRFX_SPIM0_ENABLED
#define NRFX_SPIM0_ENABLED 0

is close.

1. How the first one use apply_old_config.h where I can't see its include any where (not in any files or in the option)?

2. How can I fix this issue to get it NRF_DRV_SPI_INSTANCE_0 as define in the project?

Bar.

Related