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 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
Freescale i.MX6 Development Platforms
  • Products
  • Dev Tools
  • Single-Board Computers
  • Freescale i.MX6 Development Platforms
  • More
  • Cancel
Freescale i.MX6 Development Platforms
Forum bus speed of /dev/i2c-2 on imx6q
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Freescale i.MX6 Development Platforms to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 5 replies
  • Subscribers 5 subscribers
  • Views 2410 views
  • Users 0 members are here
  • i2c
  • bus
  • speed
  • sabre_lite
Related

bus speed of /dev/i2c-2 on imx6q

Former Member
Former Member over 11 years ago

Hello everyone,

I am unaware as to who sets clock speed on the i2c bus and specifically on the /dev/i2c-2 which is exposed on the board so as to drive external equipment.

I am looking into the linux-boundary kernel files in yocto (dylan) build dir, but I cannot figure out where that is set.

To be honest I don't even know if i'll find that info there, but it seems like the right place to start (after googling about it of course).

 

So who determined the speed (standard mode, fast mode, etc) for the external i2c? if it is a driver , which one should I be looking for?

 

The reason is I am trying to drive some TMC222 low-power stepper motor control ICs, but they do not respond.

Note I have successfully connected a number of other i2c ICs (among others the pca9505x).

 

An answer is not necessary. Any pointers as to how to go about it , so I can learn about this is more than welcome.

Thank you for your help.

  • Sign in to reply
  • Cancel
  • Former Member
    Former Member over 11 years ago

    look for IMX_I2C_BIT_RATE in drivers/i2c/busses/i2c-imx.c

     

    how it's set depends a lot on the driver is written and on how new/old the kernel is, for example look at arch/arm/mach-davinci/board-da830-evm.c and you'll find

     

    static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = {

            .bus_freq       = 100,  /* kHz */

            .bus_delay      = 0,    /* usec */

    };

     

    so the speed is set in platform code and the driver takes it from there.

     

    on a newer kernel you may be using devicetree and the i2c speed would be set there rather than platform code. example on BeagleBone Black

    in arch/arm/boot/dts/am335x-bone.dts

     

    &i2c1 {

           status = "okay";

           clock-frequency = <400000>;

     

    other drivers may even have a module parameter you can set when you load the module.

     

    In summary, there are many different ways it can be done image

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

    Hi selsinork,

    in the end the location of interest is here:

     

    https://github.com/boundarydevices/linux-imx6/blob/boundary-imx_3.0.35_4.0.0/arch/arm/mach-mx6/board-mx6_nitrogen6x.c#L434

    or for older kernel

    https://github.com/boundarydevices/linux-imx6/blob/boundary-imx_3.0.35_1.1.0/arch/arm/mach-mx6/board-mx6_sabrelite.c


    I do wonder what is the IMX_I2C_BIT_RATE in drivers/i2c/busses/i2c-imx.c module though.

    I am not sure how it relates to the kernel and how it interacts with the aforementioned files .

     

    Thank you

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

    nass sil wrote:

     

    I do wonder what is the IMX_I2C_BIT_RATE in drivers/i2c/busses/i2c-imx.c module though.

    I am not sure how it relates to the kernel and how it interacts with the aforementioned files .

    well it probably depends on exactly which kernel and what patches are applied to know for sure, but if you look at

    https://github.com/boundarydevices/linux-imx6/blob/boundary-imx_3.0.35_4.0.0/drivers/i2c/busses/i2c-imx.c

     

    if (pdata && pdata->bitrate)

         i2c_imx_set_clk(i2c_imx, pdata->bitrate);

    else

         i2c_imx_set_clk(i2c_imx, IMX_I2C_BIT_RATE);

     

    this essentially means that if you don't specify bitrate in platform data in

    https://github.com/boundarydevices/linux-imx6/blob/boundary-imx_3.0.35_4.0.0/arch/arm/mach-mx6/board-mx6_nitrogen6x.c

     

    like so:

     

    static struct imxi2c_platform_data i2c_data = {

         .bitrate = 100000,

    };

     

    then you'll get a sensible default as defined by IMX_I2C_BIT_RATE.

     

    Anyway, glad there was enough to point you in the right direction and you found what you were looking for..  Now that you know where its set you should be able to try changing it to see if it helps with your device.

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

    indeed,

    i didn't see either file #including the other so I didn't bother looking further down in the file ( i don't know how kernel directory tree is structure either, up until now).

     

    thank you!

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

    hello ,

    can you describe pls, how / what is the mechanism  modify it when using module parameter when loading the module.

    thank you

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