Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > i2c question

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



i2c question
Moderator:
RSKV

Post Reply
Follow this topic



i2c question

yjmoon posted on 29 May 2012 12:09 AM PST
Member
8 Forum Posts

In dvk board schematic, I2C(24LC256) address can be only  3 wire-configurable. So I think that the address range is 0X00 to 0X07.

But inthe sdk i2c regmode example, the address is always set to 0xA0~0XA7,can you explain the meaning of A........

IN EP0 Function, CyFxUSBSetupCB(.........)

i2cAddr = 0xA0 | ((value & 0x0007) << 1);

Thanks.




Re: i2c question

sodafarl posted on 29 May 2012 01:26 AM PST
Top Contributor
128 Forum Posts

Hi,

The eeprom has two address bits set internally so that its address is always 0xA? with the ? supplied by the lower 3 address bit, so you can have 8 addresses starting at 0xA0.  The I2C device address is 7 bits wide with the 8th LSB indicating either an I2C Read (logic 1) or I2C Write (Logic 0). So you have only 7 bits in an I2C device address.

i2cAddr = 0xA0 | ((value & 0x0007) << 1);

What is happening in the code above is the value set by the user is bit masked with the 3 LSB to allow only valid address through. Next this value is shifted 1 location to the left so that it can be ORed bit for bit with the 7 bit base address..

Sodafarl



Re: i2c question

yjmoon posted on 29 May 2012 01:32 AM PST
Member
8 Forum Posts

I See, Thanks, a lot.






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.