I2C error when transferring large data

Hello,

I am working with a TOF sensor, and in the init I need to upload some firmware through an I2C connection. It functions as intended when it is a smaller amount of data but once it gets to the larger stuff (32 kB) I get this error:

"Error on I2C line occurred for message 0" from i2c_nrfx_twim.c

Could it be the I2C timeout? If so how do I change it?

I am using sdk 1.9.1, here is the function that throws the error in the second i2c_write() which sends the data:

uint8_t WrMulti(
	VL53L5CX_Platform *p_platform,
	uint16_t RegisterAddress,
	uint8_t *p_values,
	uint32_t size)
{
	uint8_t status = 255;
	uint8_t *reg;
	reg = &RegisterAddress;
	RegisterAddress = ((RegisterAddress << 8) & 0xff00) | ((RegisterAddress >> 8) & 0x00ff);

	status = i2c_write(p_platform->i2c_dev, reg, 2U, p_platform->address);
	if (status)
	{
		printf("WrMulti: Failed to write reg: %d\n", status);
	}
	status = i2c_write(p_platform->i2c_dev, p_values, size, p_platform->address);
	if (status)
	{
		printf("WrMulti: Failed to write bytes: %d\n", status);
	}

	return status;
}

Thanks,

Jacob

Related