Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® Software > I2C "read" transactions that start with a write

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



I2C "read" transactions that start with a write
Moderator:
JFMD

Post Reply
Follow this topic



I2C "read" transactions that start with a write

Doug McClean posted on 11 Jan 2012 3:43 PM PST
Top Contributor
38 Forum Posts

It's cool that the I2C master component supports buffer-at-a-time reads and writes with a Cypress-written builtin ISR. The only feature missing from the API is a function with a signature like:

uint8 MasterWriteReadBuf(uint8 slaveAddress, uint8* wrData, uint8 wrCnt, uint8* rdData, uint8 rdCnt, uint8 mode)

The function would write the bytes from wrData, send a restart, and then read rdCnt bytes into rdData. In other words it would be equivalent to:

status = MasterWriteBuf(slaveAddress, wrData, wrCnt, mode);
// possibly error handling based on status
return MasterReadBuf(slaveAddress, rdData, rdCnt, I2C_MODE_REPEAT_START);

except that it would be handled by the builtin ISR.

 

Almost all of my I2C interactions are this way: I need to write the "register address" within the device that I am interested in reading, and then read the contents of that register. Performing the transition without having  the interrupt handle it is tricky to do without spinning the processor waiting for the initial write transaction to take place at the much-slower-than-bus-clock I2C clock rate. This is a very, very common pattern of use of the I2C bus, almost every I2C device datasheet I know of works this way.




Re: I2C "read" transactions that start with a write

kmmankad posted on 11 Jan 2012 07:58 PM PST
Top Contributor
268 Forum Posts

Yes,you've raised a valid point. Perhaps component developers browsing this forum will include this in the next revision.Till then,feel free to add that function to your copy of the component :-)



Re: I2C "read" transactions that start with a write

H L posted on 11 Jan 2012 08:46 PM PST
Top Contributor
679 Forum Posts

I think this would be good to have this API included in later revision of creator.



Re: I2C "read" transactions that start with a write

yfs posted on 12 Jan 2012 07:45 AM PST
Cypress Employee
77 Forum Posts

I am not a "content" guy but I've created an internal case to make sure we discuss this enhancement. I cannot predict what will be decided but we will talk about it. We appreciate all these suggestions to make Creator better!

As an aside, if you are on PSoC Creator 2.0, you will soon be seeing a component pack release from us, which contains updates to some existing and a couple of brand new components. This will install into your existing 2.0 image (really quickly). The idea behind these releases is that they are easier to do (because only the content changes, not the whole tool) and we can crank them out faster... which means more components and faster updates of existing ones. So, now is a good time to be making requests for component features...

-- Mark.

 



Re: I2C "read" transactions that start with a write

bwang posted on 08 Aug 2012 06:42 PM PST

1 Forum Post

Anyone knows if this enhancement is planned for the future PSoC Creator?  I still don't see this in PSoC Creator 2.1.






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.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20