How to use Control Center to read from I2C device?

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

cross mob
jkhoo
Level 3
Level 3
25 replies posted 25 sign-ins First solution authored

Hi EZ-USB team,

Based on the the dialog box provided by control endpoint in Control Center. How should i fill up the box for a I2C device with adress 0xA0 (7 bits from the left are the address and 1 bit from the right is read/write).

Reg code = 0xC1

wValue = ?

wIndex = ?

Direction = In

Bytes to Transfer = 8

I try to set wValue = 0xA0, but i get responce as follow:

CONTROL IN transfer
0000 FF FF FF FF FF FF FF FF
CONTROL IN transfer completed

 

Here are the Handle supported vendor requests we implement for I2C read.

case 0xC3:

CyU3PMemSet (glEp0Buffer, 0, sizeof (glEp0Buffer));
status = CyFxUsbI2cTransfer (wIndex, wValue, wLength, glEp0Buffer, CyTrue);
if (status == CY_U3P_SUCCESS) {

status = CyU3PUsbSendEP0Data(wLength, glEp0Buffer);

}

break;

0 Likes
1 Solution
Biren_R
Moderator
Moderator
Moderator
First question asked First like given 250 sign-ins

Hello,

If you use the example code without any change it will work as per the readme file.

Biren_0-1647322103767.png

 



Best Regards,
Biren

View solution in original post

0 Likes
4 Replies
jkhoo
Level 3
Level 3
25 replies posted 25 sign-ins First solution authored

Hi EZ-USB team, (earlier post has a typo)

Based on the the dialog box provided by control endpoint in Control Center. How should i fill up the box for a I2C device with adress 0xA0 (7 bits from the left are the address and 1 bit from the right is read/write).

Reg code = 0xC3

wValue = ?

wIndex = ?

Direction = In

Bytes to Transfer = 8

I try to set wValue = 0xA0, but i get responce as follow:

CONTROL IN transfer
0000 FF FF FF FF FF FF FF FF
CONTROL IN transfer completed

 

Here are the Handle supported vendor requests we implement for I2C read.

case 0xC3:

CyU3PMemSet (glEp0Buffer, 0, sizeof (glEp0Buffer));
status = CyFxUsbI2cTransfer (wIndex, wValue, wLength, glEp0Buffer, CyTrue);
if (status == CY_U3P_SUCCESS) {

status = CyU3PUsbSendEP0Data(wLength, glEp0Buffer);

}

break;

0 Likes
Biren_R
Moderator
Moderator
Moderator
First question asked First like given 250 sign-ins

Hello,

Can you help us with the code example name which you refer to for this? 

Best Regards,
Biren

0 Likes
jkhoo
Level 3
Level 3
25 replies posted 25 sign-ins First solution authored

the code we used and refer to are from cyfxusbi2cregmode example at line 267.

0 Likes
Biren_R
Moderator
Moderator
Moderator
First question asked First like given 250 sign-ins

Hello,

If you use the example code without any change it will work as per the readme file.

Biren_0-1647322103767.png

 



Best Regards,
Biren

0 Likes