Jump to content

Problem with using i2c on CT3


pancio

Recommended Posts

Hello,

 

I've problem use i2c features on newest CTDebian3.8 Jessie os. Exactly i using CT3 with DVK570 extended board witch deploy any signals from CN8 and CN9 slots. I can't see any i2c devices though that i see two buses after used i2cdetect -l:

root@ctdev:~# i2cdetect -l
i2c-0	i2c       	sunxi-i2c.0                     	I2C adapter
i2c-1	i2c       	sunxi-hdmi-i2c                  	I2C adapter

root@ctdev:~# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
root@ctdev:~# 
root@ctdev:~# 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: -- -- -- -- -- -- -- --                         
root@ctdev:~# 

I was tested and check buses for a few devices like BMP180, MPU-6050, TTP229-LSF (3V3 power tolerant devices)  but i don't see any address after i2cdetect. I'm sure that testing peripherals are ok cause of i was using them on my Raspberry. I need change my dev platform to CT cause of more performance and  SATA port... For additional information on DVK570 board SCK was connected to PB18 and SCL was coccected to PB19. Why i don't see i2c-dev modules after load it?

Link to comment
Share on other sites

Which kernel are you using? I am not sure if it's working well on newer (4.x) but it must work well within 3.4.107 - I am using some I2C modules by myself.

 

Jessie is also not advisable. For less troubles also rather use Wheezy or Ubuntu trusty.

Link to comment
Share on other sites

Thanks for your quick reply... i using your last brand of Debian Jessie with  3.4.107-cubietruck kernel. I've never supposed that kind of Debian is importance (i thought that kernel is important) so i used Jessie for better performance and newest software...  For my development environment it's doesn't matter so i may downgrade it to Wheezy. I've favor to you, if you find a couple of minutes - could you please check your CT with Jessie and his report about i2c?

Link to comment
Share on other sites

Hi again,

 

Yesterday and today I compiled two version of CTDebian from your git, 1. Wheeze (3.4.107) and 2. Jessie (the same kernel). Both compilation was finished successfully... but I2c still not working. I decided compile kernel again configuring I2c section manually... for test i used modules for better control what kind of module are using. After boot i loaded i2c-dev and i2c-sunxi modules but I still see the same result ... nothing! For test i prepared new uSD card with  ct-dvk distro from Waveshare and again checked some devices... success:

root@chird:~# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
root@chird:~# 
root@chird:~# uname -a
Linux chird 3.4.79 #26 SMP PREEMPT Wed Apr 2 03:30:40 PDT 2014 armv7l GNU/Linux
root@chird:~# 

so, i compared i2c config section for your brand and ct-dvk but result is the same... 

 

What do you think, what may be wrong?

 

I'm very satisfied using your  brand of Debian, I've 8 production servers under CTdebian, so must use it on my develop platform too :-)

Link to comment
Share on other sites

Thanks. If this is so than I need to take a closer look. How are your script.bin settings?

 

Note that this is just an example, not proper settings.

[twi0_para]
twi0_used = 1
twi0_scl = port:PB00<2><default><default><default>
twi0_sda = port:PB01<2><default><default><default>

[twi1_para]
twi1_used = 1
twi1_scl = port:PB18<2><default><default><default>
twi1_sda = port:PB19<2><default><default><default>

[twi2_para]
twi2_used = 1
twi2_scl = port:PB20<2><default><default><default>
twi2_sda = port:PB21<2><default><default><default>

[twi3_para]
twi3_used = 1
twi3_scl = port:PI00<3><default><default><default>
twi3_sda = port:PI01<3><default><default><default>

Do you have things enabled and are you checking correct port?

Link to comment
Share on other sites

Do you asking me about my compilation of your brand or ct-dvk brand? I checked both again:

 

Your config from /lib/config/cubietruck.fex:



[twi_para]
twi_port            = 0
twi_scl             = port:PB0<2><default><default><default>
twi_sda             = port:PB1<2><default><default><default>

