Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > I2C Questions and Errors

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



I2C Questions and Errors
Moderator:
RSKV

Post Reply
Follow this topic



I2C Questions and Errors

catacon posted on 18 Jun 2012 8:41 AM PST
Senior Member
11 Forum Posts

Hey all,

I have been working on interfacing with an Aptina Imager (MT9P031) which uses I2C for configuration.  I have the GPIF setup to interface with the imager and GPIOs setup as enables, disables, etc.  I have been able to interface I2C with other devices, but I am having issues with the Imager.  We have the Imager working with and FX2, so much of the protcol I am using is copied from the FX2 firmware.

1) When using CyU3PI2cWaitForAck() or CyU3PI2cTansmitBytes() to write to the Imager registers, both functions return '74' which is CY_U3P_ERROR_FAILURE.  When I check the I2C error code with CyU3PI2cGetErrorCode(), it returns '15' which is not listed in the error code enumeration.  Any idea what this means?

status = CyU3PI2cTransmitBytes(&preamble, data, 2, 0);

2) When using CyU3PI2cSendCommand() to write to the Imager registers, it will always return CY_U3P_SUCCESS even if I use the wrong imager address or configure the preamble incorrectly.  Any idea why it always returns a success?

status = CyU3PI2cSendCommand(&preamble, 4, CyFalse);

3) As far as I understand, the ctrlMask member of the Preamble sets the start and stop bits AFTER each bit of the preamble.  Does the I2C API automatically send a start bit BEFORE the first preamble bit?  Does it send a stop bit after the last I2C bit, preamble or otherwise?

 

Thanks,

Aaron




Re: I2C Questions and Errors

RobK posted on 19 Jun 2012 12:11 AM PST
Top Contributor
56 Forum Posts

Hi,

Q1) I observed the same issue! The Cypress Tech support admitted that this is an undocumenetd error-code and they wanna fix this in next SDK-release. I observed this error-code when I used the wrong slave-address, maybe it's a similar issue inyour application?!

Q2) No idea since I never used this API. But the API CyU3PI2cTransmitBytes() had a similar bug where it always returned success if only 1 byte was sent. This is fixed with SDK1.1. So maybe a similar issue  here?!

Q3) I think the start bit before the first byte is set automatically but if the direction is changed ("read slave" to "write slave" or "write slave" to "read slave") in your preamble you have to set a repeated start-condition in the controlMask. If you want to have a STOP condition after getting an ACK from slave as a response to a byte in your preamble you need also to specify this in the contolMask.



Re: I2C Questions and Errors

RSKV posted on 19 Jun 2012 01:44 AM PST
Cypress Employee
655 Forum Posts

 Regarding I2C APIs, I would recommend you to create a tech support case (MyAccount -> MyCases).

 



Re: I2C Questions and Errors

catacon posted on 19 Jun 2012 07:59 AM PST
Senior Member
11 Forum Posts

Thanks for the replies.  I kind of assumed that 'error 15' was just undocumented.  I did get this error with another device when I had a couple jumpers on the DVK set incorrectly (J45 and J42).  I am sure everything is connected correctly this time, though.  And I know I have the imager address correct.

I was able to get a scope of the I2C lines and it looks like it only sends the first byte of the preamble (device address).  So I assume this means that the imager is simply not able to respond.



Re: I2C Questions and Errors

catacon posted on 08 Jul 2012 01:17 PM PST
Senior Member
11 Forum Posts

So I was able to solve this.  It actually had nothing to do with the I2C functions.  The image sensor requires an external clock which I was providing via a complex GPIO.  SInce the GPIO I was using is part of the GPIF, I was overloading it, but I was not setting the second parameter of CyU3PDeviceGpioOverride() to CyFalse which overrides the GPIO as complex.  So the image sensor was never active which is why is would not respond to I2C functions.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.