Jump to content

H3 - I2C fix + make BMP280 work


Recommended Posts

Posted (edited)

The following issue occurs on kernel 4.13.9. I haven't tested any other version, but martinayotte commented it wasn't happening on 4.11

 

Helo, If you installed a brand new image you'll notice that there's an I2C device by default which shows inexistent devices, like:

root@orangepione:~# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: 30 31 32 33 34 35 36 37 -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

This can be fixed adding the i2c0 overlay at boot. Make sure this 2 lines are written in /boot/armbianEnv.txt:

overlay_prefix=sun8i-h3
overlays=i2c0

After rebooting, you'll find that i2c-0 bus works properly, while there's now a new i2c-1 which has the same problem mentioned above.

It also fixed some problems I was having with a multitouch screen, somehow, so have it in mind if you're suffering this kind of issue.

 

For anyone who has troubles with the BMP280 sensor:

Enable modules by modprobe (or /etc/modules):

  • bmp280-i2c
  • bmp280

Create the device by writing:

echo "bmp280 0x76" > /sys/bus/i2c/i2c-0/new_device

Now the sensor can be accessed at:

/sys/bus/i2c/devices/0-0076/iio:device1

 

Edited by jistycs
Show in which kernel version this is happening
Posted

That is a strange behaviour since without having set the overlay, it should have produced the following error :

root@orangepione:~# i2cdetect -y 0
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory

What kernel do you use ? What "uname -a" is reporting ?

 

EDIT : Oh ! You're right ! My OPiOne was still on 4.11.x, I'm now seeing the issue with newer 4.13.9 ... I guess a bug has been introduced showing an /dev/i2c-0 while no overlay loaded. I guest we need to live with that ...

Posted
2 hours ago, martinayotte said:

That is a strange behaviour since without having set the overlay, it should have produced the following error :


root@orangepione:~# i2cdetect -y 0
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory

What kernel do you use ? What "uname -a" is reporting ?

 

EDIT : Oh ! You're right ! My OPiOne was still on 4.11.x, I'm now seeing the issue with newer 4.13.9 ... I guess a bug has been introduced showing an /dev/i2c-0 while no overlay loaded. I guest we need to live with that ...

It was weird for me as well, that's why I firstly thought it was a bigger issue. And I just ended up with this solution with "let's try to see what happens if..."

Posted

This extra I2C bus is the HDMI DDC bus. Example on OPI+2E without overlays - i2c0 is the r_i2c and i2c1 is HDMI i2c:

root@orangepiplus2e:~# ls -la /sys/bus/i2c/devices/*
lrwxrwxrwx 1 root root 0 Jan  1  1970 /sys/bus/i2c/devices/0-0065 -> ../../../devices/platform/soc/1f02400.i2c/i2c-0/0-0065
lrwxrwxrwx 1 root root 0 Oct 28 10:38 /sys/bus/i2c/devices/i2c-0 -> ../../../devices/platform/soc/1f02400.i2c/i2c-0
lrwxrwxrwx 1 root root 0 Oct 28 10:37 /sys/bus/i2c/devices/i2c-1 -> ../../../devices/platform/soc/1ee0000.hdmi/i2c-1
root@orangepiplus2e:~#

 

Quote

The documentation for drm_do_get_edid in drivers/gpu/drm/drm_edid.c states: "As in the general case the DDC bus is accessible by the kernel at the I2C level, drivers must make all reasonable efforts to expose it as an I2C adapter and use drm_get_edid() instead of abusing this function."

 

Posted

My apologies if this is considered as hijacking the thread but I've been having issues with the I2C bus on a nanopi neo.

 

I've tried enabling the dtb overlay in armbianEnv.txt as per the Armbian wiki, I've also tried editing the main dtb file to change i2c0 from disabled to okay (id haven't tried both at the same time).

I have i2c-dev in /etc/modules

None of this is making any difference I can't seem to access the devices on the bus at all. I have pullups fitted to the PCB and have verified that the devices are connected to the correct pins (3&5 of the GPIO connector). I can't see anything on SDA or SCL with the scope.

 

root@nanopineo:~# dmesg | grep i2c
[    4.156128] i2c /dev entries driver
[   59.608197] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0
[   71.128188] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0

 

root@nanopineo:~# echo 5 >> /dev/i2c-0 
-bash: echo: write error: Connection timed out
root@nanopineo:~# uname -a
Linux nanopineo 4.11.12-sun8i #1 SMP Sun Oct 29 23:41:27 GMT 2017 armv7l armv7l armv7l GNU/Linux

I've tried both the latest nightly and building Armbian from source, both react in the same way.

root@nanopineo:~# i2cdetect -l
i2c-0    i2c           mv64xxx_i2c adapter                 I2C adapter

i2cdetect -y 0 just shows -- for every address

 

I have a feeling that I am missing something, I'm also not convinced that mv64xxx is the right adapter, I'm not sure why it just doesn't seem right.

 

Posted

Hi guys, 

Thanks for the replies.

Igor: I've just downloaded and burnt the image that you linked to and no luck. Here is the uname output just to confirm...

Linux nanopineo 4.13.10-sunxi #65 SMP Tue Oct 31 00:09:00 CET 2017 armv7l armv7l armv7l GNU/Linux

Martin: I've added pullups to make up for the lack of pullups on the Neo, one each for SCL and SDA. Looking at them with both a scope and a meter show them steady at 3V3 when running i2cdetect

Posted

Just to follow up...

Starting with the image Igor linked to, that was installed and booted. 

I then modified the following (via SSH if it matters)

  • armbianEnv.txt to add the overlay
  • /etc/modules to add i2c-dev
  • /etc/network/interfaces (to force a particular hw address so that my router pins the board to the same IP address every boot)
  • installed i2c-tools via apt.

 

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

Important Information

Terms of Use - Privacy Policy - Guidelines