Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Enable i2c ports in bpi m2 berry-ultra.

Featured Replies

2 hours ago, martinayotte said:

Since H3 and R40 are similar, I presume the overlays already provided in any Armbian images under /boot/dtb/overlay should already work.

 

 ____  ____  _   __  __ ____    ____
| __ )|  _ \(_) |  \/  |___ \  | __ )  ___ _ __ _ __ _   _
|  _ \| |_) | | | |\/| | __) | |  _ \ / _ \ '__| '__| | | |
| |_) |  __/| | | |  | |/ __/  | |_) |  __/ |  | |  | |_| |
|____/|_|   |_| |_|  |_|_____| |____/ \___|_|  |_|   \__, |
                                                     |___/

Welcome to ARMBIAN 5.81 user-built Debian GNU/Linux 9 (stretch) 5.0.7-sunxi
package bsp-kernel[5.81] u-boot[5.81] dtb[5.81] firmware[5.81] config[5.81]

root@bpi-m2-berry(192.168.6.20):/# more /boot/armbianEnv.txt
verbosity=1
logo=disabled
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootfstype=ext4
overlays=analog-codec i2c0

 

  • Author
59 minutes ago, martinayotte said:

Since H3 and R40 are similar, I presume the overlays already provided in any Armbian images under /boot/dtb/overlay should already work. 

But not work. And how can they work when in dts and dtsi nowhere describes the pins of the ports.

 

35 minutes ago, martinayotte said:

At least for I2C-0, they are there, but for the other ports, you can prepare a patch and submit a PR to Armbian ...

I2C-0 doenst work for me on the M2 Berry (like - with the same commands - on my NanoPi Neo Core2)

But I also cant compile the V40-I2C-0 :(
 

root@bpi-m2-berry(192.168.6.20):/home/guido# dtc -I dts -O dtb v40-bananapi-m2-berry-i2c-0.dts -o v40-bananapi-m2-berry-i2c-0.dtbo
Error: v40-bananapi-m2-berry-i2c-0.dts:2.2-8 syntax error
FATAL ERROR: Unable to parse input tree

I did wget the raw version od the dts and also did a clipboard-copy - but the has the same error.

 

When I activate i2C-0 from normal armbian-config I do get
 

root@bpi-m2-berry(192.168.6.20):/home/guido# 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: -- -- -- -- -- -- -- --
root@bpi-m2-berry(192.168.6.20):/home/guido# i2cdetect -y 1
     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: -- -- -- -- -- -- -- --

but my I2C clock should be at 68 on I2C-0 like on my NanoPi Neo Core2

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
modprobe rtc-ds1307

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: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

armbian:
https://raw.githubusercontent.com/armbian/sunxi-DT-overlays/master/sun8i-h3/sun8i-h3-i2c0.dts
V40:
https://raw.githubusercontent.com/hbars/BPI-M2-Ultra-Berry-i2c-enable/master/v40-bananapi-m2-berry-i2c-0.dts

 

V40_DTS_against_armbian_DTS.jpg

  • Author
On 4/20/2019 at 9:34 PM, martinayotte said:

At least for I2C-0, where the PMIC is attached, they are there, but for the other ports, you can prepare a patch and submit a PR to Armbian ...

So they already are.

https://github.com/hbars/BPI-M2-Ultra-Berry-i2c-enable/blob/master/v40-bananapi-m2-berry-i2c-1.dts

https://github.com/hbars/BPI-M2-Ultra-Berry-i2c-enable/blob/master/v40-bananapi-m2-berry-i2c-2.dts

Just gonna leave this here, because-as how to promote the patch does not know... And about PMIC pins I saw.

Strange why was not describe the rest.

Get it working with a newer version

 

$ wget http://httpredir.debian.org/debian//pool/main/d/device-tree-compiler/device-tree-compiler_1.4.7-3_armhf.deb

$ dpkg --install device-tree-compiler_1.4.7-3_armhf.deb

On 4/24/2019 at 10:04 PM, hbars said:

So they already are.

https://github.com/hbars/BPI-M2-Ultra-Berry-i2c-enable/blob/master/v40-bananapi-m2-berry-i2c-1.dts

https://github.com/hbars/BPI-M2-Ultra-Berry-i2c-enable/blob/master/v40-bananapi-m2-berry-i2c-2.dts

Just gonna leave this here, because-as how to promote the patch does not know... And about PMIC pins I saw.

Strange why was not describe the rest.

 

Howdy,

I pick-up this old thread since I've been experimenting with i2c on m2u berry.

The above patches did not work with 5.4.14, but with my own customized dts I was able to activate /dev/i2c-2 on 'buster'

Linux bananaberry 5.4.14-sunxi #rc1 SMP Sat Jan 25 15:19:01 CET 2020 armv7l GNU/Linux
Spoiler

/dts-v1/;
/plugin/;

/ {
        compatible = "allwinner,sun8i-h3";

        fragment@0 {
                target-path = "/aliases";
                __overlay__ {
                        i2c2 = "/soc/i2c@01c2b400";
                };
        };

        fragment@1 {
                target = <&pio>;
                __overlay__ {
                        i2c2_pins_a: i2c2@0 {
                                pins = "PB20", "PB21";
                                function = "i2c2";
                        };
                };
        };

        fragment@2 {
                target = <&i2c2>;
                __overlay__ {
                        pinctrl-names = "default";
                        pinctrl-0 = <&i2c2_pins_a>;
                        status = "okay";
                };
        };
};

 

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

I can retrieve data from all i2c devices attached, however, enabling other overlays, such as spi-spidev in /boot/armbianEnv.txt with

 

overlay_prefix=sun8i-h3
overlays=spi-spidev
param_spidev_spi_bus=1
param_spidev_max_freq=100000000 

resulted in the loss of /dev/i2c-2 and no spidev at all. I tried different combinations of stock spi-spidev and i2c0, i2c1 ...

found in /boot/dtb/overlay. Furthermore, none of the uart overlays seem to work either.

 

At least I would like to enable i2c2, spidev and uart at the same time, but I couldn't find the desired information within
the existing threads.

 

Thanks for your fast reply. I tried

param_spidev_spi_bus=0

as well, but also had no success with it.

 

7 minutes ago, luetzel said:

param_spidev_spi_bus=1

This still SPI1, you should have specified for SPI0 :

param_spidev_spi_bus=0

 

EDIT : Oh ! I've just saw a difference between M2-Berry UART2 compared to other board using H3 instead of V40. The UART2 is defaulted to PI18/PI19 instead of PA0/PA1. So, you will have to tweak DT here again ...

Yes, you're right. Anyway, all combinations of i2c, spidev and uart failed and I have no clue how to fix it.

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.