I'm new to both the nRF52 family and SPI, and I'm working on an SPI master nRF52810 (using the PC10040e setup). I'm compiling using GCC and makefiles. I've set NRFX_SPIM_ENABLED and NRFX_SPIM0_ENABLED in the config, and I've got a setup declaration like this:
#define SPI_INSTANCE 0 static const nrfx_spim_t spi = NRFX_SPIM_INSTANCE(SPI_INSTANCE);
When I try to compile this, I get the errors
In file included from ../../../../nRF5_SDK_15.0.0_a53641a/modules/nrfx/nrfx.h:45:0,
from ../../../../nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/include/nrfx_spim.h:44,
from ../../../peripheral.c:8:
../../../../nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/include/nrfx_spim.h:93:35: error: 'NRFX_SPIM0_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_SPIM_INSTANCE'?
.drv_inst_idx = NRFX_CONCAT_3(NRFX_SPIM, id, _INST_IDX), \
^
../../../../nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/nrfx_common.h:117:37: note: in definition of macro 'NRFX_CONCAT_3_'
#define NRFX_CONCAT_3_(p1, p2, p3) p1 ## p2 ## p3
^~
../../../../nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/include/nrfx_spim.h:93:21: note: in expansion of macro 'NRFX_CONCAT_3'
.drv_inst_idx = NRFX_CONCAT_3(NRFX_SPIM, id, _INST_IDX), \
^~~~~~~~~~~~~
../../../peripheral.c:32:32: note: in expansion of macro 'NRFX_SPIM_INSTANCE'
static const nrfx_spim_t spi = NRFX_SPIM_INSTANCE(SPI_INSTANCE);
^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
../../../../nRF5_SDK_15.0.0_a53641a/components/toolchain/gcc/Makefile.common:272: recipe for target '_build/nrf52810_xxaa/peripheral.c.o' failed
On investigation, it looks almost as if NRFX_SPIM0_ENABLED is getting undefined somewhere. Now, there's a load of stuff in the pca10040a config file which looks like it has to do with legacy SPI. If I comment all that SPI config out - everything from SPI_ENABLED down to SPI0_ENABLED, removing those definitions entirely - it compiles.
I'm a bit concerned that I'm not sure why this is happening - I'm not at the stage where I'm testing anything with hardware yet, and I don't want to plug hardware in and puzzle over why it's not working when I've inadvertently disabled something with this mass commenting out in sdk_config.h. Is it safe (and required) for me to comment all that stuff out?
Thanks,
Jim