element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • 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
Single-Board Computers
  • Products
  • Dev Tools
  • Single-Board Computers
  • More
  • Cancel
Single-Board Computers
Forum I2C Slave?
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Single-Board Computers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 14 replies
  • Subscribers 60 subscribers
  • Views 3547 views
  • Users 0 members are here
Related

I2C Slave?

Former Member
Former Member over 10 years ago

Hi

I need to communicate with a I2C master with a BeagleBone black rev3 (Debian) as a slave.

I have search over the internet but not find anything. I'm new with BeagleBone.

I find a lot of example for master but not for the slave.

Can somebody please help me?

 

Regards Stefan

  • Sign in to reply
  • Cancel

Top Replies

  • Former Member
    Former Member over 10 years ago in reply to shabaz +1
    Thanks for the responses, Gary and shabaz! I had already done some surface level searches for Linux I2C drivers that also do slave-mode but didn't come up with anything conclusive. And I had almost forgot…
  • gdstew
    gdstew over 10 years ago in reply to clem57 +1
    "if you let the master "broadcast" a welcome message to see who responds with an address" The address used for this in the I2C specification is the general call address. I think your are correct that this…
  • Former Member
    Former Member over 10 years ago +1
    @ benett Linux 3.19 provides I2C slave mode kernel driver.
Parents
  • clem57
    0 clem57 over 10 years ago

    @benett

    May I ask what would the master be? Will there be any other I2C in the design on the same interface? How will the BBB respond to the clock from the master? One way could be to have a forever running service. Another would be to sense interrupt and respond(a bit more difficult). How much coding do you want to do or are you looking for already done code? A hardware hookup picture can help me to suggest some coding...

     

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • clem57
    0 clem57 over 10 years ago

    @benett

    May I ask what would the master be? Will there be any other I2C in the design on the same interface? How will the BBB respond to the clock from the master? One way could be to have a forever running service. Another would be to sense interrupt and respond(a bit more difficult). How much coding do you want to do or are you looking for already done code? A hardware hookup picture can help me to suggest some coding...

     

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • Former Member
    0 Former Member over 10 years ago in reply to clem57

    Hi

    There will only be one master and one slave. I have no control over the master, it sends a "ping" and listen to a answer from the slave with right address.

    After that normal I2C operation.

    I found this code for the Arduino and that is what I need for BeagleBone, a library. http://arduino.cc/en/Tutorial/MasterWriter

    If someone know what I can find it, I will be happy. image

    // Wire Slave Receiver
    // by Nicholas Zambetti <http://www.zambetti.com>
    
    // Demonstrates use of the Wire library
    // Receives data as an I2C/TWI slave device
    // Refer to the "Wire Master Writer" example for use with this
    
    // Created 29 March 2006
    
    // This example code is in the public domain.
    
    
    #include <Wire.h>
    
    void setup()
    {
      Wire.begin(4); // join i2c bus with address #4
      Wire.onReceive(receiveEvent); // register event
      Serial.begin(9600); // start serial for output
    }
    
    void loop()
    {
      delay(100);
    }
    
    // function that executes whenever data is received from master
    // this function is registered as an event, see setup()
    void receiveEvent(int howMany)
    {
      while(1 < Wire.available()) // loop through all but the last
      {
      char c = Wire.read(); // receive byte as a character
      Serial.print(c); // print the character
      }
      int x = Wire.read(); // receive byte as an integer
      Serial.println(x); // print the integer
    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 10 years ago in reply to Former Member

    I am getting a BeagleBone Black any day now. When I have it, I can explore some choices like I2C.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
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