Hello All,
I am using nRF SDK 17.0.2 (softdevice). I have connected multiple sensors using I2C protocol, I want to know if there is any failure in sensor and if it is not responding on twi then I am getting event NRF_DRV_TWI_EVT_ADDRESS_NACK but how to get the address for which this address has not acknowleged? if p_context holds such information, how to use it?
void twi_handler(nrf_drv_twi_evt_t const * p_event, void * p_context)
{
switch (p_event->type)
{
case NRF_DRV_TWI_EVT_DONE:
if (p_event->xfer_desc.type == NRF_DRV_TWI_XFER_RX)
{
NRF_LOG_INFO("twi_handler");
}
m_xfer_done = true;
break;
case NRF_DRV_TWI_EVT_ADDRESS_NACK:
SEGGER_RTT_printf(0,"No address ACK on address: %#x!\r\n", 0);
m_xfer_done = true;
break;
case NRF_DRV_TWI_EVT_DATA_NACK:
SEGGER_RTT_printf(0,"No data ACK on address: %#x!\r\n", 0);
break;
default:
break;
}
}
Thanks and regards,
Neeraj Dhekale