;-------------------------------------------------------------------------------
;i2c configuration
;-------------------------------------------------------------------------------
[twi0_para]
twi0_used           = 1
twi0_scl            = port:PB0<2><default><default><default>
twi0_sda            = port:PB1<2><default><default><default>

[twi1_para]
twi1_used = 0
twi1_scl = port:PB18<2><default><default><default>
twi1_sda = port:PB19<2><default><default><default>

[twi2_para]
twi2_used = 0
twi2_scl = port:PB20<2><default><default><default>
twi2_sda = port:PB21<2><default><default><default>

config from ct-dkv distro /boot/script.fex:


[twi_para]
twi_port            = 0
twi_scl             = port:PB0<2><default><default><default>
twi_sda             = port:PB1<2><default><default><default>

;-------------------------------------------------------------------------------
;i2c configuration
;-------------------------------------------------------------------------------
[twi0_para]
twi0_used           = 1
twi0_scl            = port:PB0<2><default><default><default>
twi0_sda            = port:PB1<2><default><default><default>

[twi1_para]
twi1_used = 1
twi1_scl = port:PB18<2><default><default><default>
twi1_sda = port:PB19<2><default><default><default>

[twi2_para]
twi2_used = 1
twi2_scl = port:PB20<2><default><default><default>
twi2_sda = port:PB21<2><default><default><default>

Now I see that into your config we have disabled twi1_used and twi2_used parameters ...

 

... so maybe enable it is necessary to proper work :-) 

I'll make new compilation and I'll try confirm my idea. (or at first i change script.bin/fex into exist distro)

 

BTW, I've permanently connected 1 thing (i2c sd1306 display) for test:

 

post-50-0-82442100-1433591720_thumb.jpg

Link to comment
Share on other sites

Hi again,

 

Success, it's work!

root@ctdev:/boot# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
root@ctdev:/boot# uname -a
Linux ctdev 3.4.107-cubietruck #8 SMP PREEMPT Thu May 14 18:53:36 CEST 2015 armv7l GNU/Linux
root@ctdev:/boot# 

You have disabled i2c(twi) into your config by default (except twi0). Is any reason for this or you don't realize about this fact by accident?

 

Now i may use any devices like i do this on my Raspberry... Thanks Igor for your best work.

 

post-50-0-99345000-1433602701_thumb.jpg

Link to comment
Share on other sites

Hi

check it on Orange Pluse 2e with library https://github.com/Schrottratte/sh1106. Still dont have display but Analyzer Salea correct show command Setup write to [x] + NAK

But cant run it with NanoPi Neo for any twi channel

I try tune it in fex file but not sucessful

 

All time see 

$ dmesg | grep i2c
[    2.254642] i2c /dev entries driver
[    2.265067] twi_start()434 - [i2c0] START can't sendout!
[    2.271245] twi_start()434 - [i2c0] START can't sendout!
[    2.293422] twi_start()434 - [i2c0] START can't sendout!
..
 
core:
Linux nanopineo 3.4.112-sun8i #14 SMP PREEMPT Wed Sep 14 20:29:31 CEST 2016 armv7l armv7l armv7l GNU/Linux
 
Still dont update it. Because fixed build of driver module 8192cu.ko get problem. Its not connected with question
 
Link to comment
Share on other sites

Trying Core

Linux nanopineo 4.9.0-sun8i #4 SMP Mon Oct 31 04:12:20 CST 2016 armv7l armv7l armv7l GNU/Linux 
 
[twi0]
twi_used = 1
twi_scl = port:PA11<2><default><default><default>
twi_sda = port:PA12<2><default><default><default>
 
[twi1]
twi_used = 1
twi_scl = port:PA18<3><default><default><default>
twi_sda = port:PA19<3><default><default><default>
 
[twi2]
twi_used = 1
twi_scl = port:PE12<3><default><default><default>
twi_sda = port:PE13<3><default><default><default>
 
 
No one i2c
 
