WEC2013 Lib V2.1 crahes when calling Imx7I2c_Write()

after updating to CE lib version 2.1 we’re getting a crash when calling Imx7I2c_Write(). With CE Lib V2.0 there is all ok.

We init the first I2C-Channel with Standard Pins (196/194): [upload|3I94+m/jHW4NEloMceg1bXrdEIc=]

[upload|45wCLF0cvRyWwEvu8bW/sX6GR08=]

Do you have any suggestions?

We will check this and provide you an update tomorrow.

Can you include line numbers and file names in your screenshot?

I quickly cheched the code. I assume the problem is related to the fact that I2C_write with a NULL data and 0 size does not work any longer. I suggest you to use the following scan function:

//******************************************************************************
/// Scan I2C Bus for available devices.
/// @param[in]  i2c           HANDLE to I2C port, retrieved from I2c_Init()
void i2cScan(HANDLE i2c)
{
	int i, count = 0;
	BOOL Success;


	Success = I2c_Open(i2c);
	if (!Success)
	{
		printf("I2c_Open failed. Exit Scan", count);
		return;
	}


	printf("Scanning i2c bus...\r\n");
	for (i = 8; i < 0x78; i++) // First and last 8 addresses are reserved
	{
		BYTE tmpBuf;

		I2c_SetConfigInt(i2c, TEXT("SlaveAddr"), i, StoreVolatile);

		Success = (I2c_Read(i2c, &tmpBuf, 1) == (DWORD)-1) ? FALSE : TRUE;
		if (Success)
		{
			printf("- 0x%02x \n\r", i);
			count++;
		}
		//Sleep(1);
	}
	I2c_Close(i2c);

	printf("\r\n%d device(s) found.\r\n", count);
}

We will fix the demo code in the next library release.

After changing the scan function, it is now running again. Thanks samuel.tx.