rPi3 and I2c,SPI

First off - Congratulations to all associated with the port to the rPi3 - Job well done.

My question has to do with enabling the I2C and SPI ports. We have a new chip the BMC2837.

On Raspian to bring the I2C online one would first modify /etc/modules by adding 2 lines

and then modify /boot/config.txt by appending

What are the parrallel steps in Ubuntu-Mate. Thanks in advance

1 Like

Hey Mel! I don’t yet have an RPi3, but I was struggling to enable i2c on the RPi2 running Ubuntu MATE 15.10. I just figured it out, and maybe this will work on the RPi3 too.

RPi is trying to move away from the manual loading and configuration of individual modules and toward a system that uses Device Trees, Overlays, and Parameters. The Device Tree catalogs all of the hardware in the system, and Overlays can be applied to a Device Tree to activate a particular functionality, like a camera or an add-on board for a real-time clock. Parameters can be passed into an Overlay to further configure its functionality. The system interprets the Device Tree in the context of the selected Overlays to load and configure the appropriate kernel modules and other resources. In contrast to the “on-unless-blacklisted” approach of manual module management, this system is “on-iff-requested” and, in my mind, a good fit for the I/O customizability and resource-restricted environment of a single-board computer.

Just like in Raspbian, the base device tree blob (DTB) for the RPi that ships with MATE supports activating the I2C interface by adding a parameter to /boot/config.txt:

On reboot, the i2c-bcm2708 kernel module—the driver for the serial controller on the Broadcom BCM2708—is successfully loaded, which you can confirm with lsmod | grep i2c.

Unfortunately there appears to be a bug (maybe the DTB is bad?) that prevents loading of the i2c-dev kernel module, which is required to create the /dev/i2c* entry that makes the interface usable. Manually loading that module with sudo modprobe --first-time i2c-dev is enough to get /dev/i2c-1 to appear on the RPi2 B+. Install i2c-tools with sudo apt-get install i2c-tools and run i2cdetect -l and the i2c-1 bus should be listed; probe the i2c-1 bus with i2cdetect 1 with an i2c device installed and you should see the device’s address on the i2c bus.

Let me know if it works for the RPi3!

First thank you for your reply. Short answer it got me working.

I am using a Sheepwalk rp3 hat which has both a I2C One wire interface and a 1307 real time clock. I used your answer to learn much more by attempting to create a Device Tree overlay for that hat. Well after 2 days of effort and checking and rechecking that I was following the guide lines I discovered that the device tree compiler (dtc) was not happy with my source. It was choking on the the second line:


/ {
    compatible = "brcm,bcm2708";

It would seem that a major ‘.dtsi’ file is missing which may only be available if you build the kernel. I then when to plan B and dumped the data in the existing over files so I could create source that was absolute and did not depend on any external references.

I initially stumbled because I felt that Ubuntu Mate was not Raspbian and would somehow be quite different. In truth they are both Debian under the hood and that makes them both very powerful and in many ways the same. Here is the source code for the device tree:

/* swrpi3_overlay.dts
This overlay file provides a Data Tree Overlay for the use of a
 Sheepwalk RPI3 interface on a Raspberry Pi3. This interface provides a
 Maxim DS1307 real time clock and a Maxim DS2482-800 One Wire interface
 Note: all the following are done with superuser privileges.
 To build the dtb file from this source invoke:

cd /boot/overlays
dtc -O dtb -I dts -o swrpi3_overlay.dtb swrpi3_overlay.dts

 then insert the following line in /boot/config.txt

 also edit /etc/modules and add the following two lines:

 Since the owfs probes the i2c interface it is not necessary to load a
 module for it. If you built owfs from source to start it one would:

/opt/owfs/bin/owfs --i2c=/dev/i2c-1 --allow_other /mnt/1wire

 if you want to watch it work:

/opt/owfs/bin/owfs --i2c=/dev/i2c-1 --allow_other --debug /mnt/1wire

 To see the data in the real time clock one would:

hwclock -r

The data in this file was obtained by dumping


/ {
    compatible = "brcm,bcm2708";

    fragment@0 {
      target = <0xdeadbeef>;
      __overlay__ {
            #address-cells = <0x01>;
            #size-cells = <0x00>;
            status = "okay";
            ds1307@68 {
                compatible = "maxim,ds1307";
                reg = <0x68>;
                status = "okay";
                linux,phandle = <0x01>;
                phandle = <0x01>;

/*          ds2482_800: ds2482@1C {
                compatible = "maxim,ds2482";
                reg = <0x1C>;
                status = "okay";
            };     */

    __overrides__ {
        ds1307 = [00 00 00 01 73 74 61 74 75 73 00];
    __symbols__ {
        ds1307 = "/fragment@0/__overlay__/ds1307@68";
    __fixups__ {
        i2c_arm = "/fragment@0:target:0";
    __local_fixups__ {
        fixup = "/__overrides__:ds1307:0";


Thanks again, boy did I learn a lot about device trees!

I am running a RPI3 as well and In case someone like me ends up here I will share a simple solution based on @BrandonCurtis input.

The install put a i2c-dev entry in the /etc/modules-load.d/rpi2.conf file.

Given that all the hardware drivers/modules get loaded via Device Trees this seems to be the issue.

I just deleted it and the ic2-bcm2708 which I added per other “old” suggestions and rebooted.

With no modules to load in the old manner apparently the device tree system succeeded to load both and the the i2c device showed up in /dev


This kinda reminds me of moving to systemd where old system files like the old interfaces file just cause problems.

There are two other entries in that rpi2.conf file. for bcm2835. I am not sure what device they are for but if I have issues enabling other hardware via device tree configs I will try removing them (the whole file actually since apparently it not needed and part of the “old” module loading system).

For others searching for the i2cdetect error I put it here.
Error: Could not open file/dev/i2c-1’ or /dev/i2c/1': No such file or directory