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

nrf_drv_spis_buffers_set causes fatal error

Hi,  I have a spis problem

#define SPIS_INSTANCE 1 /**< SPIS instance index. */
static const nrf_drv_spis_t spis = NRF_DRV_SPIS_INSTANCE(SPIS_INSTANCE);/**< SPIS instance. */

static volatile uint8_t  	m_spi_rx_buf[SPI_MAX_TX_SIZE];    /**< RX buffer. */
static volatile uint8_t  	m_spi_tx_buf[SPI_MAX_TX_SIZE];    /**< TX buffer. */

static void spis_event_handler(nrf_drv_spis_event_t event)
{
	if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
	{
		spis_xfer_done = true;
		NRF_LOG_INFO(" SPI RX (%d).", event.rx_amount);
	}
}

uint32_t spi_init(void)
{
	uint32_t err_code;

	nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG;
	spis_config.csn_pin               = 22;
	spis_config.miso_pin              = 24;
	spis_config.mosi_pin              = 23;
	spis_config.sck_pin               = 25;
	spis_config.mode      			  = NRF_DRV_SPIS_MODE_3;
	spis_config.bit_order 			  = NRF_DRV_SPIS_BIT_ORDER_LSB_FIRST;

	err_code = nrf_drv_spis_init(&spis, &spis_config, spis_event_handler);
    if (err_code != NRF_SUCCESS)
    {
    	NRF_LOG_INFO("SPIS Init failure");
    	return err_code;
    }
    
	err_code = nrf_drv_spis_buffers_set(&spis, (uint8_t*)m_spi_tx_buf, sizeof(m_spi_tx_buf), (uint8_t*)m_spi_rx_buf, sizeof(m_spi_rx_buf));

    if (err_code != NRF_SUCCESS)
    {
    	NRF_LOG_INFO("SPIS buffer failure");
    }
    
    return err_code;
}



when nrf_drv_spis_buffers_set is called, it enters the switch on the SPIS_BUFFER_RESOURCE_CONFIGURED case, then calls spis_state_change with SPIS_BUFFER_RESOURCE_REQUESTED, spis_state_change then calls spis_state_entry_action_execute, at which point i get a fatal error

I cant seem to get any information here on what i have done wrong

the buffers arein data ram and pass the check

if i remove the buffers_set call the program runs, with it it hangs

any help here appreciated

thanks

billy
Parents
  • During debug i get the following error from nrf_drv_spis_buffers_set, even though err_code is SUCCESS

    <info> app: Callpoint Startup..
    <info> spis: Function: nrf_drv_spis_init, error code: NRF_SUCCESS.
    <warning> nrf_sdh_ble: RAM starts at 0x20006000, can be adjusted to 0x20004070.
    <warning> nrf_sdh_ble: RAM size can be adjusted to 0xBF90.
    <info> app: Callpoint started.
    <info> app: Fast advertising.
    <debug> spis: SPIS: Event: NRF_SPIS_EVENT_ACQUIRED.
    <error> app: SOFTDEVICE: ASSERTION FAILED
    

Reply
  • During debug i get the following error from nrf_drv_spis_buffers_set, even though err_code is SUCCESS

    <info> app: Callpoint Startup..
    <info> spis: Function: nrf_drv_spis_init, error code: NRF_SUCCESS.
    <warning> nrf_sdh_ble: RAM starts at 0x20006000, can be adjusted to 0x20004070.
    <warning> nrf_sdh_ble: RAM size can be adjusted to 0xBF90.
    <info> app: Callpoint started.
    <info> app: Fast advertising.
    <debug> spis: SPIS: Event: NRF_SPIS_EVENT_ACQUIRED.
    <error> app: SOFTDEVICE: ASSERTION FAILED
    

Children
No Data
Related