I2C commands not working...
-
I have an onion 2S+, running with root access, which will not run the following I2C command:
i2cset -y 2 84 21 16I get a response of:
Could not open file/dev/i2c-1' or
/dev/i2c/1': No such file or directoryI think the problem is that there isn't a bus 2 in some config file somewhere... How do we go through the process of adding bus 2? What is a bus?
-
@Nathan-Guyette I think the title of your post is fairly misleading.
Onion Omega2 Documentation Communicating with I2C DevicesAll I2C interactions on the Omega2 are done using the virtual device file /dev/i2c-
0
:
i2cdetect -y
0
i2cget -y
0
<DEVICE ADDRESS> <REGISTER>
i2cset -y
0
<DEVICE ADDRESS> <REGISTER> <VALUE>
Good luck!
-
Is there any way that could be overwritten from 0 to 2? I'm still not sure what the 0 indicates here.
-
@Nathan-Guyette
0
is the "name" of the default (dedicated) I2C bus of Omega2 - it's compiled into the kernel / firmware.# Omega2+ firmware v0.3.2 b223 root@Omega-5BE1:/# ls -l /dev | grep -i i2c crw------- 1 root root 89, 0 Jan 1 1970 i2c-0 root@Omega-5BE1:/# i2cdetect -l i2c-0 i2c 10000900.i2c I2C adapter
Why don't you use
0
(i2c-0 ie. i2c bus 0) instead of that2
(i2c-2 ie. i2c bus 2) in your commands?
-
How can you compile the kernel with a different number here?
-
@Nathan-Guyette Sorry, I don't know - I'm a simple, average Omega2 user.
-
@Nathan-Guyette Please use the Search function of this forum.
For example here you are a thread (although it's a little bit old):
I2C Detect Slave Method?
-
If you have a build systen installed You can tweak the kernel setup by using "make kernel_menuconfig"
Look under Device Drivers -> I2C Support, there is a several debugging options you can set in order to assist with debugging i2c.