CYPD-3125 I2C line usage

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

Facing issue in using I2C line between PSOC CYPD-3125 and Cross Bar I2C device.  Using PSOc creator to create I2C master component and followed some of the sample with developement kit but I2C read write is not success. API return success but written value is not reflected on device register. Can you provide any suggestion to overcome the issue.

Build version shows 3.10 . Within I2C Driver code its observed there are some piece of code specific to version #if (MUX_CTRL_CY_SCBIP_V0) so do i need to look any Psoc creator specific CYPD-3125 SDK to overcome the issue.

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
Anonymous
Not applicable

Hi,

I got solution. I2C address provided was not OK. I need to provide right shifted value. And also in read sequence i need not to use repeat flag as per the data sheet. Issue is resoved.

Thank you,

View solution in original post

3 Replies
Anonymous
Not applicable

Making sure you have the most up-to-date components is the best policy if you are having issues with an older version.

Right-click on the project in the file-tree window and select "Update Components"

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.

BTW, for CCG3 project, please insist to use PSoC Creator 3.3 DP1. Please do not upgrade to the latest one since the GCC compiler is difference with difference PSoC Creator.  

Best Regards,

Lisa

Anonymous
Not applicable

Hi,

I got solution. I2C address provided was not OK. I need to provide right shifted value. And also in read sequence i need not to use repeat flag as per the data sheet. Issue is resoved.

Thank you,