I2C Bus


joachim

Member
Joined
May 22, 2013
Messages
406
Can anyone tell me how to use the I2C Bus ? On other embedded systems there is i2cdetect, i2cset,i2cget but they seem not to work with SZ. Or are they working in Slackware?

I just want to add some hardware to Bus 3 and play with it.

thanks for help
 
You can install them:

"sudo opkg install i2c-tools"

Check the hacker guide, make sure your hardware is using a different channel from the nubs and the TWL power chip.
 
Last edited by a moderator:
that was fast !

thanks a lot; when I try with i2cdetect I get the message "cant use SMBus Quick write command" and the -q -r etc are not recommended. Info is shown with -l. So far that is what I need.

thanks again
 
tried with -r and got 55,66 and 67 so it works well. I hope this didnt kill anything.

very fine
 
tried with -r and got 55,66 and 67 so it works well. I hope this didnt kill anything.
That SMBus warning and the recommendation not to use -r is normal and can be ignored (unless you connect some very strange chip to I2C). I think it relates to some EEPROM on some x86 motherboards that *could* be overwritten and modify BIOS settings.Have fun with I2C :)
 
Last edited by a moderator:
as you can see i2c is working so far from shell (8bit I /O)

how can I use it with python ?

IMG_3230.JPG

IMG_3231.JPG
 
when I try to install python-smbus or py-smbus I get an error " cannot install"

is it possible to use a system call ?
 
Probably. I wrote some C code to do it once but unfortunately I don't know enough about Python to suggest how it could be done.

It has ioctl calls so I guess that's the way. Here's a simple example of C code, also Python code using SMBus but that's not useful if you can't install it.
 
In case you want to use it under Slackware, there's a slackbuild for it, accessible from the sbopkg tool. Check the wiki.

I've added it to my big compilation list.
 
I've installed i2ctools in Slackware but didn't find python-smbus. When starting the program I get the error  "no module named smbus ". So how can I get the SMBus module ?

edit : just found the module for Raspi and after installing smbus is working - tataa !

thanks for the help !
 
Last edited by a moderator:
Just curious, how did you install smbus ?
 
Last edited by a moderator:
After searching the internet I found a description for Raspi.

Here is the file > dl.lm-sensors.org/i2c-tools/releases/i2c-tools-3.1.0.tar.bz2

download and tar -xjf i2c-tools-3.1.0.tar.bz2

cd i2c-tools-3.1.0.tar.bz2

edit file setup.py and after url= ..lm-sensors.. insert:

include_dirs=["../include, "/usr/include"],

finally: python setup.py install

and all was working in Slackware (must try with SZ)

this is opensource and inside are more modules like eeprom

very nice

maybe this could be installed in next release by default
 
Last edited by a moderator:
You have done this installation automatically with the included Slackware package tools ;^).

Yup, i included it for next release.
 
I tried with SZ but got the error "..-gcc" file not found. How can I install it in SZ?
 
And now for something completely different :

here a LCD with I2C direct from Pandora programmed in Python :

OS Slackware

IMG_3290.JPG
 
Cool !

Upload as many pics as you can ^^. Do you have some with the OP mobo connected ?
 
First I built a level converter because the LCD is 5V but after thinking I removed it because SDA and SCL are open collector and it worked without. Here the whole thing.

IMG_3291.JPG

IMG_3292.JPG
 
Back
Top