MC60E I2C problem

Hi
I have problem with i2c MC60E .I underestand that mc60E i2c has a problem .I connect the analog descovery2 to SDA and SCL and get the below result:
##########################################################
send from mc60E open cpu: ret = Ql_IIC_Write(1, 0x1D, write_buffer,4);
recive from analogdescovery2: Start, h1C [ h0E | WR ] NAK, Stop

send from mc60E open cpu: ret = Ql_IIC_Read(1, 0x1D, write_buffer, 6);
recive from analogdescovery2: Start, h1D [ h0E | RD ] NAK, Stop
##########################################################
My i2c address in the program is 0x1D (for ADXL345)but when I monitor the i2c bus it changed to 0x0E.
I don’t know what I do :frowning:

Hi ,

you need to shift your slave address by one bit left . in MC60 slave address need to be 8 bit so for 7 bit i2C you have to shift address to one bit left . For example if slave address is 3C then in config it needs to be 3C but in I2C write api , it needs to be 78
Regarding using of I2C you can refer below .

 How to write register address in APIS of read , write and Write_read .
ok,I’ll introduce you how configure register address by the following example.

  1. You can use this API (s32 Ql_IIC_Write_Read(u32 chnnlNo, u8 slaveAddr, u8 * pData, u32 wrtLen, u8 * pBuffer, u32 rdLen))
    pData: Setting value of the register address of slave.
    eg : Ql_IIC_Write_Read (0, 0x07, 0x00, 1,read_buffer, 6) ----0x07: slave address 0x00: register address
    2.1 If you use API(Ql_IIC_Read),should be write register address first.
    u8 write_buffer[1]={0x00};
    eg : Ql_IIC_Write(0, IIC_ADDR, write_buffer,1);—write register address 0X00
    Ql_IIC_Read(0, IIC_ADDR, read_buffer, 4);—read 4bytes data from 0x00-0x04
    2.2 If you use API(Ql_IIC_Write), write the first byte is register address.
    u8 write_buffer[5]={0x00,0x0a,0x0b,0x0c,0x0d};
    eg : Ql_IIC_Write(0, IIC_ADDR, write_buffer,5);----write 4bytes data from 0x00-0x04.
1 Like

thaks for your answer

Hi ,

I hope you can use I2C now .

1 Like