MC60 I2C problem with the multi-slave

Hi
I Worked With the I2C Of MC60, it works fine when we have only one slave device but when we have two or three slave I2c devices not work correctly!
I have two slave devices on I2C (ADXL345 and LM75) when sniffing the I2C bus with a logic analyzer, I found only one slave Address on the bus !!
I tried to reconfigure the I2C before connecting to another device with the function Ql_IIC_Config but I got an error!
realy with MC60, we can not communicate with two to three devices on I2C!

Hi,Our module can be connected to multiple Iics, so as long as each IIC device has a different address, it can be hung on the same bus. Please mount each IIC device separately and check whether the device address is correct in use

Thank you for your replay
So I think your IIC library has bugs. I config IIC Bus for sample with below line

Ql_IIC_Config(1,TRUE, 0xA6, 400);

and I Have 4 chips on IIC Bus with 0x90 & 0x96 & 0x9E & 0xA6 address(maybe some address Not available) when I try add another chip with address 0x30 that’s not work. I logged the IIC transaction with datalogger but I don’t see the 0x30 address.
I try to make example programs for this problem and share in this froum

so I try to make a sample to show the bug in the library, suppose we have two chips on the I2C bus in addresses 0xA6 And 0x90. we try to initialize the bus with this function:

bool IIC_Init(void)
{
    s32 ret = Ql_IIC_Init(1,PINNAME_RI,PINNAME_DCD,TRUE);
	if(ret < 0)
	{
	   Errdebug("Failed!! Ql_IIC_Init channel 1 fail ret=%d",ret);
       return false;
	}
	
    ret = Ql_IIC_Config(1,TRUE, 0x90, 400);
	if(ret < 0)
	{
		Errdebug("Failed !! Ql_IIC_Config channel 1 fail ret=%d",ret);
	}
   infodebug("i2c init ok.");
   return true;
}

after that, I tried to communicate with the 0xA6 chip but in the I2C bus nothing happened, it’s shown in the below picture
2022-11-28_11-34
if change the 0x90 to 0xA6 in the Ql_IIC_Config function on the IIC_Init like this

ret = Ql_IIC_Config(1,TRUE, 0xA6, 400);

and tried to communicate with chip 0xA6, everything worked fine like the below picture

but other addresses don’t work :expressionless:

and another thing, when we tried speed up the bus to 1Mhz, we were surprised!
because we have a guest on our communication! look up at the picture


the second part shown in red is our request, it communicates with 1 Mhz but the first part shown in the purple is guest part and communicates with a different speed :confused:
why do we have this part?

ok, thank you very much for sharing!
We will analyze this phenomenon internally. Please wait for your reply!

1 Like

OK,When you are using multiple iic devices, Ql_IIC_Config does not take effect when you use "s32 Ql_IIC_Write(u32 chnnlNo, u8 slaveAddr, u8 *pData, u32 len); Focus on the slaveAddr parameter, as long as the address is correct, it is normal to read and write

you are sure?
I config IIC Bus Like This:

    s32 ret = Ql_IIC_Init(1,PINNAME_RI,PINNAME_DCD,TRUE);
	if(ret < 0)
	{
	   Errdebug("Failed!! Ql_IIC_Init channel 1 fail ret=%d",ret);
       return false;
	}
	
    ret = Ql_IIC_Config(1,TRUE, 0x07, 300);
	if(ret < 0)
	{
		Errdebug("Failed !! Ql_IIC_Config channel 1 fail ret=%d",ret);
	}

and I try send data to sensor on address 0x30 or 0x31 with this code

u8 data[2] = {0};
s32 r = Ql_IIC_Write(1,0x31,data,2);

but I got -308 (QL_RET_ERR_IIC_SLAVE_NOT_FOUND) error from Ql_IIC_Write function and nothing happend on IIC bus :confused: