SPI invalid address error

Hi everyone,

I'm currently developing an application supposed to read through SPI from an extrernal SRAM, i'm using nrfx_spim libraries.

Compilation is flawless but when i try to debug i get NRFX_ERROR_INVALID_ADDR when starting Spi transmission, do you know why and how can i fix it?

These are the vector i'm using as buffers:

    /** @brief Transmit buffer initialized with the specified message ( @ref MSG_TO_SEND ). */
    static uint8_t m_tx_buffer[10]={0x9f,0,0,0,0,0,0,0,0,0,0};

    /** @brief Receive buffer defined with the size to store specified message ( @ref MSG_TO_SEND ). */
    static uint8_t m_rx_buffer[10]={0,0,0,0,0,0,0,0,0,0,0};

The spi initialization:

    nrfx_spim_t spim_inst = NRFX_SPIM_INSTANCE(SPIM_INST_IDX);
	nrfx_spim_config_t spim_config = NRFX_SPIM_DEFAULT_CONFIG(17,
                                                              13,
                                                              14,
                                                              NRF_SPIM_PIN_NOT_CONNECTED);

	spim_config.frequency=NRFX_MHZ_TO_HZ(8);
    status = nrfx_spim_init(&spim_inst, &spim_config, NULL, NULL);
    NRFX_ASSERT(status == NRFX_SUCCESS);

And Transmission:

    nrfx_spim_xfer_desc_t spim_xfer_desc = NRFX_SPIM_XFER_TRX(m_tx_buffer, 1,
                                                              m_rx_buffer, 6);
    	status = nrfx_spim_xfer(&spim_inst, &spim_xfer_desc, 0);

Parents
  • Hi

    nrfx_spim_xfer() willl return NRFX_ERROR_INVALID_ADDR if th Rx and/or Tx buffer is not available for DMA (the checking is in nrf_dma_accessible_check() in modules/hal/nordic/nrfx/drivers/src/nrfx_spim.c). In practice this means that the buffers needs to be within the RAM region. As the buffers here are only static but nost const they should be placed in RAM, but perhaps you can either add printouts or check with a debugger which addresses you provide?

Reply
  • Hi

    nrfx_spim_xfer() willl return NRFX_ERROR_INVALID_ADDR if th Rx and/or Tx buffer is not available for DMA (the checking is in nrf_dma_accessible_check() in modules/hal/nordic/nrfx/drivers/src/nrfx_spim.c). In practice this means that the buffers needs to be within the RAM region. As the buffers here are only static but nost const they should be placed in RAM, but perhaps you can either add printouts or check with a debugger which addresses you provide?

Children
No Data
Related