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

Issue using NRF_DRV_TWI_XFER_DESC_TXRX TWI master driver

At the very end of this post from Nordic Info center I am doing the exact example at the very end.

infocenter.nordicsemi.com/index.jsp

This is the start to do a transmit read transaction ===>

nrf_drv_twi_xfer_desc_t xfer = NRF_DRV_TWI_XFER_DESC_TXRX(addr, p_tx_buffer, tx_length, p_rx_buffer, rx_length);
ret_code_t ret = nrf_drv_twi_xfer(&twi, &xfer, 0);
if (ret == NRF_SUCCESS)
{
  while(xfer_completed == false){}
}

This is the end to verify the transfer worked successfully =======>

void twi_event_handler(nrf_drv_twi_evt_t * p_event, void * p_context)
{
    if ((p_event->type == NRF_DRV_TWI_EVT_DONE) && 
    (p_event->xfer_desc.type == NRF_DRV_TWI_XFER_TXRX))
    { xfer_completed = true; } 
}

My issue is this, I can do this once successfully, then when I do it again, the event_handler never gets called and I have to unititalize and then initialize the TWI module again, then it will repeat this, will work once then not the second time until I re initialize the TWI bus.

Related