element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Forget Me Not Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Forget Me Not Design Challenge
  • More
  • Cancel
Forget Me Not Design Challenge
Blog "Remember Me Always!" - Part 021
  • Blog
  • Forum
  • Documents
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: COMPACT
  • Date Created: 7 Oct 2014 12:27 AM Date Created
  • Views 548 views
  • Likes 2 likes
  • Comments 0 comments
  • forget_me_not
  • remember_always
Related
Recommended

"Remember Me Always!" - Part 021

COMPACT
COMPACT
7 Oct 2014

Can you Please Repeat from the Start?

image

Figure 1. Proof that Raspberry Pi supports Repeated Start conditions (annotated with Green Left Brackets)

 

I2C is not as straightforward as some people think and there are a couple of wrong assumptions floating out in cyberspace.

Unlike the asynchronous RS-232 protocol where there is always a start bit followed by some payload with optional parity bits and terminated with some stop bits, I2C support transactions that contain multiple Start conditions without corresponding End conditions.

These are known as combined access requests and are typically used for register based devices where a register address is specified followed by a read or write of some data to it.

The lack of End condition before the restart condition is deliberate for a couple of reasons. Firstly it indicates to the device that transaction is still active and secondly stops any other I2C masters from acquiring the I2C bus.

Contrary to many posts out on the Internet the Standard Raspberry Pi I2C driver does support it. It just happens to be disabled by default.

 

The picture above is taken with the Tektronix TBS1052B-EDU's bigger and older sister the MSO2024 with protocol decoding module.

For I2C it shows start conditions with green left brackets and stop conditions with red right brackets.

The attached figure is configured to show the I2C device address with the R/W bit included.

The 40 (address 0x20 in 7 bit addressing) indicates a write request and the 41 indicates a read request.

The device under test is a MicroChip MCP23017 16-bit IO port expander. It's the I2C version of the MCP23S17.

 

After installing the appropriate I2C packages on the Raspberry Pi all that is required to get combined access working is to enable it using something like

echo -n 1>/sys/module/i2c_bcm2708/parameters/combined

 

and optionally configuring the Linux user security to the I2C bus.

 

To program a combined access sequence using the standard driver, you'll need to construct the desired sequence using an array of i2c_msg structures with a corresponding i2c_rdwr_ioctl_data structure and calling ioctl( <file_descriptor>, I2C_RDWR, &<i2c_rdwr_ioctl_data_structure> )

 

The i2c_msg structures contain the construction detail of each access component and the i2c_rd_wr_ioctrl structure is used by ioctl() to access the array of i2c_msg structures.

 

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube