cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

mama_1614126
New Contributor II

I'm using the USB Serial SDK to build a USB-I2C bridge with the CY7C65211 broken off a CY8CKIT-049-42XX. As a first step I'm reading some "who am i" registers, and on the face of it that works fine, so far.

However, on the logic analyzer I see a long delay of 3-8ms between the I2C write and the read. (The two rather randomly chosen test devices, INA219 and MPU6050, require to first set the register pointer with a 1-byte write followed by a 1-byte read.)

It is clearly the master who is responsible for this, because in the 3-8ms waiting period the clock is low - which I find a bit strange, too.

Those 3-8ms equate to 125-333Hz, which is quite slow given the capabilities of the device and USB itself.

What is the reason for this delay? Can it be avoided or is there anything to watch out for?

The C program is absolutely straightforward: Open device, write, read, close. The CY7C65211 has the default configuration, just with the switch to I2C.

0 Likes
1 Solution
Sananya_14
Moderator
Moderator

Hello,

The subsequent read command after the write command is sent by the host and the delay depends on a number of factors such as the processes running on the host etc. The device will hold the clock low till it receives the read command and there may be a delay before the repeated start condition. Could you please attach a plot capturing the delay?

Best Regards,

Sananya

View solution in original post

9 Replies
Sananya_14
Moderator
Moderator

Hello,

The subsequent read command after the write command is sent by the host and the delay depends on a number of factors such as the processes running on the host etc. The device will hold the clock low till it receives the read command and there may be a delay before the repeated start condition. Could you please attach a plot capturing the delay?

Best Regards,

Sananya

View solution in original post

mama_1614126
New Contributor II

Here's an image:Screenshot from 2019-01-08 14-26-23.png

0 Likes
mama_1614126
New Contributor II

Here's the result for the competing product (5 lines of python code):

Screenshot from 2019-01-11 10-08-47.png

Very tidy, and no extraneous byte at the end of the read.

The result isn't very surprising. With the Cypress I2C library the write and the read are two separate USB calls, hence the long delay.

It's a nice effort, but as it stands the Cypress i2c library isn't usable for communicating with anything but the simplest i2c devices.

0 Likes
Sananya_14
Moderator
Moderator

Hello Markus,

As you mentioned, since the library uses two separate APIs for Write and Read, the delay cannot be controlled by the device. However, I am sharing the library source with you, if you would like to reduce the delay by optimizing both the APIs for example by removing the Sleep statements present.

Best Regards,
Sananya

mama_1614126
New Contributor II

Thank you for sharing this. (You need to provide the password for the zip file, too.)

However, not having to write USB drivers, in particular on Windows, was one of the motivators for wanting to use this chip.

And I've discovered even bigger issues with the I2C since then, so, until I see the errata I won't be touching the CY7C65211, I hope you understand. I really am not in the business of debugging your firmware.

But I appreciate the gesture.

0 Likes
Sananya_14
Moderator
Moderator

Hello Markus,

The password is: cypress. Thank you for your patience, kindly follow up on Where are the errata for CY7C65211, CY7C65213, CY7C65215?  for updates on the Errata release.

Best Regards,

Sananya

0 Likes
jilic_4052711
New Contributor

I think the source code of the DLL could help us to understand the delay between two I2C Read. The function prototype of the DLL are changed, so the codes in SDK example won't work with the new DLL. Did someone got the exampe codes for the new DLL?

0 Likes
Sananya_14
Moderator
Moderator

Hi,

Could you please specify which function prototypes you are referring to? I will check for those since this is the only source code that we have available and ideally should work with the SDK examples.

Best Regards,
Sananya

0 Likes
jilic_4052711
New Contributor

Hi, Sananya,

I will use the I2C and gpio functions. The header file CyUSBSerial.h of the dll source code you published is different from that in the SDK. I suppose that the codes are not up-to-date. I could build an example with your source code and as a result the delay for reading I2C is reduced by deleting the Sleep in the function for I2C reading.

SDK revision is 2.0.3 and your source code is 1.0.0. Could you please send me the DLL source code of the current revision?

Best Regards

Jianhua

0 Likes