I2C on Espressobin V7

I'm having a hard time getting I2C to work on the Espressobin V7 board.
I installed the following packages:

kmod-i2c-gpio kmod-i2c-gpio-custom kmod-i2c-core kmod-i2c-algo-bit
opkg install python-smbus

After booting, the only I2C entry I see is:
[ 1.768270] i2c /dev entries driver


[3.198933] i2c /dev entries driver
i2cdetect -y 0
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory

I've connected the I2C Device on Pins 19 and 20:

I don't see any I2C entry in /dev

root@OpenWrt:/# ls /dev
bus                 mmcblk0             ttyS0
console             mmcblk0p1           ttyS1
cpu_dma_latency     mmcblk0p2           ttyS10
full                mtd0                ttyS11
gpiochip0           mtd0ro              ttyS12
gpiochip1           mtdblock0           ttyS13
hwrng               network_latency     ttyS14
kmsg                network_throughput  ttyS15
log                 null                ttyS2
loop-control        port                ttyS3
loop0               ppp                 ttyS4
loop1               ptmx                ttyS5
loop2               pts                 ttyS6
loop3               random              ttyS7
loop4               sda                 ttyS8
loop5               sda1                ttyS9
loop6               shm                 ubi_ctrl
loop7               tty                 urandom
memory_bandwidth    ttyMV0              zero
opkg update; opkg install dtc
dtc -I fs -O dts /proc/device-tree | grep -C5 i2c
1 Like

Thank you again.
Here's the output I got. What info do I put in i2cdetect?

                                        #gpio-cells = <0x02>;
                                        linux,phandle = <0x0c>;
                                        gpio-ranges = <0x05 0x00 0x00 0x24>;

                                i2c2-pins {
                                        function = "i2c";
                                        groups = "i2c2";

                                i2c1-pins {
                                        function = "i2c";
                                        groups = "i2c1";

                                uart2-pins {
                                        function = "uart";
                                        groups = "uart2";
                                        speed = <0x3e8>;

                        i2c@11080 {
                                #address-cells = <0x01>;
                                interrupts = <0x00 0x02 0x04>;
                                clocks = <0x02 0x09>;
                                #size-cells = <0x00>;
                                compatible = "marvell,armada-3700-i2c";
                                status = "disabled";
                                reg = <0x11080 0x24>;

                        interrupt-controller@1d00000 {

                        i2c@11000 {
                                #address-cells = <0x01>;
                                interrupts = <0x00 0x01 0x04>;
                                clocks = <0x02 0x0a>;
                                #size-cells = <0x00>;
                                compatible = "marvell,armada-3700-i2c";
                                status = "disabled";
                                reg = <0x11000 0x24>;

                        nb-periph-clk@13000 {
1 Like

it's disabled

1 Like

I see. Where is this enabled?

It’s is disabled in the DTB file.
You have to modify the DTI/DTS (source) and replace « disabled » by « okay » then compile a new DTB file and boot with it...

1 Like

Thank you. Will these be the correct steps to do that?

  1. Convert existing dtb file (still have to find where that is) to dts
  2. Edit the dts file
  3. Compile the edited file
  4. Reboot

Yes, it may be a short and fast solution !

The « best » one will be to use the full source, find in which file is the i2c and enabled it (you can then get a patch if needed)... and make a compile of openwrt, but use only the DTB...

The DTB is the file specifying the espressobin hardware components...
It’s is localized in your /boot, with the Image of the kernel and the Bootscript (if used)

I've never built OpenWRT from scratch. Can I take the existing image found on the device page, and rebuild it? What would be the most straightforward path to just enabling the I2C?
The steps I'm finding are for a complete build, which I would want to avoid if there's an easier way instead of building the whole thing from scratch.
Thank you in advance.

dtc -I fs -O dts /proc/device-tree > i2c.dts
#editfile ( status = "okay"; )
dtc -I dts -O dtb -o /boot/i2c.dtb i2c.dts
#uboot> setenv fdt_name i2c.dtb

Thank you. I truly appreciate the guidance and detailed instructions.

This might be a super dumb question, but I now have the i2c.dtb in OpenWRT root. I rebooted, interrupted autoboot to get uboot prompt, and set uboot setenv to i2c.dtb. That didn't work because the SD card partition doesn't have the i2c.dtb file, but the original dtb file > armada-3720-espressobin-v7.dtb What am I doing wrong?

U-Boot 2017.03-armada-17.10.2-g255b9cc9c1

Hit any key to stop autoboot:  0
Marvell>> setenv fdt_name i2c.dtb
Marvell>> saveenv
Saving Environment to SPI Flash...
SF: Detected mx25u3235f with page size 256 Bytes, erase size 64 KiB, total 4 MiB
Erasing SPI flash...Writing to SPI flash...done
Marvell>> reset
resetting ...

U-Boot 2017.03-armada-17.10.2-g255b9cc9c1

** File not found i2c.dtb **
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree

Marvell>> ext4ls mmc 0:1
<DIR>       4096 .
<DIR>       4096 ..
<DIR>       4096 lost+found
         7589896 Image
            8263 armada-3720-espressobin-v7.dtb
             425 boot.scr

maybe boot wasn't mounted when you created it?

copy it to mmcblkXp1

mount /dev/mmcblk0p1 /boot
cp i2c.dtb /boot/
#sync; umount /boot

avoid doing that until you know its working...

or once it works cp your original file then copy the i2c.dtb over the original name... saves updating the uboot env all the time...

1 Like

Using the updated dtb somehow didn't work, just led to a string of errors so looks like I'll have to bite the bullet and learn rebuilding the image. I'll post rebuild related question in another category and will come back to update this one once I'll have the I2C working on Espressobin.

Thank you again, I really appreciate all your help.

I'm now building the new Espressobin V7 image by cloning the existing one

wget http://downloads.openwrt.org/releases/19.07.4/targets/mvebu/cortexa53/config.buildinfo -O .config

Where exactly would I go to enable the I2C? I looked in the menu options, looked for dts files in all the directories, I found some associated with the Espressobin, but can't find any reference to I2C in them.

find target/linux/ | grep espressobin | grep '.dts$'

then after compile... if not in ./bin ... the dtb can be found;

find build_dir/target-*/linux*/ | grep '.dtb$'

Thank you. This is all this file has, nothing about the I2C.

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 * Device Tree file for Globalscale Marvell ESPRESSOBin Board V7
 * Copyright (C) 2018 Marvell
 * Romain Perier <romain.perier@free-electrons.com>
 * Konstantin Porotchkin <kostap@marvell.com>

#include "armada-3720-espressobin.dts"

/ {
	model = "Globalscale Marvell ESPRESSOBin Board V7";
	compatible = "globalscale,espressobin-v7", "globalscale,espressobin",
		     "marvell,armada3720", "marvell,armada3710";

&ports {
	port@1 {
		reg = <1>;
		label = "lan1";
		phy-handle = <&switch0phy0>;

	port@3 {
		reg = <3>;
		label = "wan";
		phy-handle = <&switch0phy2>;

it sources the above file...

Yup, tried to find this file but couldn't. Where would that be? and how it will be incorporated?