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

TWI (also called IIC, I2C) is reporting the error NRFX_TWI_EVT_BUS_ERROR

Hi ...

I am getting the occasional error NRFX_TWI_EVT_BUS_ERROR being reported from the       twi_irq_handler() 

You can see in the following code snippet from this function that NRFX_TWI_EVT_BUS_ERROR will be returned if the error is not one of these

NRF_TWI_ERROR_ADDRESS_NACK

NRF_TWI_ERROR_DATA_NACK

NRF_TWI_ERROR_OVERRUN

 

if (p_cb->error)
{
	uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(p_twi);
	if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK)
	{
		event.type = NRFX_TWI_EVT_ADDRESS_NACK;
		NRFX_LOG_DEBUG("Event: %s.", EVT_TO_STR(NRFX_TWI_EVT_ADDRESS_NACK));
		SEGGER_SYSVIEW_RecordString(SYSVIEW_ICT_DEBUG_LOG_STRING, "IIC-NACK-A");
	}
	else if (errorsrc & NRF_TWI_ERROR_DATA_NACK)
	{
		event.type = NRFX_TWI_EVT_DATA_NACK;
		NRFX_LOG_DEBUG("Event: %s.", EVT_TO_STR(NRFX_TWI_EVT_DATA_NACK));
		SEGGER_SYSVIEW_RecordString(SYSVIEW_ICT_DEBUG_LOG_STRING, "IIC-NACK-D");
	}
	else if (errorsrc & NRF_TWI_ERROR_OVERRUN)
	{
		event.type = NRFX_TWI_EVT_OVERRUN;
		NRFX_LOG_DEBUG("Event: %s.", EVT_TO_STR(NRFX_TWI_EVT_OVERRUN));
		SEGGER_SYSVIEW_RecordString(SYSVIEW_ICT_DEBUG_LOG_STRING, "IIC-Ovrn");
	}
	else
	{
		event.type = NRFX_TWI_EVT_BUS_ERROR;
		NRFX_LOG_DEBUG("Event: %s.", EVT_TO_STR(NRFX_TWI_EVT_BUS_ERROR));
		SEGGER_SYSVIEW_RecordString(SYSVIEW_ICT_DEBUG_LOG_STRING, "IIC-BErr");
	}
}

The datasheet for the nRF52820 only has 3 errors   A,B,C

Does anyone know what error causes this ?

Do I need to do anything special to recover from it ?

NOTE: I have added the Segger SystemView API calls to the above code to help track the problem. They were not present in the SDK.

Parents Reply Children
Related