In migrating a project from SDK 14.2.0 to SDK 15.3.0, I'm also trying to move from the "legacy" non Easy DMA SPI driver to the Easy DMA one. I don't much care whether I use the nrfx driver or the nrf_drv one.
Here are the compilation errors I'm getting:
Compiling file: gps_ubx_g8020.c
In file included from ./../gps_ubx_g8020.c:14:0:
/usr/local/nRF5_SDK_15.3.0_59ac345/integration/nrfx/legacy/nrf_drv_spi.h:120:37: error: 'NRF_DRV_SPI_INSTANCE_2' undeclared here (not in a function); did you mean 'NRF_DRV_SPI_INSTANCE_'?
#define NRF_DRV_SPI_INSTANCE_(id) NRF_DRV_SPI_INSTANCE_ ## id
^
/usr/local/nRF5_SDK_15.3.0_59ac345/integration/nrfx/legacy/nrf_drv_spi.h:119:37: note: in expansion of macro 'NRF_DRV_SPI_INSTANCE_'
#define NRF_DRV_SPI_INSTANCE(id) NRF_DRV_SPI_INSTANCE_(id)
^~~~~~~~~~~~~~~~~~~~~
./../gps_ubx_g8020.c:215:36: note: in expansion of macro 'NRF_DRV_SPI_INSTANCE'
static const nrf_drv_spi_t m_spi = NRF_DRV_SPI_INSTANCE(2);
^~~~~~~~~~~~~~~~~~~~
make: *** [_build/app/gps_ubx_g8020.c.o] Error 1
And here's my app_config.h:
// These pin definitions work on both our custom board and the DK. For the DK they all just end up as NRF_DRV_SPI_PIN_NOT_USED.
spi_config.ss_pin = PIN_DEF_GPS_SPI1_CS;
spi_config.miso_pin = PIN_DEF_GPS_SPI1_MISO;
spi_config.mosi_pin = PIN_DEF_GPS_SPI1_MOSI;
spi_config.sck_pin = PIN_DEF_GPS_SPI1_SCK;
// SPI mode. uBlox datasheet: SPI modes 0-3 are implemented. Wisol support: use mode 1. Wisol driver: use mode 0. In testing, both mode 0 and mode 1 work.
spi_config.mode = NRF_DRV_SPI_MODE_0;
// Other config values from NRF_DRV_SPI_DEFAULT_CONFIG:
// .irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY (defined in sdk_config.h as 6)
// .orc = 0xFF
// ORC: Over-run character. This character is used when all bytes from the TX buffer are sent, but the transfer continues due to RX.
// uBlox: When no data is available to be written to the receiver, MOSI should be held logic high, i.e. all bytes written to the receiver are set to 0xFF.
// .frequency = NRF_DRV_SPI_FREQ_4M
// uBlox: u-blox 8 / u-blox M8 receivers support a maximum SPI clock speed of 5.5 MHz. Wisol's driver uses 125K frequency, not the default 4M. In testing, 4M works fine though, so we may as well go faster.
// .bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST
// Async:
err_code = nrf_drv_spi_init(&m_spi, &spi_config, gps_spi_event_handler, NULL); // No context.
APP_ERROR_CHECK(err_code);
#define PIN_DEF_GPS_SPI1_MOSI (29) // O High GPS SPI master out slave in
#define PIN_DEF_GPS_SPI1_SCK (30) // O High GPS SPI serial clock
#define PIN_DEF_GPS_SPI1_CS (31) // O Low GPS SPI slave select