MC60 I2C fails to read

Try This —> Pull up SDA ,SDL to V-EXT(2.8 v) with a 4.7K Resistor .

Connect i2c Gyro–>Lsm6dsl

configure i2c in H/w or S/w mode

/*Hardware i2c mode */

u32 h_s=1; //1=hardware I2c mode,0=Software I2c mode
u32 chnl=1;//channel select =1

ret = Ql_IIC_Init(chnl,PINNAME_RI,PINNAME_DCD,h_s);

ret = Ql_IIC_Config(chnl,TRUE,0xD4,300);// IIC interface ,Device ID IicSpeed.

/*reading Who am I register inside a 2 sec timer */

void Timer_handler(u32 timerId, void* param)
{
u8 read_data[2]={0,0};
u8 read_data1[2]={0,0};
u8 registerAdrr[2]={0x0F,0x00};//
u8 x=1;
s32 ret;
((s32)param) +=1;
if(Stack_timer == timerId)
{
// wrire and read seperate functions
ret = Ql_IIC_Write(chnl,0xD4,(u8*) registerAdrr,1);// To read LSM6dsl Who am I(dev id 0XD4,Register address 0X0F)
if(ret < 0)
{
APP_DEBUG("\r\n<–Failed !! IIC controller Ql_IIC_Write channel 1 fail ret=%d–>\r\n",ret);
}
else{
APP_DEBUG("\r\n<–IIC controller Ql_IIC_Write ret=%d–>\r\n",ret);
}
ret = Ql_IIC_Read(chnl, 0xD4, read_data,1); // read Who am I value to read_data[0]
APP_DEBUG("< read i2c iRet=%d, value=0X%x >\n", ret, read_data[0]);
if(ret <0)
{
APP_DEBUG("\r\n<–Failed !! IIC patameter error Ql_IIC_Read channel 1 fail ret=%d–>\r\n",ret);
}

Ql_Sleep(100);
// Single wrire read function
ret = Ql_IIC_Write_Read(1, 0xD4,(u8*)registerAdrr,1,read_data1,1);
if(ret < 0)
{
APP_DEBUG("\r\n<–Failed !! Ql_IIC_Write_Read channel 0 fail ret=%d–>\r\n",ret);
}
else
{
APP_DEBUG("\r\n<–channel 0 Ql_IIC_Write_Read ret=0X-%x–>\r\n",read_data[0]);
}

}

}

Hi…the I2C SDA and SCL lines must have a pull-up resistor, they are open drain I/O.This is likely why you don’t see any changes on these lines.The polled master example send and receive a frame from a device at address 0x55.No devices are connected, so it is normal it fails.

hi,
i want to run iic in mc60.
i2c work correctly but i want to have another Task exept main task.
i want the task work without Ql_Sleep or Ql_OS_GetMessage() .

is it possible?

i try but mc60 reset .

this is my code

void proc_mpuHandler (s32 taskId){

while(1)
{
    read_accel_z(SLAVEADDRESS,0,SET_ACCEL_2);    
    }

}

init i2c in main task

Yes, but you need to change it in the main task, because if you don’t use Ql_OS_GetMessage(), the module can’t switch to other tasks, and your main task is meaningless. You can delete the existing code in the main task and do whatever you want in it
If your code runs properly without causing a reset, then the reset should be because you were stuck in this while(1) without feeding the watchdog

why watchdog?
i just want read from iic constantly?
i moved my code in main task and I have no other task .
But the module is reset.

There is a watchdog at the bottom of the code, the default time is 30s, you write a while loop, the task can not be cut out, the code at the bottom can not feed the dog will restart