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
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development Problem with linaro and i2c devices
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 1 reply
  • Subscribers 328 subscribers
  • Views 335 views
  • Users 0 members are here
Related

Problem with linaro and i2c devices

Former Member
Former Member over 10 years ago

Hi,
I'm facing some problems trying to work with a i2c camera and linaro on a zedboard.
For first I tested the system with the bare metal OS and everything works smooth thanks to all the support file created in the sdk, then I tried to switch to linaro, but I don't understand how to use the device properly.
Using /dev/mem for a quick test I was able to send a reset signal to the device in order to verify that it was properly mapped, then I tried to add to the device tree this:

=========================================
ps7_i2c_0: ps7-i2c@e0004000 {
clock-frequency = <400000>;
clocks = <&clkc 38>;
compatible = "cdns,i2c-r1p10";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 25 4>;
reg = <0xe0004000 0x1000>;
xlnx,has-interrupt = <0x0>;
xlnx,i2c-reset = "";
} ;
=========================================

As far as I have understand of the device tree "cdns,i2c-r1p10" should be the name of the driver associated with the peripheal, is this right?
The result was that under "/sys/devices/..." I now have "ps7-i2c@e0004000", how I'm supposed to used it now?
I have tried googling for it but with not good results... Have you some good guide, advice or tutorial on this specific argument?
Thank you in advance and sorry for the dumb question, but I think that I'm missing some crucial part here!

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    0 Former Member over 10 years ago

    What are you trying to do on I2C?  For example, I installed a PMOD real-time-clock.  I did the following for my setup using a microZed 7020.

    1) Create a new block design with I2C 0 mapped to MIO 14 & 15 with pullups enabled and no interrupt.
    2) Generate a new bit file, fsbl, boot.bin, etc
    3) Update my device tree as follow:
    -------------------
    ttps7_i2c_0: ps7-i2c@e0004000 {
    tttbus-id = <0>;
    tttclock-frequency = <100000>;
    tttclocks = <&clkc 38>;
    tttcompatible = "cdns,i2c-r1p10";
    tttinterrupt-parent = <&ps7_scugic_0>;
    tttinterrupts = <0 25 4>;
    tttreg = <0xe0004000 0x1000>;
    tttxlnx,has-interrupt = <0x0>;
    ttt#address-cells = <1>;
    ttt#size-cells = <0>;
    tttrtc@6F {
    ttt       compatible = "dallas,ds1337";
    ttt       reg = <0x6F>;
    ttt       };
    tt} ;
    -----------------
    Things to note:
    a) I reduced the clock from 400kHz to 100kHz
    b) I added a section rtc@6F to tell Linux my real-time-clock is at address 0x6F, and also what specific clock device I have.
    4) Now in linux if I type:
    i2cdetect -y -r 0
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU
    70: -- -- -- -- -- -- -- --

    This shows my RTC is active at 6F (hence the UU).  The device also has something at 57 that I haven't looked at yet.
    5) Since I have the RTC compiled into the kernel, in conjunction with the device tree, I get a /dev/rtc0 and a link to at at /dev/rtc.

    I don't have it working 100% at the moment, but it does somewhat work.  There are other examples out there on how to configure different I2C devices via the device tree.  Just make sure your kernel also supports the device.

    Hope this helps.

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

    What are you trying to do on I2C?  For example, I installed a PMOD real-time-clock.  I did the following for my setup using a microZed 7020.

    1) Create a new block design with I2C 0 mapped to MIO 14 & 15 with pullups enabled and no interrupt.
    2) Generate a new bit file, fsbl, boot.bin, etc
    3) Update my device tree as follow:
    -------------------
    ttps7_i2c_0: ps7-i2c@e0004000 {
    tttbus-id = <0>;
    tttclock-frequency = <100000>;
    tttclocks = <&clkc 38>;
    tttcompatible = "cdns,i2c-r1p10";
    tttinterrupt-parent = <&ps7_scugic_0>;
    tttinterrupts = <0 25 4>;
    tttreg = <0xe0004000 0x1000>;
    tttxlnx,has-interrupt = <0x0>;
    ttt#address-cells = <1>;
    ttt#size-cells = <0>;
    tttrtc@6F {
    ttt       compatible = "dallas,ds1337";
    ttt       reg = <0x6F>;
    ttt       };
    tt} ;
    -----------------
    Things to note:
    a) I reduced the clock from 400kHz to 100kHz
    b) I added a section rtc@6F to tell Linux my real-time-clock is at address 0x6F, and also what specific clock device I have.
    4) Now in linux if I type:
    i2cdetect -y -r 0
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU
    70: -- -- -- -- -- -- -- --

    This shows my RTC is active at 6F (hence the UU).  The device also has something at 57 that I haven't looked at yet.
    5) Since I have the RTC compiled into the kernel, in conjunction with the device tree, I get a /dev/rtc0 and a link to at at /dev/rtc.

    I don't have it working 100% at the moment, but it does somewhat work.  There are other examples out there on how to configure different I2C devices via the device tree.  Just make sure your kernel also supports the device.

    Hope this helps.

    • 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