Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPIM 'No handler' flag use

Dear Sir,

I have enabled my project for SPIM+EasyDMA.

I am configuring the SPIM transfer nrf_drv_spi_xfer with additional flags like,

NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER .

Following is the my transfer function

void spi_transferx(uint8_t * p_tx_buffer,uint8_t tx_buffer_length,uint8_t * p_rx_buffer, uint8_t rx_buffer_length)
{
uint32_t err;

nrf_drv_spi_xfer_desc_t xfer = NRF_DRV_SPI_XFER_TRX(p_tx_buffer, tx_buffer_length, p_rx_buffer, rx_buffer_length);
err = nrf_drv_spi_xfer(&spi,&xfer,NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER);

if( err == NRF_SUCCESS )
{
while (!nrf_spim_event_check(spi.u.spim.p_reg, NRF_SPIM_EVENT_END)){}
nrf_spim_event_clear(spi.u.spim.p_reg, NRF_SPIM_EVENT_END);
}
//nrf_gpio_pin_set(BOARD_NRF52833_SPIM_SS_PIN);
}

In while(1) I read the chip id of the sensor. Only first 1 transaction was successful with my sensor. 

On calling nrf_gpio_pin_set(BOARD_NRF52833_SPIM_SS_PIN); after transfer complete the problem got resolved.

May I know whether the user has to take care of handling the SS line in this case?

Regards,

Lakshmi

Related