New patch for i2c speed


11 posts
by Frank B » Sun Sep 30, 2012 2:16 pm
Hi,
i've done a patch for setting the i2c speed.
It can be set via menuconfig or as module-parameter :

Code: Select all
modprobe i2c_bcm2708 baudrate=150000


Tested, and works ok for me.

@dom (or somebody else): Where can i upload it to get it into the "official" kernel ?

I have not done this before and need a litte help..:-)
Posts: 61
Joined: Fri Sep 14, 2012 8:02 pm
Location: Germany
by dom » Sun Sep 30, 2012 2:22 pm
Hi Frank.

The correct way is to create a github account, clone the raspberrypi/linux tree, then make the mods to your clone tree.
When you are happy with them, select the commit and press "Pull Request".

If I like it, I accept the pull request, and your changes appear in the tree, along with correct attribution of where it came from.

It's quite straightforward, and worth learning how to do it if you want to contribute to open source projects.
Moderator
Moderator
Posts: 3858
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by Frank B » Sun Sep 30, 2012 9:17 pm
Ok, "Pull Request" is done...

Frank.
Posts: 61
Joined: Fri Sep 14, 2012 8:02 pm
Location: Germany
by Frank B » Thu Oct 04, 2012 6:27 pm
Frank B wrote:Ok, "Pull Request" is done...


It's commited :)

Frank.
Posts: 61
Joined: Fri Sep 14, 2012 8:02 pm
Location: Germany
by Frank B » Sat Oct 06, 2012 8:50 am
Thank you, dom :)

It's in the new Kernel 3.2.27+ #238 PREEMPT Fri Oct 5 23:19:10 BST 2012
(rpi-update)

@all who need this:
You can make the change of baudrate permanent with this command:

Code: Select all
sudo bash -c "echo options i2c_bcm2708 baudrate=350000 > /etc/modprobe.d/i2c.conf"


Frank.
Posts: 61
Joined: Fri Sep 14, 2012 8:02 pm
Location: Germany
by sumanharapanahalli » Wed Oct 17, 2012 1:11 pm
Hi Frank,

The command looks simple but I get a error when I execute the same.

Error is "No such file or directory", I have checked the direc"/etc/modprobe.d/"

Can you please let me know how can i solve the same.

I am using the kernel from the pi website [2012-09-18-wheezy-raspbian].
Thanks & Regards
Sumanth
Posts: 20
Joined: Mon Oct 08, 2012 5:14 am
Location: Bangalore, India
by Frank B » Wed Oct 17, 2012 8:03 pm
Hi,
unfortunately, this change is not in the current kernel anymore(?), we have to wait for the next version.

Frank.
Posts: 61
Joined: Fri Sep 14, 2012 8:02 pm
Location: Germany
by rudiratlos » Thu Oct 18, 2012 5:07 pm
Hi,

is it settable from a running program during runtime?
I mean, I want to set it via IOCTL if I want to speak to a 'slower' device.
It's a kind of clock stretching initiated by the program an not from the i2c device.

Thanks,
Posts: 64
Joined: Tue May 01, 2012 8:47 am
by Frank B » Thu Oct 18, 2012 8:24 pm
rudiratlos wrote:Hi,
is it settable from a running program during runtime?


no.
Posts: 61
Joined: Fri Sep 14, 2012 8:02 pm
Location: Germany
by andig2 » Sun Dec 16, 2012 6:11 pm
Found this post and would like to add that you need to unload the module first if you want to change settings (at least in my tests?):

Code: Select all
sudo modprobe -r i2c_bcm2708 && sudo modprobe i2c_bcm2708 baudrate=2000000


Doing so I could get it to operate up to 2MHz with an SSD1306 OLED- not sure this is really realistic?
Posts: 23
Joined: Wed Oct 31, 2012 9:34 pm
by Frank B » Mon Dec 17, 2012 6:36 pm
andig2 wrote:Found this post and would like to add that you need to unload the module first if you want to change settings (at least in my tests?):

Code: Select all
sudo modprobe -r i2c_bcm2708 && sudo modprobe i2c_bcm2708 baudrate=2000000


Doing so I could get it to operate up to 2MHz with an SSD1306 OLED- not sure this is really realistic?


It depends very much on your wiring and if the ssd1306 support this speed. I would just try it.

Frank.
Posts: 61
Joined: Fri Sep 14, 2012 8:02 pm
Location: Germany