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
RIoTboard
  • Products
  • Dev Tools
  • Single-Board Computers
  • RIoTboard
  • More
  • Cancel
RIoTboard
Forum How to test the i2c
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join RIoTboard to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 10 replies
  • Subscribers 22 subscribers
  • Views 3714 views
  • Users 0 members are here
Related

How to test the i2c

Former Member
Former Member over 11 years ago

Hi !, i need to test the i2c port on the expansion port, i take a look to /dev and i found i2c-0 ,i2c-1, .... I´m new on this i just wondering if someone could poing me on the right direction, i want to send data on a loop through i2c port and check it on the oscilloscope, that´s it. I´m just not sure where to start.

  • Sign in to reply
  • Cancel

Top Replies

  • Former Member
    Former Member over 11 years ago +1
    Android or Linux ? If Linux, 3.0.35 or 3.15-rc* ? Which i2c interface on which expansion port ? There are four i2c interfaces, some are available on multiple expansion interfaces, some expansion interfaces…
Parents
  • Former Member
    0 Former Member over 11 years ago

    Android or Linux ?  If Linux, 3.0.35 or 3.15-rc* ?

     

    Which i2c interface on which expansion port ?  There are four i2c interfaces, some are available on multiple expansion interfaces, some expansion interfaces have multiple i2c interfaces available.

    For example, if you're talking about J13 then there's both i2c3 & i2c4.  The physical i2c interfaces don't necessarily map directly to the /dev entries.. So you can have things like /dev/i2c-2 maps to the physical i2c4 pins..

     

    However you look at it, you need more information to be able to work out what you need to do.

     

    Under Linux, you should look for the i2c-tools package. You'll want i2c-detect or i2c-dump to do the i2c accesses.

     

    I don't use android, so can't really help much if that's what you're trying to use.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to Former Member

    Ah ok ok, What i want to do is to test the i2c interface but right now i don´t have any i2c device to interface with so i´m thinking just sending data over the i2c3 interface and check the signals with a logic analyzer.

     

    I will do it on linux and yes, as you said is the J13 , i2c3 (pin 31 and 33) which is on /dev/i2c-2.


    I already read something about i2c-tools but the thing is that i´m not connecting any device on the port therefore using i2c-detect doesn´t get me any address and i can´t use i2cdump because i don´t know in what address to write data.

     

    For example when i tested the uart i send the data without the need of connecting anything and i just check the signals with the logic analyzer, i´m new at this and i don´t know how to do that with the i2c interface.

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

    You may not be able to use the physical i2c3. The reason is that i2c3_sda is likely to be used for the ethernet interrupt workaround.  i2c4 might be a better choice, depending on which kernel you're using.

     

    i2cdetect probes a range of addresses, so if you connect the scope, you'll see it trying every address with no response.

     

    Similarly, with i2cdump you can ask it to dump a range of data from a particular address. If you don't have anything connected, it won't matter which address you pick, you won't get any data returned, but you will be able to see the attempts to read the data on the scope, something like this:

    image

    closer in it looks like this

    image

     

    As you can see the address is clocked out, but no ack from the non-existent device, so we just loop sending addresses.

     

    The above was done with i2cdetect with nothing on the bus, the output from i2cdetect looks like this:

    root@riotboard:~# i2cdetect 2
    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will probe file /dev/i2c-2.
    I will probe address range 0x03-0x77.
    Continue? [Y/n] y
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                        

     

    With my kernel, /dev/i2c-2 is i2c4 on pins 35 & 37 on J13

     

    If you have a monitor connected to HDMI then you can read it's EDID with something like

     

    root@riotboard:~# i2cdump 1 0x50
    No size specified (using byte-data access)
    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will probe file /dev/i2c-1, address 0x50, mode byte
    Continue? [Y/n] y
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 00 ff ff ff ff ff ff 00 10 ac 21 a0 53 35 44 30    ........??!?S5D0
    10: 16 10 01 03 80 29 1f 78 ee ee 91 a3 54 4c 99 26    ?????)?x????TL?&
    20: 0f 50 54 a5 4b 00 81 80 a9 40 71 4f 01 01 01 01    ?PT?K.???@qO????

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to Former Member

    Thanks !!, it works and also you´re explanation was really helpful, .

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

    Thanks !!, it works and also you´re explanation was really helpful, .

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