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

USB low-full-high speed peripherals Forum Discussions

tho_ka
Employee
Employee
First like received 5 sign-ins First reply posted

Hello,

 

I want to use the CY7C65211 as an interface between my Host - PC and a peripheral (e.g. sensing unit) acting as the I2C slave. To be more agile I wanted to write a driver within Matlab - which works flawlessly already - except for one crucial part: The CyI2cRead function.  My sequence is the following:

  1. CyOpen
  2. CySetI2cConfig
  3. CyI2CWrite (within for loop)
  4. CyI2CRead (within for loop)
  5. CyClose

 

When running it for  1000 iterations, I have a Read Success rate of ~ 2% - so I had roughly 20 successful read operations

Question # 1  

Do you have an experience whether there is a known issue for the read command? I am using it as the following:

[bStatusRead, CY_HANDLE, sTransferCountRead, cReadBuff] = calllib('CyLib','CyI2cRead',CY_HANDLE, CY_I2C_DATA_CONFIG, CY_Read_DATA_BUFFER, sTimeout)

(i hope this is clear)

for comparison, this is the function within the header file:

CY_RETURN_STATUS CyI2cRead (CY_HANDLE handle, /*Valid device handle*/
CY_I2C_DATA_CONFIG *dataConfig, /*I2C data config*/
CY_DATA_BUFFER *readBuffer, /*Read buffer details*/
UINT32 timeout /*API timeout value*/);

 

Concerning the error itself:

I have 3 different outputs from a read command

  1. Either nothing happens after the start condition, which is then followed by a returned 'CY_ERROR_I2C_NAK_ERROR' - Status 
  2. No stop Bit is sent, therefore it reads until the 'CY_ERROR_IO_TIMEOUT' is returned
  3. It works

I am very thankful for any advice

 

 

BR,

Thomas

1 Reply
narolkarvarun
Moderator
Moderator
Moderator
100 sign-ins 25 replies posted First solution authored

Hi tho_ka ,

Can you please let us know which I2c Device are you using it will be good if you share the device datasheet.

please share your configuration. have you configured USB serial device using USB Serial Utility tool .

Thank You 

Varun Narolkar

 

0 Likes
This widget could not be displayed.