SPIM3 ERROR .'NRFX_SPIM3_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_SPIM0_INST_IDX'?

I was able to work with the spi module, but now I want to make it work like a simulator, so I updated the configuration function and tried it like this.

Could you please tell me what I'm missing?

When I try to set up spim3 in the config file, I get the following error:

.'NRFX_SPIM3_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_SPIM0_INST_IDX'?


#define SPI_BUFSIZE 8 //SPI Communication buffer size
#define SPI_INSTANCE 3 //SPI Instance to be used
#define PIN_IN 8
#define IO_PIN_IN 16

#define NRFX_SPIM_SCK_PIN 27
#define NRFX_SPIM_MOSI_PIN 4
#define NRFX_SPIM_MISO_PIN 28
#define NRFX_SPIM_SS_PIN 26
#define NRFX_SPIM_DCX_PIN 30

/******************************************/

#define ST7735_DC_PIN 11 //21
//#define ST7735_SCK_PIN 27
//#define ST7735_MISO_PIN 12
//#define ST7735_MOSI_PIN 04
//#define ST7735_SS_PIN 26


uint8_t spi_tx_buf[SPI_BUFSIZE]; // spi tx buffer
uint8_t spi_rx_buf[SPI_BUFSIZE]; // spi rx buffer
static uint8_t sig_irq = 0;

static uint8_t m_tx_buf[] ; /**< TX buffer. */
static uint8_t m_rx_buf[]; /**< RX buffer. */
static const uint8_t m_length ; /**< Transfer length. */
volatile uint8_t SPIReadLength, SPIWriteLength; // variables to hold read and write lengths

static volatile bool spi_xfer_done; /* Flag used to indicate that SPI instance completed the transfer. */
//static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /* SPI instance. */

static const nrfx_spim_t spi = NRFX_SPIM_INSTANCE(SPI_INSTANCE);

/* SPI Event handler function, on every transfer this event call back function
will be executed upon the intterupts from spi */
void spi_event_handler(nrf_drv_spi_evt_t const * p_event,
void * p_context)
{ /* Set the data transfer flag to true to indicate the data transmission has finished */
static uint8_t loop=0;
spi_xfer_done = true;
NRF_LOG_INFO(" TRANSFER DONE %d",loop);
loop++;
}

void spim_event_handler(nrfx_spim_evt_t const * p_event,
void * p_context)
{
spi_xfer_done = true;
NRF_LOG_INFO("Transfer completed.");
//if (m_rx_buf[0] != 0)
//{
// //NRF_LOG_INFO(" Received:");
// //NRF_LOG_HEXDUMP_INFO(m_rx_buf, strlen((const char *)m_rx_buf));
//}
}

/* A function to initialize SPI Instance */
void SPI_CONFIG(void)
{
NRF_LOG_INFO("SPI INIT");


nrfx_spim_xfer_desc_t xfer_desc = NRFX_SPIM_XFER_TRX(m_tx_buf, m_length, m_rx_buf, m_length);

nrfx_spim_config_t spi_config = NRFX_SPIM_DEFAULT_CONFIG;
spi_config.frequency = NRF_SPIM_FREQ_32M;
spi_config.ss_pin = NRFX_SPIM_SS_PIN;
spi_config.miso_pin = NRFX_SPIM_MISO_PIN;
spi_config.mosi_pin = NRFX_SPIM_MOSI_PIN;
spi_config.sck_pin = NRFX_SPIM_SCK_PIN;
//spi_config.dcx_pin = NRFX_SPIM_DCX_PIN;
//spi_config.use_hw_ss = true;
spi_config.ss_active_high = false;
APP_ERROR_CHECK(nrfx_spim_init(&spi, &spi_config, spim_event_handler, NULL));
}

is that transfer function right ? i am not sure
void spi_write(const uint8_t * data, uint16_t size)
{
spi_xfer_done=false;
APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi,data,size,NULL,0));
// APP_ERROR_CHECK(nrfx_spim_xfer_dcx
while(spi_xfer_done == false){};
}

Related