I2C Setup
#1
Has anyone setup I2C on Ubuntu yet?
I'm not a Linux expert, so I'm sure I'm missing something simple.

I've installed i2c tools.
When I do i2cdetect -l, it doesn't find anything.

However, looking in /sys/class, I can see i2c-0 and i2c-1.

Do I need to comment i2c out from the blacklist?
Is there something else needed?

Thanks!
#2
(05-02-2016, 08:34 PM)adamw Wrote: I'm not a Linux expert, so I'm sure I'm missing something simple.

Such as no pins defined to be used for I2C: https://github.com/longsleep/build-pine6...pine64.dts
#3
@tkaiser,
In fact, they are there, but named "twi".
https://github.com/longsleep/build-pine6...#L673-L698
In my case, i2cdetect is properly showing the I2C buses.
But I'm using my own rebuilt kernel, so maybe I've activated something, I can't remember.

EDIT: Yes, I think I've simply added CONFIG_I2C_CHARDEV=y

EDIT2 : I've done a "git diff" (I will send a PR to Simon) :

Code:
diff --git a/arch/arm64/configs/sun50iw1p1smp_linux_defconfig b/arch/arm64/configs/sun50iw1p1smp_linux_defconfig
index 3b94a33..c796361 100644
--- a/arch/arm64/configs/sun50iw1p1smp_linux_defconfig
+++ b/arch/arm64/configs/sun50iw1p1smp_linux_defconfig
@@ -355,7 +355,12 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_PPDEV=m
# CONFIG_HW_RANDOM is not set
# CONFIG_SUNXI_DMA_TEST is not set
+CONFIG_I2C=y
CONFIG_I2C_SUNXI=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_MUX=y
CONFIG_SPI=y
CONFIG_SPI_SUNXI=y
# CONFIG_PINCTRL_SUNXI_TEST is not set
#4
(05-03-2016, 07:56 AM)martinayotte Wrote: In fact, they are there, but named "twi". ... (I will send a PR to Simon)

Great! Then it will make it most likely in his next kernel build and everyone can benefit from. And my bad... I think exactly you explained this already to me over at Armbian (twi naming)
#5
PR for the configs is sent !
For the "twi" naming, I don't know if we should bother Simon about that since it is working (it could have been named "simonwires" it would not matter  Tongue  ...)
#6
Merged, will be in the next Kernel release. Thanks Martin!
#7
I assume this is all kernel stuff.
As I'm way too newb to compile the kernel, I also assume I'll need to wait for longsleep's next kernel?
Also, while we're at it, any chance to get SPI and UART support (if not already there) in this next kernel...I'll need all 3.

You guys are awesome, and thanks!
#8
For the UART2/UART3/UART4, it has been done and merged 16 days ago, so, current kernel from longsleep should have it already.
For SPI, it not working yet, although DTS entries are there, the /dev/spidev-* are not showing up.
I didn't get change to debug further yet.
#9
Hi - I recompiled the kernel (thanks longsleep) and i2cdetect does find 2 devices that it can scan but when I attach an i2c device (1602LCD) and try to scan for it, no-go.  


 sudo i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --       

and 

ubuntu@linux:~/logs$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 

I have tested the device with an arduino and it functioned there.  I have the device attached to the PI 2 bus.

Any advice?
#10
Hmmm...maybe check your wiring?
I didn't compile the kernel, just updated to longsleep's latest.
I just hooked up several I2C devices on a custom board to the PI2 bus, and i2cdetect -y 1 worked just fine for me.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Media Player setup clobeca 1 3,431 07-14-2017, 02:21 AM
Last Post: pfeerick

Forum Jump:


Users browsing this thread: 1 Guest(s)