- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is your I2C slave? Please check if you used the correct byte address
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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