$ls /dev  | grep i2c 
 
$sudo i2cdetect -y 1
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
 
0,1,2 Nothing found
 
 
 
 
 
Link to comment
Share on other sites

Are you able to use older kernel for test?

 

I've Orange Pi Plus 2, and when I will found a couple of minutes I may check it for you...

 

Regards,

I have Orange Pi Plus 2e, Its working ok but not work on nanopineo. I want use nanopineo board with new vanilla kernel if it possible. Now I try switch on i2c via device tree.

I found section in /boot/dtb/sun8i-h3-nanopi-neo.dtb. switch status from disable to okay. Still don`t sucessfull. Maybe need change compatible = "allwinner,sun8i-h3"; ?

 

                i2c@01c2ac00 {

                        compatible = "allwinner,sun6i-a31-i2c";
                        reg = <0x1c2ac00 0x400>;
                        interrupts = <0x0 0x6 0x4>;
                        clocks = <0x5 0x3b>;
                        resets = <0x5 0x2e>;
                        pinctrl-names = "default";
                        pinctrl-0 = <0xd>;
                        status = "okay";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        linux,phandle = <0x31>;
                        phandle = <0x31>;
                };
 
 
Link to comment
Share on other sites

Finally I am found out how it is do

 

I made changes in 

linux-sun8i-mainline/sun8i-emac-wip-v5/arch/arm/boot/dts/sun8i-h3.dtsi

 

status = "okay";

 

Also should be FORCE_CHECKOUT="no" because checkout reset all changes

 

After this I finally get long time waiting strings

 

# ls /dev/ | grep i2c
i2c-0
i2c-1
 
 
 
Sometime I building chromium but it is " it is slightly more complicated:)
 
Probably its possible do over lib/patch/kernel/
Will try. So few documentation. I dont hard in script
 
 
[update]
Move next:
 
i2c i2c-1: mv64xxx: I2C bus locked, block: 1, time_left: 0
 
$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          [ 2238.449569] i2c i2c-1: mv64xxx: I2C bus locked, block: 1, time_left: 0
-- [ 2240.529620] i2c i2c-1: mv64xxx: I2C bus locked, block: 1, time_left: 0
-- [ 2242.609667] i2c i2c-1: mv64xxx: I2C bus locked, block: 1, time_left: 0
 
 
The same situation on i2c-0
 
Ok. I am on empty line (i2c line not connected any device). Try do pull pin to SUN4I_PINCTRL_PULL_UP according advice:
 
 
                        i2c0 {
                                allwinner,pins = "PA11", "PA12";
                                allwinner,function = "i2c0";
                                allwinner,drive = <0x0>;
                                allwinner,pull = <0x1>;
                                linux,phandle = <0xd>;
                                phandle = <0xd>;
                        }
 
$ sudo i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          [ 2544.633505] i2c i2c-0: mv64xxx_i2c_fsm: Ctlr Error -- state: 0x4, status: 0x0, addr: 0x3, flags: 0x0
-- [ 2544.672563] i2c i2c-0: mv64xxx_i2c_fsm: Ctlr Error -- state: 0x4, status: 0x0, addr: 0x4, flags: 0x0
-- [ 2544.712434] i2c i2c-0: mv64xxx_i2c_fsm: Ctlr Error -- state: 0x4, status: 0x0, addr: 0x5, flags: 0x0
 
Something doing wrong? Orange pi 2e have different action on empty line
 
$ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
.....
 
Linux nanopineo 4.9.0-sun8i #10 SMP Fri Nov 4 19:10:34 ICT 2016 armv7l armv7l armv7l GNU/Linux
 
 
Really curios board NanoPi Neo
 
[update]
 
$ i2cdetect -l
i2c-1   unknown         mv64xxx_i2c adapter                     N/A
i2c-0   unknown         mv64xxx_i2c adapter                     N/A
 
Maybe I should look in modules?
 
Thanks
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines