Not successful in communicating with I2C device using CYPD-3125 core

Announcements

Live Webinar: USB-C adoption. Simple & Cost-efficient solutions | April 18th @9am or 5pm CEST. Register now !

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

HI,

Need some guide line on why I2C device read/write is not success. Iam using PSOC creator to creat MUX_CTRL I2C master component. REad/Write routine looks like below. All  I2C driver calls return success but returned value is not matching with what expected.

Thank you,

uint8_t I2CDeviceReadReg(uint8_t reg)

{

     uint8_t writebuf[1]={0x0};

    uint8_t readbuf[1]={0};

    writebuf[0]=reg;

.......

        MUX_CTRL_I2CMasterWriteBuf(ADDR,(uint8_t*)writebuf,1,MUX_CTRL_I2C_MODE_NO_STOP);

        while((MUX_CTRL_I2CMasterStatus() & MUX_CTRL_I2C_MSTAT_WR_CMPLT)==0){};

        MUX_CTRL_I2CMasterReadBuf(ADDR,(uint8_t*)readbuf,1,MUX_CTRL_I2C_MODE_REPEAT_START);

        while((MUX_CTRL_I2CMasterStatus() & MUX_CTRL_I2C_MSTAT_RD_CMPLT)==0){};

................       

return 0;

}

void I2CDeviceWriteReg(uint8_t reg,uint8_t value)

{

    uint8_t writebuf[2]={0};

   

    writebuf[0]=reg;

    writebuf[1]=value;

   

    MUX_CTRL_I2CMasterWriteBuf(ADDR,writebuf,2,MUX_CTRL_I2C_MODE_COMPLETE_XFER);

    while((MUX_CTRL_I2CMasterStatus() & MUX_CTRL_I2C_MSTAT_WR_CMPLT)==0){};

   

    return;

   

}

0 Likes
1 Solution
RajathB_01
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Hi Arun,

You have another thread on the same issue, which has correct answer.

Redirecting to that thread: CYPD-3125 I2C line usage

Regards,

Rajath

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

What is your I2C slave? Please check if you used the correct byte address

Anonymous
Not applicable

HI Joe,

I am using pericom PI3USB30352 I2C slave device to handle cable flip logic, as per data sheet address address mapped to 0xA8 and 0xAA

Pin A0 = 0(hardwired)

       A1= 1 (hardwired)

Can you access the datasheet of it?

Thank you,

Arun

0 Likes
ShifangZ_26
Moderator
Moderator
Moderator
10 likes given 250 sign-ins 1000 replies posted

Hi Arun,

I could like to share an I2C example with PSoC4 (CCG is ARM M0 same as PSoC) for your reference. Link: http://www.cypress.com/documentation/code-examples/ce95363-i2c-master-using-serial-communication-blo...

Of course, if you could like to have an CCGx project example, the CYPD3125 have a I2C master in notebook firmware. You can get a I2C component MUX_CTRL, and then search MUX_CTRL in whole project, you can understand what CCG3 have been done with I2C master and learn it from it. And then, drag a new I2C master component and customize it as per your requiremnets.

Best Regards,

Lisa

0 Likes
RajathB_01
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Hi Arun,

You have another thread on the same issue, which has correct answer.

Redirecting to that thread: CYPD-3125 I2C line usage

Regards,

Rajath

0 Likes