icsoft Posted March 6, 2017 Share Posted March 6, 2017 Hi, I am using mainline 4.10.0-sun8i and to enable I2C I added: overlays=sun8i-h3-i2c0 to armbianEnv.txt and rebooted, then I checked: cat /proc/device-tree/soc/i2c\@01c2b400/status and still found that it was disabled, I feel that I may be missing a step, like having to compile armbianEnv.txt into the config script, is that so? Just to make sure it wasn't working, i changes the pins to I2C using: sunxi-pio -m PA11'<2>' sunxi-pio -m PA12'<2>' BTW. sunxi-pio has very few code comments, did not specify the field order and finding which bits to flip in the H3 data sheet was annoying, did you want me to fix and submit a pull request adding these things? Or is this tool only for devs anyway? Then I attached a logic analyser and an I2C device to the bus and found no clock or signal and i2cdetect found no devices. Could you please let me know what I am not doing with the overlay config that enables /soc/i2c@01c2ac00 or do i just have to DTS the sun8i-h3-orangepi-pc.dtb and change the status to "okay" manually then recompile? Thanks for your assistance, Matt. Link to comment Share on other sites More sharing options...
martinayotte Posted March 6, 2017 Share Posted March 6, 2017 you wish to have i2c0 with /soc/i2c@01c2ac00 enabled, but you confusingly doing a "cat /proc/device-tree/soc/i2c\@01c2b400/status" which is not the same port. Are you sure that none of the port shows up ? Did you check "dmesg" output ? Which board do you have ? 1 Link to comment Share on other sites More sharing options...
icsoft Posted March 6, 2017 Author Share Posted March 6, 2017 Hi Martinayotte, Thanks very much for replying, good pick up, sorry about that, I copy/pasted the wrong bit of text, but i did check /proc/device-tree/soc/i2c\@01c2ac00/status . The board I am using is the Orange Pi PC, I didn't mention it as i specified the sun8i-h3-orangepi-pc.dtb, but i guess that can be used for another H3 board, I really must stop making silly assumptions. I'll add a bit more info to make it clearer what is happening: i2cdetect -l returns: i2c-0 i2c mv64xxx_i2c adapter I2C adapter and even though I have two I2C devices powered on and plugged in, i2cdetect -y 0 returns: 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- dmesg: matt@orangepipc:~$ dmesg | grep i2c [ 3.682470] i2c /dev entries driver Thanks again for your valuable assistance. Link to comment Share on other sites More sharing options...
martinayotte Posted March 7, 2017 Share Posted March 7, 2017 So, your I2C-0 is showing a device on 0x65 (with UU meaning that a kernel driver is using it), if other devices on the same bus are not shown, it is probably that you have a wiring issue. Link to comment Share on other sites More sharing options...
zador.blood.stained Posted March 7, 2017 Share Posted March 7, 2017 Device at 0x65 is the voltage regulator on the OPi PC, so /dev/i2c-0 in this case is R_I2C Link to comment Share on other sites More sharing options...
icsoft Posted March 8, 2017 Author Share Posted March 8, 2017 Hi Guys, The regulator at 0x65 is on bus i2c@01f02400, this bus is not connected to the gpio header pins and is enabled by default (i did not need to enable it) as the cpu needs it. The overlay sun8i-h3-i2c0.dtbo enables the /soc/i2c@01c2ac00 bus, this is the bus that connects to pins PA11 and PA12 on the header: root@orangepipc:/# dtc -I dtb -O dts /boot/dtb/overlay/sun8i-h3-i2c0.dtbo /dts-v1/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target-path = "/aliases"; __overlay__ { i2c0 = "/soc/i2c@01c2ac00"; }; }; fragment@1 { target = <0xffffffff>; __overlay__ { status = "okay"; }; }; __fixups__ { i2c0 = "/fragment@1:target:0"; }; }; I'm pretty sure it isn't a wiring issue as i am checking the clock and data lines directly with a logic analyser, and i'm not getting a signal on either line, I would also think that if the /soc/i2c@01c2ac00 bus was working it would not have a status of "disabled". Any other ideas to get this overlay to work or should I just go ahead and and adjust the sun8i-h3-orangepi-pc.dtb and change the status to "okay" manually then recompile? Link to comment Share on other sites More sharing options...
martinayotte Posted March 8, 2017 Share Posted March 8, 2017 Did you simply try to look at i2c-1 instead ? (because if r_i2c, the one with regulator 0x65, is loaded first, it is actually the first one which get named i2c-0) Link to comment Share on other sites More sharing options...
icsoft Posted March 10, 2017 Author Share Posted March 10, 2017 Yeah, I have found that the only active I2c bus is the one reported by i2cdetect -l above, and that happens to be the one with the regulator. Thanks for all you assistance and suggestions. Link to comment Share on other sites More sharing options...
martinayotte Posted March 11, 2017 Share Posted March 11, 2017 You can try to edit the main DT instead and place "okay" on all I2C. Link to comment Share on other sites More sharing options...
icsoft Posted April 13, 2017 Author Share Posted April 13, 2017 Just to finalise this thread, I got the other I2c bus working by editing the sun8i-h3-orangepi-pc.dtb (converted to dts first then recompiled) directly, as it looks like the overlay is wrong that ships with the mainline stable distro. It seems that @zador.blood.stained has fixed it already in the overlays repo: https://github.com/zador-blood-stained/sunxi-DT-overlays-armbian (see sun8i-h3-i2c0.dts for more info) Link to comment Share on other sites More sharing options...
Recommended Posts