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

nRF5430 NRFX SPI configuration

Currently, I'm switching my platform form nRF52 to nRF53. 

For the work I'm doing, I need to use DPPI to enable GPIO events to trigger SPI transmissions, without interrupting CPU. The Zephyr SPI seems not able to do this, as I can't get the SPI START event from it. So I need to use NRFX SPI. 

I edited prj.conf file like this: 

CONFIG_BOARD_ENABLE_CPUNET=y

# CONFIG_SPI=y
# CONFIG_SPI_1=y
CONFIG_NRFX_SPI=y

CONFIG_GPIO=n
CONFIG_NRFX_GPIOTE=y

CONFIG_NRFX_DPPI=y

In the main.c file, I included nrfx_spim.h and set the SPI declaration like this:

#define SPI_INSTANCE 1
static const nrfx_spim_t spi = NRFX_SPIM_INSTANCE(SPI_INSTANCE);

When I try to compile this, I get a warning:

warning: NRFX_SPI (defined at modules/Kconfig.nordic:237) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: (HAS_HW_NRF_SPI0 || HAS_HW_NRF_SPI1 ||
HAS_HW_NRF_SPI2) (=n). See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_NRFX_SPI.html and/or look up NRFX_SPI
in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

And an error:

error: 'NRFX_SPIM1_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_SPIM_INSTANCE'?
   82 |     .drv_inst_idx = NRFX_CONCAT_3(NRFX_SPIM, id, _INST_IDX), \
      |                                   ^~~~~~~~~

How could I fix this issue?

BTW, I'm using NRF Connect SDK v1.4.0, installed by the NRF Connect Toolchain manager, with nRF5430 PDK.

Related