HI,
I'm having a problem when I use the function nrf_drv_twi_xfer. The function returns the error code NRF_SUCCESS, but using the event handler I notice that I'm receiving DATA NACK and the receiving buffer is empty, I didn't recieve a response from the device.
I'm trying to communicate with a CryptoMemory over I2C. In my circuit I have two slaves, a sensor and the cryptomemory, both using the same TWI instance. I have been able to communicate with the sensor without problem using the nrf_drv_twi_tx and nrf_drv_twi_rx functions.
Reading the Crypto Memory datasheet I think is necessary to work with the Xfer function because it works with commands when in needs an input to give an output. The sensor works different, you can simply write to it or you can just read the register, it's no necessary to indicante a command to have an answer like it does in the Crypto Memory.
I have define my xfer_descriptor like this:
static nrf_drv_twi_xfer_desc_t Cryp_xfer = NRF_DRV_TWI_XFER_DESC_TXRX(Cryp_Addr, tx_cryp, sizeof(tx_cryp), rx_cryp_data, sizeof(rx_cryp_data));
and when I use the function nrf_drv_twi_xfer is define like this:
err_code1 = nrf_drv_twi_xfer(&m_twi_Acc_Cryp, &Cryp_xfer, flags);
where:
- err_code1 is code error returned by the function
- m_twi_Acc_Cryp is the TWI instance
- Cryp_xfer is the xfer descriptor above
- flags is define as NRF_DRV_TWI_FLAG_TX_NO_STOP;
My TWI initialization is using a TWI event handler, so is not in blocking mode.
What I'm missing? I something configured wrong?
Thanks for your help.