6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5664
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu Apr 21, 2016 1:28 pm

Certainly on Pi3, trying to use i2c0 from Linux is going to blow up in your face.
However there is support for I2C multiplexers now available in the stock kernel - see viewtopic.php?f=44&t=141517 for the discussion thread.
Whilst not quite as tidy as fully independent ports, it does give you the opportunity to reuse slave address and logically separate all your devices.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Adco
Posts: 42
Joined: Fri Mar 11, 2016 3:01 pm

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu Apr 21, 2016 1:30 pm

I tried it and it didn't work. I went back to I2C-1. All good again. I will steer clear of I2C-0 and just work around it. I just wanted to keep the RTC away from the slaves. Having to skip address 68 looked like a mission.

Thanks.

Adco
Posts: 42
Joined: Fri Mar 11, 2016 3:01 pm

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu Apr 21, 2016 1:35 pm

Here's hoping fr another answer....

When I initialise the DS1307, I get "UU" in the feedback block. Once the system shows "UU", I can't release the RTC until I unplug it and reinsert it. How can I release it from the RPi so that I can read or change times?

Initially, on a new plug-in, the RTC shows up as 68 in the block. Once I talk to it, I loose control.

g0rg
Posts: 1
Joined: Fri Apr 22, 2016 6:33 am

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Fri Apr 22, 2016 7:51 am

Hi all , this is my 1st post here.
I used to connect lcd 16x2 i2c and an Explore-NXP hat on my Rpi2 but now i try to connect both on my Rpi3.
After reading some threads and understanding now the changes about the i2c-0 which is reserved.
What's the best workaround ?
- TCA9548A I2C Multiplexer ?
- something else ?

Thanks a lot.

crishoj
Posts: 5
Joined: Tue Mar 22, 2016 11:26 pm

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Tue May 24, 2016 10:35 am

PhilE wrote:You are in luck. The current RPi SPI driver, spi-bcm2835, support GPIO chip-selects. This means that any free GPIO line can be used as another chip select. In fact, as a result of some driver performance optimisations causing the hardware ("native") chip-selects to glitch, the driver will automatically convert native CS's to GPIO CS's.
Thanks for your instructions, Phil.

I've attempted to add to extra GPIO CS to my RasPi 3, using the following overlay:

Code: Select all

/dts-v1/;
/plugin/;

/ {
   compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";

   [email protected] {
      target = <&spi0>;
      frag0: __overlay__ {
         #address-cells = <1>;
         #size-cells = <0>;
         pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
         status = "okay";
         cs-gpios = <&gpio 22 1>, <&gpio 23 1>, <0>, <0>;

         [email protected]{
            compatible = "spidev";
            reg = <2>;   /* CE2 */
            #address-cells = <1>;
            #size-cells = <0>;
            spi-max-frequency = <500000>;
         };

         [email protected]{
            compatible = "spidev";
            reg = <3>;   /* CE3 */
            #address-cells = <1>;
            #size-cells = <0>;
            spi-max-frequency = <500000>;
         };
      };
   };

   [email protected] {
      target = <&gpio>;
      __overlay__ {
         spi0_cs_pins: spi0_cs_pins {
            brcm,pins = <22 23>;
            brcm,function = <1>; /* out */
         };
      };
   };

   __overrides__ {
      cs0_pin = <&frag0>,"cs-gpios:12", <&spi0_cs_pins>,"brcm,pins:0";
      cs1_pin = <&frag0>,"cs-gpios:24", <&spi0_cs_pins>,"brcm,pins:4";
   };
};
In `/boot/config.txt`:

Code: Select all

dtparam=spi=on
dtoverlay=spi-gpio-cs,cs2_pin=5,cs3_pin=6
Now, I don't see any mention of SPI in the output from `dmesg`, and I still only have 2 SPI devices:

Code: Select all

[email protected] ~> ls /dev/spi*
/dev/spidev0.0  /dev/spidev0.1
Do I need to create the devices myself, or am I missing something?

Thanks.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1864
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Tue May 24, 2016 11:01 am

Your cs-gpios line is the wrong way round. The gpios should be listed in order - 0 1 2 3 - which in your case would become:

Code: Select all

cs-gpios = <0>, <0>, <&gpio 22 1>, <&gpio 23 1>;
The two 0s will be silently replaced with the equivalent of "<&gpio 8 1>, <&gpio 7 1>", but you could make that explicit for clarity.

SteveRLC
Posts: 4
Joined: Sun May 22, 2016 4:34 pm

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Tue May 24, 2016 7:28 pm

Hi Phil. This thread has been very informative. I've tried implementing the overlay and it worked. I also manged to change the CS pins through

Code: Select all

dtoverlay=spi-gpio-cs,cs2_pin=5,cs3_pin=6
by changing the values to something else. However, I couldn't get it to work for GPIO 15. It shares the RX function of the UART- which made me think maybe the serial is defined as active on boot up, but I could not find anythin in th config.txt file and also not in the raspi-config command. Also, after a quick google I saw that for the Pi3 the orriginal UART was assigned to the BT. Could that have something to do with the matter?
With gpio15 set as CS3, and running

Code: Select all

 ls -l /dev/spidev*

spi devices 0-3 are listed.
Unfortunately I'm still very new to Pi coding and development, hence me heading to the forums.
Lastly, how would one add another CS line to the overlay, unfortunately I need more SPI CS lines, hence me asking. I've tried adding to the overlay, but I hit a blank at this section:

Code: Select all

 __overrides__ {
      cs0_pin = <&frag0>,"cs-gpios:12", <&spi0_cs_pins>,"brcm,pins:0";
      cs1_pin = <&frag0>,"cs-gpios:24", <&spi0_cs_pins>,"brcm,pins:4";
   };
I don't understand the numbering of the "brcm,pins:0" and "...:4" bit. How would that change if new CS lines were added?
Sorry if the request/post is lengthy. any help will be greatly appreciated.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1864
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Wed May 25, 2016 10:39 am

If you have the serial port enabled then pins 14 & 15 are used, but if you are running the latest firmware then those pins aren't reserved in the DTB so you can reassign them without contention. Perhaps you need to update? If not, or if you do and it still doesn't work, can you give me more details about the failure mode.

The number after the colon in the parameter definitions is the offset in bytes within the property of the thing you want to patch.
Let's assume your overlay contains these nodes and properties:

Code: Select all

spi0_cs_pins: spi0_cs_pins {
    brcm,pins = <22 23>;
    brcm,function = <1>; /* out */
};
...
cs-gpios = <0>, <0>, <&gpio 22 1>, <&gpio 23 1>;
and these parameter declarations:

Code: Select all

 __overrides__ {
      cs2_pin = <&frag0>,"cs-gpios:12", <&spi0_cs_pins>,"brcm,pins:0";
      cs3_pin = <&frag0>,"cs-gpios:24", <&spi0_cs_pins>,"brcm,pins:4";
   };
Items and lists enclosed by "<>"s are integers, known as cells, each of which occupies 4 bytes. Let's start with the "brcm,pins" property because it's the easiest. The colon separator indicates a 4-byte patch - the other options are ";" for 2-byte, "." for 1-byte and "#" for 8-bytes. "cs2_pin" targets 4 bytes at offsets 0 into brcm,pins, which is the first word - currently 22. Similarly, "cs3_pin" targets the second word.

"cs-gpios" starts with two zeroes, each occupying 4 bytes. &gpio is translated into a phandle - another 4 bytes, meaning that the 22 starts at offset 12. The 23 is 3 words later, so the offset is 24.

For full flexibility (and protection against clashes) it is better to bypass the automatic conversion of HW to SW CSs by making them explicit, which would give you:

Code: Select all

spi0_cs_pins: spi0_cs_pins {
    brcm,pins = <8 7 22 23>;
    brcm,function = <1>; /* out */
};
...
cs-gpios = <&gpio 8 1>, <&gpio 7 1>, <&gpio 22 1>, <&gpio 23 1>;
and

Code: Select all

 __overrides__ {
      cs0_pin = <&frag0>,"cs-gpios:4", <&spi0_cs_pins>,"brcm,pins:0";
      cs1_pin = <&frag0>,"cs-gpios:16", <&spi0_cs_pins>,"brcm,pins:4";
      cs2_pin = <&frag0>,"cs-gpios:28", <&spi0_cs_pins>,"brcm,pins:8";
      cs3_pin = <&frag0>,"cs-gpios:40", <&spi0_cs_pins>,"brcm,pins:12";
   };

SteveRLC
Posts: 4
Joined: Sun May 22, 2016 4:34 pm

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu May 26, 2016 8:03 pm

Got it working. Thank you for all the help, and clear explanations.

crishoj
Posts: 5
Joined: Tue Mar 22, 2016 11:26 pm

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu May 26, 2016 8:40 pm

I'm still struggling to get the overlay for additional CS pins right.
@SteveRLC, would you mind sharing your complete overlay? I am in the need of 4-5 extra CS pins.

Thanks a lot.

MuffinsaurusRex
Posts: 5
Joined: Wed Aug 03, 2016 2:22 am

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu Aug 11, 2016 6:45 pm

Hi PhilE,

Thank you very much for all your effort in this thread. I very much appreciate it.

I am trying to get the 3.5" PiScreen by OzzMaker working with another SPI device. I used your instructions on creating extra CS pins via GPIO:

Created spi-gpio-cs overlay

Code: Select all

/dts-v1/;
/plugin/;

/ {
   compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";

   [email protected] {
      target = <&spi0>;
      frag0: __overlay__ {
         #address-cells = <1>;
         #size-cells = <0>;
         pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
         status = "okay";
         cs-gpios = <0>, <0>, <&gpio 20 1>, <&gpio 21 1>;

         [email protected]{
            compatible = "spidev";
            reg = <2>;   /* CE2 */
            #address-cells = <1>;
            #size-cells = <0>;
            spi-max-frequency = <500000>;
         };

         [email protected]{
            compatible = "spidev";
            reg = <3>;   /* CE3 */
            #address-cells = <1>;
            #size-cells = <0>;
            spi-max-frequency = <500000>;
         };
      };
   };

   [email protected] {
      target = <&gpio>;
      __overlay__ {
         spi0_cs_pins: spi0_cs_pins {
            brcm,pins = <20 21>;
            brcm,function = <1>; /* out */
         };
      };
   };

   __overrides__ {
      cs2_pin = <&frag0>,"cs-gpios:12", <&spi0_cs_pins>,"brcm,pins:0";
      cs3_pin = <&frag0>,"cs-gpios:24", <&spi0_cs_pins>,"brcm,pins:4";
   };
};
compiled and copied to /boot/overlays

Code: Select all

dtc [email protected] -I dts -O dtb -o spi-gpio-cs.dtbo spi-gpio-cs-overlay.dts  
sudo cp spi-gpio-cs.dtbo /boot/overlays
and then added to config.txt.

Code: Select all

dtoverlay=spi-gpio-cs
(so that I use the default GPIO 20/21)
as well as

Code: Select all

dtoverlay=piscreen
for the PiScreen

After a reboot spidev0.2 and spidev0.3 are present, however, the 3.5" PiScreen remains in a blank-white state. If I remove

Code: Select all

dtoverlay=spi-gpio-cs
it works fine, and obviously the extra spidevs are gone.

If you could provide any help it would be very much appreciated.

Thank you.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1864
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Fri Aug 12, 2016 11:53 am

I wonder if the problem is caused by the change in how we handle chip selects. The SPI interface is capable of driving two chip select lines directly, but there are limitations that mean it isn't suitable for use with all devices, so back in the 4.1 tree the driver contained some logic that would automatically convert attempts to use HW CS into requests for SW CS. The standard cs-gpios property looked like this:

Code: Select all

cs-gpios  = <0>, <0>;
i.e. CS0 and CS1 are both HW CS. After the switch to 4.4, for some investigations I found it useful to be able to disable this forced coercion, so I applied a patch that commented out the driver conversion logic and added explicit SW CS to the DTBs, resulting in:

Code: Select all

cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
By applying your overlay you are now inadvertently switching back to HW CS for CS 0 and 1.

Try this instead:

Code: Select all

/dts-v1/;
/plugin/;

/ {
   compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";

   [email protected] {
      target = <&spi0>;
      frag0: __overlay__ {
         #address-cells = <1>;
         #size-cells = <0>;
         status = "okay";
         cs-gpios = <&gpio 8 1>, <&gpio 7 1>, <&gpio 20 1>, <&gpio 21 1>;

         [email protected]{
            compatible = "spidev";
            reg = <2>;   /* CE2 */
            #address-cells = <1>;
            #size-cells = <0>;
            spi-max-frequency = <500000>;
         };

         [email protected]{
            compatible = "spidev";
            reg = <3>;   /* CE3 */
            #address-cells = <1>;
            #size-cells = <0>;
            spi-max-frequency = <500000>;
         };
      };
   };

   [email protected] {
      target = <&spi0_cs_pins>;
      frag1: __overlay__ {
        brcm,pins = <8 7 20 21>;
        brcm,function = <1>; /* out */
      };
   };

   __overrides__ {
      cs2_pin = <&frag0>,"cs-gpios:28", <&frag1>,"brcm,pins:8";
      cs3_pin = <&frag0>,"cs-gpios:40", <&frag1>,"brcm,pins:12";
   };
};
You'll notice that the new overlay targets the (new) existing spi0_cs_pins node rather than overwriting it - I've discovered that overwriting existing nodes is dangerous because it messes with phandles.

MuffinsaurusRex
Posts: 5
Joined: Wed Aug 03, 2016 2:22 am

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Fri Aug 12, 2016 4:08 pm

Thanks PhilE! That solution worked. The PiScreen is now functional and I can see spidev0.2/0.3 which work! Many thanks!

ivanch10
Posts: 4
Joined: Wed Nov 02, 2016 9:51 am

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu Nov 03, 2016 10:26 am

I am a beginner.
I am trying to connect 3 set of MCP2515 (SPI-CAN). There are only 2 mcp2515-can overlays, which are mcp2515-can0 and mcp2515-can1. Anyone knows how to add 1 more mcp2515-can overlay?

I have tried to modified the mcp2515-can0-overlay.dts to be mcp2515-can2-overlay.dts. But it doesn't work at all.

Code: Select all

/*
 * Device tree overlay for mcp251x/can2 on spi0.2
 */

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
    /* disable spi-dev for spi0.2 */
    [email protected] {
        target = <&spi0>;
        __overlay__ {
            status = "okay";
        };
    };

    [email protected] {
	target = <&spidev2>;
	__overlay__ {
	    status = "disabled";
	};
    };

    /* the interrupt pin of the can-controller */
    [email protected] {
        target = <&gpio>;
        __overlay__ {
            can2_pins: can2_pins {
                brcm,pins = <25>;
                brcm,function = <0>; /* input */
            };
        };
    };

    /* the clock/oscillator of the can-controller */
    [email protected] {
        target-path = "/clocks";
        __overlay__ {
            /* external oscillator of mcp2515 on spi0.2 */
            can2_osc: can2_osc {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency  = <16000000>;
            };
        };
    };

    /* the spi config of the can-controller itself binding everything together */
    [email protected] {
        target = <&spi0>;
        __overlay__ {
            /* needed to avoid dtc warning */
            #address-cells = <1>;
            #size-cells = <0>;
            can2: [email protected] {
                reg = <2>;
                compatible = "microchip,mcp2515";
                pinctrl-names = "default";
                pinctrl-0 = <&can2_pins>;
                spi-max-frequency = <10000000>;
                interrupt-parent = <&gpio>;
                interrupts = <25 0x2>;
                clocks = <&can2_osc>;
            };
        };
    };
    __overrides__ {
        oscillator = <&can2_osc>,"clock-frequency:0";
        spimaxfrequency = <&can2>,"spi-max-frequency:0";
        interrupt = <&can2_pins>,"brcm,pins:0",<&can2>,"interrupts:0";
    };
};

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1864
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu Nov 03, 2016 11:43 am

When you're debugging an overlay, use:

Code: Select all

sudo vcdbg log msg |& grep -v -E "(HDMI|gpioman)"
or perhaps just

Code: Select all

sudo vcdbg log msg |& grep dt
to look for any DT-related error messages from the firmware.

If you try that with your overlay you should see that it can't find the label "spidev2" because it doesn't exist. The SPI0 block has two hardware chip selects, and even though we are now using software chip selects (effectively only limited by the number of pins) the DTBs only define two CS pins and spidev0 and spidev1. This is a mixed blessing in your case - you need another chip select, but you don't need to disable spidev2.

The two existing (software) chip selects are declared like this:

Code: Select all

	spi0_cs_pins: spi0_cs_pins {
		brcm,pins = <8 7>;
		brcm,function = <1>; /* output */
	};
To add another, just extend the vector assigned to "brcm,pins":

Code: Select all

[email protected] {
    target = <&spi0_cs_pins>;
    cs_pins: __overlay__ {
        brcm,pins = <8 7 6>;
   };
};
This replaces the unwanted spidev2 fragment. I chose GPIO 6 because it seemed logical, but you can pick any free one. You might prefer 23 because it is physical closer on the header, but you can also add a parameter ("cs2") to make the pin choice user-selectable:

Code: Select all

    __overrides__ {
        oscillator = <&can2_osc>,"clock-frequency:0";
        spimaxfrequency = <&can2>,"spi-max-frequency:0";
        interrupt = <&can2_pins>,"brcm,pins:0",<&can2>,"interrupts:0";
        cs2 = <&cs_pins>,"brcm,pins:8";
    };
That may be all you need to change, provided you use the "interrupt" parameter to ensure that each CAN controller has a unique interrupt GPIO. If it doesn't work, report back here with the output from the vcdbg command above and dmesg.

ivanch10
Posts: 4
Joined: Wed Nov 02, 2016 9:51 am

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu Nov 03, 2016 12:17 pm

It seems there still have some problems. Here is the result.

Code: Select all

/*
 * Device tree overlay for mcp251x/can2 on spi0.2
 */

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
    /* disable spi-dev for spi0.2 */
    [email protected] {
        target = <&spi0>;
        __overlay__ {
            status = "okay";
        };
    };

    [email protected] {
		target = <&spi0_cs_pins>;
		cs_pins: __overlay__ {
			brcm,pins = <8 7 6>;
		};
    };

    /* the interrupt pin of the can-controller */
    [email protected] {
        target = <&gpio>;
        __overlay__ {
            can2_pins: can2_pins {
                brcm,pins = <25>;
                brcm,function = <0>; /* input */
            };
        };
    };

    /* the clock/oscillator of the can-controller */
    [email protected] {
        target-path = "/clocks";
        __overlay__ {
            /* external oscillator of mcp2515 on spi0.2 */
            can2_osc: can2_osc {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency  = <16000000>;
            };
        };
    };

    /* the spi config of the can-controller itself binding everything together */
    [email protected] {
        target = <&spi0>;
        __overlay__ {
            /* needed to avoid dtc warning */
            #address-cells = <1>;
            #size-cells = <0>;
            can2: [email protected] {
                reg = <2>;
                compatible = "microchip,mcp2515";
                pinctrl-names = "default";
                pinctrl-0 = <&can2_pins>;
                spi-max-frequency = <10000000>;
                interrupt-parent = <&gpio>;
                interrupts = <25 0x2>;
                clocks = <&can2_osc>;
            };
        };
    };
    __overrides__ {
        oscillator = <&can2_osc>,"clock-frequency:0";
        spimaxfrequency = <&can2>,"spi-max-frequency:0";
        interrupt = <&can2_pins>,"brcm,pins:0",<&can2>,"interrupts:0";
		cs2 = <&cs_pins>,"brcm,pins:8";
    };
};

Code: Select all

[email protected]:~ $ sudo ip link set up can0 type can bitrate 500000
Cannot find device "can0"
[email protected]:~ $ sudo ip link set up can1 type can bitrate 500000
Cannot find device "can1"
[email protected]:~ $ sudo ip link set up can2 type can bitrate 500000
Cannot find device "can2"

Code: Select all

[email protected]:~ $ sudo vcdbg log msg |& grep -v -E "(HDMI|gpioman)"
000979.762: *** Restart logging
000980.996: Read command line from file 'cmdline.txt'
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
001232.263: Loading 'kernel7.img' to 0x8000 size 0x4088d8
001235.912: Kernel trailer DTOK property says yes
001235.927: Kernel trailer DDTK property says yes
001238.916: Loading 'bcm2710-rpi-3-b.dtb' to 0x4108d8 size 0x3e78
001320.251: dtparam: uart0_clkrate=48000000
001333.899: dtparam: spi=off
001341.927: dtparam: audio=on
001368.790: Loaded overlay 'mcp2515-can0'
001368.808: dtparam: oscillator=10000000
001369.585: dtparam: interrupt=25
001437.190: Loaded overlay 'mcp2515-can1'
001437.209: dtparam: oscillator=10000000
001437.986: dtparam: interrupt=24
001509.997: Loaded overlay 'mcp2515-can2'
001510.015: dtparam: oscillator=10000000
001510.811: dtparam: interrupt=23
001636.188: dtparam: arm_freq=1200000000
001682.248: dtparam: core_freq=250000000
001694.830: dtparam: cache_line_size=64
001718.622: Device tree loaded to 0x2effb800 (size 0x47ee)
003379.068: vchiq_core: vchiq_init_state: slot_zero = 0xfac80000, is_master = 1
003388.297: TV service:host side not connected, dropping notification 0x00000002, 0x00000002, 0x00000010

Code: Select all

[email protected]:~ $ dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.4.26-v7+ ([email protected]) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #915 SMP Thu Oct 20 17:08:44 BST 2016
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Raspberry Pi 3 Model B Rev 1.2
[    0.000000] cma: Reserved 8 MiB at 0x3a800000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 241664
[    0.000000] free_area_init_node: node 0, pgdat 808c2f80, node_mem_map b9fa6000
[    0.000000]   Normal zone: 2124 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 241664 pages, LIFO batch:31
[    0.000000] [bcm2709_smp_init_cpus] enter (9520->f3003010)
[    0.000000] [bcm2709_smp_init_cpus] ncores=4
[    0.000000] PERCPU: Embedded 13 pages/cpu @b9f61000 s22592 r8192 d22464 u53248
[    0.000000] pcpu-alloc: s22592 r8192 d22464 u53248 alloc=13*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 239540
[    0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1024 bcm2708_fb.fbheight=768 bcm2709.boardrev=0xa02082 bcm2709.serial=0x7a63b431 smsc95xx.macaddr=B8:27:EB:63:B4:31 bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 939068K/966656K available (6348K kernel code, 432K rwdata, 1716K rodata, 476K init, 764K bss, 19396K reserved, 8192K cma-reserved)
[    0.000000] Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xbb800000 - 0xff800000   (1088 MB)
    lowmem  : 0x80000000 - 0xbb000000   ( 944 MB)
    modules : 0x7f000000 - 0x80000000   (  16 MB)
      .text : 0x80008000 - 0x807e8584   (8066 kB)
      .init : 0x807e9000 - 0x80860000   ( 476 kB)
      .data : 0x80860000 - 0x808cc290   ( 433 kB)
       .bss : 0x808cf000 - 0x8098e1ec   ( 765 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] Architected cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000008] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000025] Switching to timer-based delay loop, resolution 52ns
[    0.000295] Console: colour dummy device 80x30
[    0.000496] console [tty1] enabled
[    0.000526] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.000547] pid_max: default: 32768 minimum: 301
[    0.000863] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000879] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001801] Disabling cpuset control group subsystem
[    0.001832] Initializing cgroup subsys io
[    0.001861] Initializing cgroup subsys memory
[    0.001904] Initializing cgroup subsys devices
[    0.001925] Initializing cgroup subsys freezer
[    0.001945] Initializing cgroup subsys net_cls
[    0.001994] CPU: Testing write buffer coherency: ok
[    0.002062] ftrace: allocating 21225 entries in 63 pages
[    0.051784] CPU0: update cpu_capacity 1024
[    0.051815] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.051827] [bcm2709_smp_prepare_cpus] enter
[    0.051976] Setting up static identity map for 0x8240 - 0x8274
[    0.053597] [bcm2709_boot_secondary] cpu:1 started (0) 17
[    0.053785] [bcm2709_secondary_init] enter cpu:1
[    0.053827] CPU1: update cpu_capacity 1024
[    0.053834] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.054210] [bcm2709_boot_secondary] cpu:2 started (0) 17
[    0.054375] [bcm2709_secondary_init] enter cpu:2
[    0.054395] CPU2: update cpu_capacity 1024
[    0.054401] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.054773] [bcm2709_boot_secondary] cpu:3 started (0) 16
[    0.054902] [bcm2709_secondary_init] enter cpu:3
[    0.054923] CPU3: update cpu_capacity 1024
[    0.054929] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.054989] Brought up 4 CPUs
[    0.055012] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.055020] CPU: All CPU(s) started in HYP mode.
[    0.055028] CPU: Virtualization extensions available.
[    0.055647] devtmpfs: initialized
[    0.067249] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[    0.067576] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.068286] pinctrl core: initialized pinctrl subsystem
[    0.068799] NET: Registered protocol family 16
[    0.074046] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.081856] bcm2709: Mini UART enabled
[    0.081901] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.081912] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.082076] Serial: AMBA PL011 UART driver
[    0.082218] uart-pl011 3f201000.uart: could not find pctldev for node /soc/[email protected]/uart0_pins, deferring probe
[    0.082380] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.153900] bcm2835-dma 3f007000.dma: DMA legacy API manager at f3007000, dmachans=0x1
[    0.154446] SCSI subsystem initialized
[    0.154613] usbcore: registered new interface driver usbfs
[    0.154693] usbcore: registered new interface driver hub
[    0.154785] usbcore: registered new device driver usb
[    0.161344] raspberrypi-firmware soc:firmware: Attached to firmware from 2016-10-20 14:57
[    0.188541] clocksource: Switched to clocksource arch_sys_counter
[    0.233773] FS-Cache: Loaded
[    0.234054] CacheFiles: Loaded
[    0.246294] NET: Registered protocol family 2
[    0.247150] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.247265] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.247454] TCP: Hash tables configured (established 8192 bind 8192)
[    0.247545] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.247591] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.247819] NET: Registered protocol family 1
[    0.248150] RPC: Registered named UNIX socket transport module.
[    0.248161] RPC: Registered udp transport module.
[    0.248169] RPC: Registered tcp transport module.
[    0.248178] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.249352] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[    0.250712] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.264041] VFS: Disk quotas dquot_6.6.0
[    0.264308] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.266516] FS-Cache: Netfs 'nfs' registered for caching
[    0.267417] NFS: Registering the id_resolver key type
[    0.267478] Key type id_resolver registered
[    0.267487] Key type id_legacy registered
[    0.269864] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.269992] io scheduler noop registered
[    0.270013] io scheduler deadline registered (default)
[    0.270068] io scheduler cfq registered
[    0.272621] BCM2708FB: allocated DMA memory fac00000
[    0.272647] BCM2708FB: allocated DMA channel 0 @ f3007000
[    0.295123] Console: switching to colour frame buffer device 128x48
[    0.307915] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.308968] 3f215040.uart: ttyS0 at MMIO 0x3f215040 (irq = 59, base_baud = 31250000) is a 16550
[    1.209926] bcm2835-rng 3f104000.rng: hwrng registered
[    1.210119] vc-cma: Videocore CMA driver
[    1.210130] vc-cma: vc_cma_base      = 0x00000000
[    1.210140] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    1.210149] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    1.210416] vc-mem: phys_addr:0x00000000 mem_base=0x3dc00000 mem_size:0x3f000000(1008 MiB)
[    1.225270] brd: module loaded
[    1.233888] loop: module loaded
[    1.234803] vchiq: vchiq_init_state: slot_zero = 0xbac80000, is_master = 0
[    1.236271] Loading iSCSI transport class v2.0-870.
[    1.236922] usbcore: registered new interface driver smsc95xx
[    1.236974] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.437223] Core Release: 2.80a
[    1.437235] Setting default values for core params
[    1.437269] Finished setting default values for core params
[    1.637645] Using Buffer DMA mode
[    1.637655] Periodic Transfer Interrupt Enhancement - disabled
[    1.637664] Multiprocessor Interrupt Enhancement - disabled
[    1.637674] OTG VER PARAM: 0, OTG VER FLAG: 0
[    1.637688] Dedicated Tx FIFOs mode
[    1.638032] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xbac14000 dma = 0xfac14000 len=9024
[    1.638062] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[    1.638085] dwc_otg: Microframe scheduler enabled
[    1.638135] WARN::hcd_init_fiq:413: FIQ on core 1 at 0x804476e0
[    1.638149] WARN::hcd_init_fiq:414: FIQ ASM at 0x80447a50 length 36
[    1.638164] WARN::hcd_init_fiq:439: MPHI regs_base at 0xbbb9c000
[    1.638230] dwc_otg 3f980000.usb: DWC OTG Controller
[    1.638267] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    1.638304] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
[    1.638353] Init: Port Power? op_state=1
[    1.638361] Init: Power Port (0)
[    1.638593] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.638609] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.638621] usb usb1: Product: DWC OTG Controller
[    1.638633] usb usb1: Manufacturer: Linux 4.4.26-v7+ dwc_otg_hcd
[    1.638645] usb usb1: SerialNumber: 3f980000.usb
[    1.639438] hub 1-0:1.0: USB hub found
[    1.639481] hub 1-0:1.0: 1 port detected
[    1.640079] dwc_otg: FIQ enabled
[    1.640088] dwc_otg: NAK holdoff enabled
[    1.640096] dwc_otg: FIQ split-transaction FSM enabled
[    1.640128] Module dwc_common_port init
[    1.640350] usbcore: registered new interface driver usb-storage
[    1.640597] mousedev: PS/2 mouse device common for all mice
[    1.641315] bcm2835-cpufreq: min=600000 max=1200000
[    1.641591] sdhci: Secure Digital Host Controller Interface driver
[    1.641601] sdhci: Copyright(c) Pierre Ossman
[    1.641934] sdhost: log_buf @ bac13000 (fac13000)
[    1.698571] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    1.700841] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0
[    1.700855] mmc-bcm2835 3f300000.mmc: DMA channel allocated
[    1.755402] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.757247] mmc0: new high speed SDHC card at address 0001
[    1.757809] mmcblk0: mmc0:0001 00000 29.8 GiB
[    1.758686] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.759147] ledtrig-cpu: registered to indicate activity on CPUs
[    1.759176]  mmcblk0: p1 p2
[    1.759284] hidraw: raw HID events driver (C) Jiri Kosina
[    1.759483] usbcore: registered new interface driver usbhid
[    1.759492] usbhid: USB HID core driver
[    1.760055] Initializing XFRM netlink socket
[    1.760093] NET: Registered protocol family 17
[    1.760231] Key type dns_resolver registered
[    1.760818] Registering SWP/SWPB emulation handler
[    1.761617] registered taskstats version 1
[    1.761815] vc-sm: Videocore shared memory driver
[    1.761831] [vc_sm_connected_init]: start
[    1.764376] [vc_sm_connected_init]: end - returning 0
[    1.767607] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[    1.768023] of_cfs_init
[    1.768104] of_cfs_init: OK
[    1.777277] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    1.778930] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.780486] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.783260] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    1.787493] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.787540] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.795204] devtmpfs: mounted
[    1.795950] Freeing unused kernel memory: 476K (807e9000 - 80860000)
[    1.838674] Indeed it is in host mode hprt0 = 00021501
[    1.873954] mmc1: new high speed SDIO card at address 0001
[    2.018582] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    2.018723] Indeed it is in host mode hprt0 = 00001101
[    2.041180] random: systemd: uninitialized urandom read (16 bytes read, 24 bits of entropy available)
[    2.080508] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
[    2.080909] systemd[1]: Detected architecture 'arm'.
[    2.180011] NET: Registered protocol family 10
[    2.181452] systemd[1]: Inserted module 'ipv6'
[    2.183249] systemd[1]: Set hostname to <raspberrypi>.
[    2.218869] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    2.218889] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.219686] hub 1-1:1.0: USB hub found
[    2.219782] hub 1-1:1.0: 5 ports detected
[    2.315955] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 56 bits of entropy available)
[    2.387617] random: systemd: uninitialized urandom read (16 bytes read, 66 bits of entropy available)
[    2.388988] random: systemd: uninitialized urandom read (16 bytes read, 67 bits of entropy available)
[    2.390500] random: systemd: uninitialized urandom read (16 bytes read, 67 bits of entropy available)
[    2.404835] random: systemd: uninitialized urandom read (16 bytes read, 69 bits of entropy available)
[    2.405643] random: systemd: uninitialized urandom read (16 bytes read, 69 bits of entropy available)
[    2.405835] random: systemd: uninitialized urandom read (16 bytes read, 69 bits of entropy available)
[    2.437860] random: systemd: uninitialized urandom read (16 bytes read, 71 bits of entropy available)
[    2.440512] random: systemd: uninitialized urandom read (16 bytes read, 71 bits of entropy available)
[    2.498602] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    2.542251] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[    2.542601] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    2.542680] systemd[1]: Starting Remote File Systems (Pre).
[    2.542831] systemd[1]: Reached target Remote File Systems (Pre).
[    2.542974] systemd[1]: Starting Arbitrary Executable File Formats File System Automount Point.
[    2.543424] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[    2.543506] systemd[1]: Starting Encrypted Volumes.
[    2.543576] systemd[1]: Reached target Encrypted Volumes.
[    2.543659] systemd[1]: Starting Swap.
[    2.543726] systemd[1]: Reached target Swap.
[    2.543797] systemd[1]: Expecting device dev-mmcblk0p1.device...
[    2.543876] systemd[1]: Starting Root Slice.
[    2.544020] systemd[1]: Created slice Root Slice.
[    2.544091] systemd[1]: Starting User and Session Slice.
[    2.544313] systemd[1]: Created slice User and Session Slice.
[    2.544384] systemd[1]: Starting Delayed Shutdown Socket.
[    2.544548] systemd[1]: Listening on Delayed Shutdown Socket.
[    2.544619] systemd[1]: Starting /dev/initctl Compatibility Named Pipe.
[    2.544804] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[    2.544877] systemd[1]: Starting Journal Socket (/dev/log).
[    2.545062] systemd[1]: Listening on Journal Socket (/dev/log).
[    2.545153] systemd[1]: Starting udev Control Socket.
[    2.545303] systemd[1]: Listening on udev Control Socket.
[    2.545387] systemd[1]: Starting udev Kernel Socket.
[    2.545507] systemd[1]: Listening on udev Kernel Socket.
[    2.545595] systemd[1]: Starting Journal Socket.
[    2.545827] systemd[1]: Listening on Journal Socket.
[    2.545951] systemd[1]: Starting System Slice.
[    2.546167] systemd[1]: Created slice System Slice.
[    2.546283] systemd[1]: Starting File System Check on Root Device...
[    2.579267] systemd[1]: Starting system-systemd\x2dfsck.slice.
[    2.579668] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[    2.579794] systemd[1]: Starting system-autologin.slice.
[    2.580068] systemd[1]: Created slice system-autologin.slice.
[    2.580266] systemd[1]: Starting Increase datagram queue length...
[    2.582975] systemd[1]: Starting Restore / save the current clock...
[    2.590639] systemd[1]: Mounted Huge Pages File System.
[    2.590781] systemd[1]: Starting udev Coldplug all Devices...
[    2.593859] systemd[1]: Mounting Debug File System...
[    2.599948] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    2.599970] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.603214] smsc95xx v1.0.4
[    2.624371] systemd[1]: Started Set Up Additional Binary Formats.
[    2.624817] systemd[1]: Starting Create list of required static device nodes for the current kernel...
[    2.630297] systemd[1]: Mounting POSIX Message Queue File System...
[    2.662191] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:63:b4:31
[    2.673810] systemd[1]: Starting Load Kernel Modules...
[    2.676754] systemd[1]: Starting Slices.
[    2.676916] systemd[1]: Reached target Slices.
[    2.683916] systemd[1]: Started Create list of required static device nodes for the current kernel.
[    2.717539] systemd[1]: Mounted POSIX Message Queue File System.
[    2.717856] systemd[1]: Mounted Debug File System.
[    2.720330] systemd[1]: Started Increase datagram queue length.
[    2.730855] fuse init (API version 7.23)
[    2.746652] systemd[1]: Started udev Coldplug all Devices.
[    2.767976] i2c /dev entries driver
[    2.776056] systemd[1]: Started Load Kernel Modules.
[    2.798459] systemd[1]: Started Restore / save the current clock.
[    2.815000] systemd[1]: Time has been changed
[    2.859730] systemd[1]: Mounting FUSE Control File System...
[    2.899467] systemd[1]: Mounting Configuration File System...
[    2.901756] systemd[1]: Starting Apply Kernel Variables...
[    2.904890] systemd[1]: Starting Syslog Socket.
[    2.905271] systemd[1]: Listening on Syslog Socket.
[    2.905423] systemd[1]: Starting Journal Service...
[    2.908934] systemd[1]: Started Journal Service.
[    3.078973] systemd-udevd[138]: starting version 215
[    3.684796] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    4.613254] spi spi0.2: setup: only two native chip-selects are supported
[    4.613284] spi-bcm2835 3f204000.spi: can't setup spi0.2, status -22
[    4.613299] spi_master spi0: spi_device register error /soc/[email protected]/[email protected]
[    4.613317] spi_master spi0: Failed to create SPI device for /soc/[email protected]/[email protected]
[    4.614917] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
[    4.619537] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[    4.648265] CAN device driver interface
[    4.810966] usbcore: registered new interface driver brcmfmac
[    4.945045] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: May 27 2016 00:13:38 version 7.45.41.26 (r640327) FWID 01-df77e4a7
[    4.963818] random: nonblocking pool is initialized
[    4.980097] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
[    5.018684] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
[    5.018713] cfg80211: World regulatory domain updated:
[    5.018724] cfg80211:  DFS Master region: unset
[    5.018733] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    5.018748] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    5.018763] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    5.018775] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[    5.018790] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    5.018807] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[    5.018821] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[    5.018833] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[    5.018847] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[    5.367285] systemd-journald[131]: Received request to flush runtime journal from PID 1
[    6.437247] brcmfmac: brcmf_add_if: ERROR: netdev:wlan0 already exists
[    6.437262] brcmfmac: brcmf_add_if: ignore IF event
[    6.441500] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[    6.441536] brcmfmac: power management disabled
[    6.606883] uart-pl011 3f201000.uart: no DMA platform data
[    7.010649] cfg80211: Regulatory domain changed to country: GB
[    7.010666] cfg80211:  DFS Master region: ETSI
[    7.010672] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    7.010680] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    7.010688] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    7.010696] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[    7.010702] cfg80211:   (5490000 KHz - 5710000 KHz @ 160000 KHz), (N/A, 2700 mBm), (0 s)
[    7.010708] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[    7.339893] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[    7.340084] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    7.802483] Adding 102396k swap on /var/swap.  Priority:-1 extents:4 across:192508k SSFS
[    8.878771] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    8.880623] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
[   11.205645] Bluetooth: Core ver 2.21
[   11.205699] NET: Registered protocol family 31
[   11.205705] Bluetooth: HCI device and connection manager initialized
[   11.205721] Bluetooth: HCI socket layer initialized
[   11.205731] Bluetooth: L2CAP socket layer initialized
[   11.205754] Bluetooth: SCO socket layer initialized
[   11.226951] Bluetooth: HCI UART driver ver 2.3
[   11.226969] Bluetooth: HCI UART protocol H4 registered
[   11.226974] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   11.227248] Bluetooth: HCI UART protocol BCM registered
[   11.576341] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   11.576355] Bluetooth: BNEP filters: protocol multicast
[   11.576370] Bluetooth: BNEP socket layer initialized


PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1864
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu Nov 03, 2016 12:27 pm

Code: Select all

[    4.613254] spi spi0.2: setup: only two native chip-selects are supported
[    4.613284] spi-bcm2835 3f204000.spi: can't setup spi0.2, status -22
Ah yes, as well as reserving the extra CS pin we need to tell the driver to use it:

Code: Select all

/*
 * Device tree overlay for mcp251x/can2 on spi0.2
 */

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
    /* disable spi-dev for spi0.2 */
    [email protected] {
        target = <&spi0>;
        __overlay__ {
            status = "okay";
        };
    };

    [email protected] {
      target = <&spi0_cs_pins>;
      cs_pins: __overlay__ {
         brcm,pins = <8 7 6>;
      };
    };

    /* the interrupt pin of the can-controller */
    [email protected] {
        target = <&gpio>;
        __overlay__ {
            can2_pins: can2_pins {
                brcm,pins = <25>;
                brcm,function = <0>; /* input */
            };
        };
    };

    /* the clock/oscillator of the can-controller */
    [email protected] {
        target-path = "/clocks";
        __overlay__ {
            /* external oscillator of mcp2515 on spi0.2 */
            can2_osc: can2_osc {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency  = <16000000>;
            };
        };
    };

    /* the spi config of the can-controller itself binding everything together */
    [email protected] {
        target = <&spi0>;
        spi: __overlay__ {
            /* needed to avoid dtc warning */
            #address-cells = <1>;
            #size-cells = <0>;

            cs-gpios = <&gpio 8 1>, <&gpio 7 1>, <&gpio 6 1>;

            can2: [email protected] {
                reg = <2>;
                compatible = "microchip,mcp2515";
                pinctrl-names = "default";
                pinctrl-0 = <&can2_pins>;
                spi-max-frequency = <10000000>;
                interrupt-parent = <&gpio>;
                interrupts = <25 0x2>;
                clocks = <&can2_osc>;
            };
        };
    };
    __overrides__ {
        oscillator = <&can2_osc>,"clock-frequency:0";
        spimaxfrequency = <&can2>,"spi-max-frequency:0";
        interrupt = <&can2_pins>,"brcm,pins:0",<&can2>,"interrupts:0";
        cs2 = <&cs_pins>,"brcm,pins:8", <&spi>,"cs-gpios:28";
    };
};

ivanch10
Posts: 4
Joined: Wed Nov 02, 2016 9:51 am

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Fri Nov 04, 2016 4:53 am

Thanks PhilE!! The mcp2515-can2 worked. :D :D

Now i got another problem. I can set CAN speed to 500kHz but It seems I can't set it to 1MHz. How can I solve it?

Code: Select all

[email protected]:~ $ sudo ip link set up can0 type can bitrate 1000000;
RTNETLINK answers: Numerical argument out of domain
dmesg

Code: Select all

[email protected]:~ $ dmesg
[ 5340.708426] mcp251x spi0.0 can0: bitrate error 16.6% too high

Besides,
If I want to create more mcp2515-can overlays, like mcp2515-can3, Is it possible that the new mcp2515-can3 overlay doesn't modify both cs-gpios and brcm,pins of can0, can1 and can2?

This mcp2515-can3 worked.

Code: Select all

/*
 * Device tree overlay for mcp251x/can3 on spi0.3
 */

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709";
    /* disable spi-dev for spi0.3 */
    [email protected] {
        target = <&spi0>;
        __overlay__ {
            status = "okay";
        };
    };

    [email protected] {
      target = <&spi0_cs_pins>;
      cs_pins: __overlay__ {
         brcm,pins = <8 7 6 5>;
      };
    };

    /* the interrupt pin of the can-controller */
    [email protected] {
        target = <&gpio>;
        __overlay__ {
            can3_pins: can3_pins {
                brcm,pins = <25>;
                brcm,function = <0>; /* input */
            };
        };
    };

    /* the clock/oscillator of the can-controller */
    [email protected] {
        target-path = "/clocks";
        __overlay__ {
            /* external oscillator of mcp2515 on spi0.3 */
            can3_osc: can3_osc {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency  = <16000000>;
            };
        };
    };

    /* the spi config of the can-controller itself binding everything together */
    [email protected] {
        target = <&spi0>;
        spi: __overlay__ {
            /* needed to avoid dtc warning */
            #address-cells = <1>;
            #size-cells = <0>;

            cs-gpios = <&gpio 8 1>, <&gpio 7 1>, <&gpio 6 1>, <&gpio 5 1>;

            can3: [email protected] {
                reg = <3>;
                compatible = "microchip,mcp2515";
                pinctrl-names = "default";
                pinctrl-0 = <&can3_pins>;
                spi-max-frequency = <10000000>;
                interrupt-parent = <&gpio>;
                interrupts = <25 0x2>;
                clocks = <&can3_osc>;
            };
        };
    };
    __overrides__ {
        oscillator = <&can3_osc>,"clock-frequency:0";
        spimaxfrequency = <&can3>,"spi-max-frequency:0";
        interrupt = <&can3_pins>,"brcm,pins:0",<&can3>,"interrupts:0";
        cs3 = <&cs_pins>,"brcm,pins:12", <&spi>,"cs-gpios:40";
    };
};

But If I modify the code

Code: Select all

cs-gpios = <&gpio 8 1>, <&gpio 7 1>, <&gpio 6 1>, <&gpio 5 1>;

cs3 = <&cs_pins>,"brcm,pins:12", <&spi>,"cs-gpios:40";
to be something like these

Code: Select all

cs-gpios = <0>, <0>, <0>, <&gpio 5 1>;

cs3 = <&cs_pins>,"brcm,pins:12", <&spi>,"cs-gpios:16";
it doesn't work.

I think the mcp2515-can2 overlay has already assigned gpio 8 7 6 to cs-gpios for can0, can1 and can2.
The mcp2515-can3 overlay only needs to assign gpio 5 to cs-gpios for can3.


Also, in mcp2515-can3 overlays, Is it necessary to write 8 7 6 in brcm,pins?

Code: Select all

 brcm,pins = <8 7 6 5>; 


dmesg for reference

Code: Select all

[email protected]:~ $ dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.4.26-v7+ ([email protected]) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #915 SMP Thu Oct 20 17:08:44 BST 2016
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Raspberry Pi 3 Model B Rev 1.2
[    0.000000] cma: Reserved 8 MiB at 0x3a800000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 241664
[    0.000000] free_area_init_node: node 0, pgdat 808c2f80, node_mem_map b9fa6000
[    0.000000]   Normal zone: 2124 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 241664 pages, LIFO batch:31
[    0.000000] [bcm2709_smp_init_cpus] enter (9520->f3003010)
[    0.000000] [bcm2709_smp_init_cpus] ncores=4
[    0.000000] PERCPU: Embedded 13 pages/cpu @b9f60000 s22592 r8192 d22464 u53248
[    0.000000] pcpu-alloc: s22592 r8192 d22464 u53248 alloc=13*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 239540
[    0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1024 bcm2708_fb.fbheight=768 bcm2709.boardrev=0xa02082 bcm2709.serial=0x7a63b431 smsc95xx.macaddr=B8:27:EB:63:B4:31 bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 939064K/966656K available (6348K kernel code, 432K rwdata, 1716K rodata, 476K init, 764K bss, 19400K reserved, 8192K cma-reserved)
[    0.000000] Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xbb800000 - 0xff800000   (1088 MB)
    lowmem  : 0x80000000 - 0xbb000000   ( 944 MB)
    modules : 0x7f000000 - 0x80000000   (  16 MB)
      .text : 0x80008000 - 0x807e8584   (8066 kB)
      .init : 0x807e9000 - 0x80860000   ( 476 kB)
      .data : 0x80860000 - 0x808cc290   ( 433 kB)
       .bss : 0x808cf000 - 0x8098e1ec   ( 765 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] Architected cp15 timer(s) running at 19.20MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.000009] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[    0.000026] Switching to timer-based delay loop, resolution 52ns
[    0.000300] Console: colour dummy device 80x30
[    0.000503] console [tty1] enabled
[    0.000535] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.000556] pid_max: default: 32768 minimum: 301
[    0.000868] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000883] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.001808] Disabling cpuset control group subsystem
[    0.001843] Initializing cgroup subsys io
[    0.001874] Initializing cgroup subsys memory
[    0.001916] Initializing cgroup subsys devices
[    0.001937] Initializing cgroup subsys freezer
[    0.001957] Initializing cgroup subsys net_cls
[    0.002006] CPU: Testing write buffer coherency: ok
[    0.002067] ftrace: allocating 21225 entries in 63 pages
[    0.050521] CPU0: update cpu_capacity 1024
[    0.050553] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.050565] [bcm2709_smp_prepare_cpus] enter
[    0.050699] Setting up static identity map for 0x8240 - 0x8274
[    0.052320] [bcm2709_boot_secondary] cpu:1 started (0) 17
[    0.052508] [bcm2709_secondary_init] enter cpu:1
[    0.052551] CPU1: update cpu_capacity 1024
[    0.052557] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.052933] [bcm2709_boot_secondary] cpu:2 started (0) 17
[    0.053097] [bcm2709_secondary_init] enter cpu:2
[    0.053118] CPU2: update cpu_capacity 1024
[    0.053124] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.053495] [bcm2709_boot_secondary] cpu:3 started (0) 17
[    0.053625] [bcm2709_secondary_init] enter cpu:3
[    0.053645] CPU3: update cpu_capacity 1024
[    0.053651] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.053711] Brought up 4 CPUs
[    0.053735] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.053743] CPU: All CPU(s) started in HYP mode.
[    0.053751] CPU: Virtualization extensions available.
[    0.054363] devtmpfs: initialized
[    0.066224] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[    0.066560] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.067269] pinctrl core: initialized pinctrl subsystem
[    0.067783] NET: Registered protocol family 16
[    0.073053] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.081071] bcm2709: Mini UART enabled
[    0.081116] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.081127] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.081290] Serial: AMBA PL011 UART driver
[    0.081435] uart-pl011 3f201000.uart: could not find pctldev for node /soc/[email protected]/uart0_pins, deferring probe
[    0.081603] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    0.152533] bcm2835-dma 3f007000.dma: DMA legacy API manager at f3007000, dmachans=0x1
[    0.153094] SCSI subsystem initialized
[    0.153256] usbcore: registered new interface driver usbfs
[    0.153336] usbcore: registered new interface driver hub
[    0.153431] usbcore: registered new device driver usb
[    0.160050] raspberrypi-firmware soc:firmware: Attached to firmware from 2016-10-20 14:57
[    0.187285] clocksource: Switched to clocksource arch_sys_counter
[    0.232550] FS-Cache: Loaded
[    0.232827] CacheFiles: Loaded
[    0.245070] NET: Registered protocol family 2
[    0.245928] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.246042] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.246231] TCP: Hash tables configured (established 8192 bind 8192)
[    0.246323] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.246370] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.246598] NET: Registered protocol family 1
[    0.246924] RPC: Registered named UNIX socket transport module.
[    0.246934] RPC: Registered udp transport module.
[    0.246943] RPC: Registered tcp transport module.
[    0.246952] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.248153] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[    0.249520] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.262862] VFS: Disk quotas dquot_6.6.0
[    0.263136] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.265359] FS-Cache: Netfs 'nfs' registered for caching
[    0.266269] NFS: Registering the id_resolver key type
[    0.266310] Key type id_resolver registered
[    0.266320] Key type id_legacy registered
[    0.268699] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.268829] io scheduler noop registered
[    0.268850] io scheduler deadline registered (default)
[    0.268905] io scheduler cfq registered
[    0.271472] BCM2708FB: allocated DMA memory fac00000
[    0.271499] BCM2708FB: allocated DMA channel 0 @ f3007000
[    0.293995] Console: switching to colour frame buffer device 128x48
[    0.306790] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.307819] console [ttyS0] disabled
[    0.307861] 3f215040.uart: ttyS0 at MMIO 0x3f215040 (irq = 59, base_baud = 31250000) is a 16550
[    0.308383] console [ttyS0] enabled
[    1.214380] bcm2835-rng 3f104000.rng: hwrng registered
[    1.214558] vc-cma: Videocore CMA driver
[    1.214568] vc-cma: vc_cma_base      = 0x00000000
[    1.214578] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    1.214587] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    1.214824] vc-mem: phys_addr:0x00000000 mem_base=0x3dc00000 mem_size:0x3f000000(1008 MiB)
[    1.229546] brd: module loaded
[    1.238096] loop: module loaded
[    1.239039] vchiq: vchiq_init_state: slot_zero = 0xbac80000, is_master = 0
[    1.240500] Loading iSCSI transport class v2.0-870.
[    1.241153] usbcore: registered new interface driver smsc95xx
[    1.241204] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.441463] Core Release: 2.80a
[    1.441481] Setting default values for core params
[    1.441514] Finished setting default values for core params
[    1.641890] Using Buffer DMA mode
[    1.641901] Periodic Transfer Interrupt Enhancement - disabled
[    1.641910] Multiprocessor Interrupt Enhancement - disabled
[    1.641919] OTG VER PARAM: 0, OTG VER FLAG: 0
[    1.641934] Dedicated Tx FIFOs mode
[    1.642229] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xbac14000 dma = 0xfac14000 len=9024
[    1.642259] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[    1.642283] dwc_otg: Microframe scheduler enabled
[    1.642334] WARN::hcd_init_fiq:413: FIQ on core 1 at 0x804476e0
[    1.642349] WARN::hcd_init_fiq:414: FIQ ASM at 0x80447a50 length 36
[    1.642364] WARN::hcd_init_fiq:439: MPHI regs_base at 0xbbb9c000
[    1.642428] dwc_otg 3f980000.usb: DWC OTG Controller
[    1.642464] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    1.642498] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
[    1.642551] Init: Port Power? op_state=1
[    1.642559] Init: Power Port (0)
[    1.642759] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.642774] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.642787] usb usb1: Product: DWC OTG Controller
[    1.642799] usb usb1: Manufacturer: Linux 4.4.26-v7+ dwc_otg_hcd
[    1.642811] usb usb1: SerialNumber: 3f980000.usb
[    1.643559] hub 1-0:1.0: USB hub found
[    1.643602] hub 1-0:1.0: 1 port detected
[    1.644154] dwc_otg: FIQ enabled
[    1.644164] dwc_otg: NAK holdoff enabled
[    1.644172] dwc_otg: FIQ split-transaction FSM enabled
[    1.644211] Module dwc_common_port init
[    1.644459] usbcore: registered new interface driver usb-storage
[    1.644706] mousedev: PS/2 mouse device common for all mice
[    1.645423] bcm2835-cpufreq: min=600000 max=1200000
[    1.645694] sdhci: Secure Digital Host Controller Interface driver
[    1.645703] sdhci: Copyright(c) Pierre Ossman
[    1.646012] sdhost: log_buf @ bac13000 (fac13000)
[    1.697316] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    1.699587] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0
[    1.699601] mmc-bcm2835 3f300000.mmc: DMA channel allocated
[    1.754122] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.755968] mmc0: new high speed SDHC card at address 0001
[    1.756538] mmcblk0: mmc0:0001 00000 29.8 GiB
[    1.757437] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.757871] ledtrig-cpu: registered to indicate activity on CPUs
[    1.757893]  mmcblk0: p1 p2
[    1.758003] hidraw: raw HID events driver (C) Jiri Kosina
[    1.758214] usbcore: registered new interface driver usbhid
[    1.758222] usbhid: USB HID core driver
[    1.758787] Initializing XFRM netlink socket
[    1.758823] NET: Registered protocol family 17
[    1.758960] Key type dns_resolver registered
[    1.759575] Registering SWP/SWPB emulation handler
[    1.760381] registered taskstats version 1
[    1.760549] vc-sm: Videocore shared memory driver
[    1.760564] [vc_sm_connected_init]: start
[    1.764100] [vc_sm_connected_init]: end - returning 0
[    1.767414] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[    1.767775] of_cfs_init
[    1.767856] of_cfs_init: OK
[    1.777057] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    1.778659] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.780257] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.783033] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    1.787610] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.787657] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.795313] devtmpfs: mounted
[    1.796060] Freeing unused kernel memory: 476K (807e9000 - 80860000)
[    1.837420] Indeed it is in host mode hprt0 = 00021501
[    1.873691] mmc1: new high speed SDIO card at address 0001
[    2.017326] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    2.017473] Indeed it is in host mode hprt0 = 00001101
[    2.041165] random: systemd: uninitialized urandom read (16 bytes read, 24 bits of entropy available)
[    2.079301] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
[    2.079698] systemd[1]: Detected architecture 'arm'.
[    2.179357] NET: Registered protocol family 10
[    2.180930] systemd[1]: Inserted module 'ipv6'
[    2.182847] systemd[1]: Set hostname to <raspberrypi>.
[    2.217644] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    2.217664] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.218514] hub 1-1:1.0: USB hub found
[    2.218612] hub 1-1:1.0: 5 ports detected
[    2.279385] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read, 51 bits of entropy available)
[    2.361482] random: systemd: uninitialized urandom read (16 bytes read, 63 bits of entropy available)
[    2.362847] random: systemd: uninitialized urandom read (16 bytes read, 63 bits of entropy available)
[    2.364433] random: systemd: uninitialized urandom read (16 bytes read, 64 bits of entropy available)
[    2.379362] random: systemd: uninitialized urandom read (16 bytes read, 66 bits of entropy available)
[    2.380101] random: systemd: uninitialized urandom read (16 bytes read, 66 bits of entropy available)
[    2.380269] random: systemd: uninitialized urandom read (16 bytes read, 66 bits of entropy available)
[    2.410842] random: systemd: uninitialized urandom read (16 bytes read, 70 bits of entropy available)
[    2.413456] random: systemd: uninitialized urandom read (16 bytes read, 70 bits of entropy available)
[    2.507347] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    2.514001] systemd[1]: Expecting device dev-ttyS0.device...
[    2.514301] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[    2.514517] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    2.514594] systemd[1]: Starting Remote File Systems (Pre).
[    2.514667] systemd[1]: Reached target Remote File Systems (Pre).
[    2.514815] systemd[1]: Starting Arbitrary Executable File Formats File System Automount Point.
[    2.515263] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[    2.515347] systemd[1]: Starting Encrypted Volumes.
[    2.515416] systemd[1]: Reached target Encrypted Volumes.
[    2.515499] systemd[1]: Starting Swap.
[    2.515567] systemd[1]: Reached target Swap.
[    2.515639] systemd[1]: Expecting device dev-mmcblk0p1.device...
[    2.515710] systemd[1]: Starting Root Slice.
[    2.515849] systemd[1]: Created slice Root Slice.
[    2.515918] systemd[1]: Starting User and Session Slice.
[    2.516139] systemd[1]: Created slice User and Session Slice.
[    2.516212] systemd[1]: Starting Delayed Shutdown Socket.
[    2.516369] systemd[1]: Listening on Delayed Shutdown Socket.
[    2.516439] systemd[1]: Starting /dev/initctl Compatibility Named Pipe.
[    2.516617] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[    2.516688] systemd[1]: Starting Journal Socket (/dev/log).
[    2.516860] systemd[1]: Listening on Journal Socket (/dev/log).
[    2.516951] systemd[1]: Starting udev Control Socket.
[    2.517107] systemd[1]: Listening on udev Control Socket.
[    2.517193] systemd[1]: Starting udev Kernel Socket.
[    2.517459] systemd[1]: Listening on udev Kernel Socket.
[    2.517555] systemd[1]: Starting Journal Socket.
[    2.517740] systemd[1]: Listening on Journal Socket.
[    2.517874] systemd[1]: Starting System Slice.
[    2.518091] systemd[1]: Created slice System Slice.
[    2.518208] systemd[1]: Starting File System Check on Root Device...
[    2.557892] systemd[1]: Starting system-systemd\x2dfsck.slice.
[    2.558322] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[    2.558437] systemd[1]: Starting system-autologin.slice.
[    2.558725] systemd[1]: Created slice system-autologin.slice.
[    2.558799] systemd[1]: Starting system-serial\x2dgetty.slice.
[    2.559062] systemd[1]: Created slice system-serial\x2dgetty.slice.
[    2.559258] systemd[1]: Starting Increase datagram queue length...
[    2.561863] systemd[1]: Starting Restore / save the current clock...
[    2.568187] systemd[1]: Mounted Huge Pages File System.
[    2.568327] systemd[1]: Starting udev Coldplug all Devices...
[    2.571721] systemd[1]: Mounting Debug File System...
[    2.580009] systemd[1]: Started Set Up Additional Binary Formats.
[    2.580502] systemd[1]: Starting Create list of required static device nodes for the current kernel...
[    2.583526] systemd[1]: Mounting POSIX Message Queue File System...
[    2.608059] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    2.608082] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.610395] systemd[1]: Starting Load Kernel Modules...
[    2.611768] smsc95xx v1.0.4
[    2.613262] systemd[1]: Starting Slices.
[    2.613391] systemd[1]: Reached target Slices.
[    2.621236] systemd[1]: Started Create list of required static device nodes for the current kernel.
[    2.658166] systemd[1]: Starting Create Static Device Nodes in /dev...
[    2.672389] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:63:b4:31
[    2.697405] fuse init (API version 7.23)
[    2.713401] systemd[1]: Started udev Coldplug all Devices.
[    2.716106] systemd[1]: Started Increase datagram queue length.
[    2.717215] systemd[1]: Mounted Debug File System.
[    2.718165] systemd[1]: Mounted POSIX Message Queue File System.
[    2.734071] i2c /dev entries driver
[    2.738256] systemd[1]: Started Load Kernel Modules.
[    2.768505] systemd[1]: Started Restore / save the current clock.
[    2.778813] systemd[1]: Time has been changed
[    2.803084] systemd[1]: Started Create Static Device Nodes in /dev.
[    2.832915] systemd[1]: Starting udev Kernel Device Manager...
[    2.868085] systemd[1]: Mounting FUSE Control File System...
[    2.871085] systemd[1]: Mounting Configuration File System...
[    2.873713] systemd[1]: Starting Apply Kernel Variables...
[    2.876598] systemd[1]: Starting Syslog Socket.
[    2.876892] systemd[1]: Listening on Syslog Socket.
[    2.877100] systemd[1]: Starting Journal Service...
[    2.880757] systemd[1]: Started Journal Service.
[    2.898392] systemd-udevd[129]: starting version 215
[    3.564818] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    4.516700] spi spi0.2: setup: only two native chip-selects are supported
[    4.516725] spi-bcm2835 3f204000.spi: can't setup spi0.2, status -22
[    4.516739] spi_master spi0: spi_device register error /soc/[email protected]/[email protected]
[    4.516756] spi_master spi0: Failed to create SPI device for /soc/[email protected]/[email protected]
[    4.521463] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
[    4.529927] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[    4.578309] CAN device driver interface
[    4.725597] usbcore: registered new interface driver brcmfmac
[    4.856890] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: May 27 2016 00:13:38 version 7.45.41.26 (r640327) FWID 01-df77e4a7
[    4.868008] random: nonblocking pool is initialized
[    4.879449] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
[    4.952911] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
[    4.952943] cfg80211: World regulatory domain updated:
[    4.952953] cfg80211:  DFS Master region: unset
[    4.952962] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    4.952977] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    4.952989] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    4.953002] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[    4.953017] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    4.953032] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[    4.953045] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[    4.953078] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[    4.953103] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[    5.206605] systemd-journald[133]: Received request to flush runtime journal from PID 1
[    6.335864] brcmfmac: brcmf_add_if: ERROR: netdev:wlan0 already exists
[    6.335881] brcmfmac: brcmf_add_if: ignore IF event
[    6.340134] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[    6.340168] brcmfmac: power management disabled
[    6.444890] uart-pl011 3f201000.uart: no DMA platform data
[    6.883548] cfg80211: Regulatory domain changed to country: GB
[    6.883566] cfg80211:  DFS Master region: ETSI
[    6.883572] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    6.883580] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    6.883588] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    6.883595] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[    6.883602] cfg80211:   (5490000 KHz - 5710000 KHz @ 160000 KHz), (N/A, 2700 mBm), (0 s)
[    6.883608] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[    7.278778] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[    7.279307] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    7.760019] Adding 102396k swap on /var/swap.  Priority:-1 extents:4 across:192508k SSFS
[    8.745482] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    8.747151] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
[   11.029766] Bluetooth: Core ver 2.21
[   11.029823] NET: Registered protocol family 31
[   11.029828] Bluetooth: HCI device and connection manager initialized
[   11.029843] Bluetooth: HCI socket layer initialized
[   11.029854] Bluetooth: L2CAP socket layer initialized
[   11.029873] Bluetooth: SCO socket layer initialized
[   11.039867] Bluetooth: HCI UART driver ver 2.3
[   11.039883] Bluetooth: HCI UART protocol H4 registered
[   11.039888] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   11.040007] Bluetooth: HCI UART protocol BCM registered
[   11.197920] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   11.197935] Bluetooth: BNEP filters: protocol multicast
[   11.197952] Bluetooth: BNEP socket layer initialized
DT-related messages from the firmware

Code: Select all

[email protected]:~ $ sudo vcdbg log msg |& grep -v -E "(HDMI|gpioman)"
000982.176: *** Restart logging
000983.416: Read command line from file 'cmdline.txt'
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
001234.695: Loading 'kernel7.img' to 0x8000 size 0x4088d8
001238.346: Kernel trailer DTOK property says yes
001238.360: Kernel trailer DDTK property says yes
001241.347: Loading 'bcm2710-rpi-3-b.dtb' to 0x4108d8 size 0x3e78
001322.720: dtparam: uart0_clkrate=48000000
001336.375: dtparam: spi=off
001344.400: dtparam: audio=on
001371.266: Loaded overlay 'mcp2515-can0'
001371.285: dtparam: oscillator=10000000
001372.060: dtparam: interrupt=25
001439.665: Loaded overlay 'mcp2515-can1'
001439.685: dtparam: oscillator=10000000
001440.462: dtparam: interrupt=24
001512.328: Loaded overlay 'mcp2515-can2'
001512.347: dtparam: oscillator=10000000
001513.147: dtparam: interrupt=23
001591.618: Loaded overlay 'mcp2515-can3'
001591.638: dtparam: oscillator=10000000
001592.438: dtparam: interrupt=22
001722.448: dtparam: arm_freq=1200000000
001769.315: dtparam: core_freq=250000000
001782.192: dtparam: cache_line_size=64
001806.543: Device tree loaded to 0x2effb600 (size 0x4996)
003471.322: vchiq_core: vchiq_init_state: slot_zero = 0xfac80000, is_master = 1
003480.603: TV service:host side not connected, dropping notification 0x00000002, 0x00000002, 0x00000010

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1864
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Fri Nov 04, 2016 9:56 am

I can't help you with your question about the bitrate - I have no CAN bus hardware to try it. I suggest you Google the error message and see where it leads you. I see there are already a few CAN topics in this forum, so perhaps read through those, then create a new topic if you don't see an answer to your question. If you get no responses, I think it is acceptable after a day or two to post a brief link to your topic in other topics, or PM an apparent expert and ask nicely.

The question about multiple overlays is an interesting one, and one without a neat answer. The standard overlay mechanism (i.e. without "__overrides__") doesn't allow a property to be partially modified by an overlay, or for a property to be deleted (which is a problem for boolean properties which are true when present and false when absent). The "__overrides__" node (a Raspberry Pi extension) adds named parameters that when used modify part of an existing property, but that isn't the end of the matter.

Overrides in overlays are only allowed to target properties within the overlay. If you want to modify a property in the base DTB you have to provide a default in the overlay (not strictly true any more), patch it with an override, then the overlay property completely replaces the base property. Our DTBs also include overrides, and they do let you patch properties in the base tree, so I think you have a number of options, in roughly increasing order of complexity:

1) An overlay which adds can-2 - easy, you've got one already.
2) An overlay which adds can-2 and can-3. This is just more cut-and-paste.
3) An overlay which can create either can-2 or can-2 and can-3. This is equivalent to 1 & 2, but with the can-3 section disabled by default (using the "__dormant__" feature - see https://www.raspberrypi.org/documentati ... #part2.2.4).
4) An overlay that just adds more chip selects. To be used in conjunction with 1, 2, or 3 but with the chip select portions removed. This overlay would have to be loaded first.
5) An overlay that adds overrides to the base DTB to conditionally enable more chip selects. I'm not sure this is really better than 4, but I thought I'd mention it as something which is possible. Hint:

Code: Select all

target-path = "/__overrides__";

ivanch10
Posts: 4
Joined: Wed Nov 02, 2016 9:51 am

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Sat Nov 05, 2016 9:37 am

Thanks PhilE! You do help me to understand a lot about overlay. :)

gagan2
Posts: 1
Joined: Thu Mar 02, 2017 6:27 am

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Thu Mar 02, 2017 6:32 am

Hi
I need to design one FPGA based card to connect with Raspberry pi 2/3, the communication between cards will happen through SPI Interface. I want to know about the maximum throughput of data which can be achieved between raspberry and FPGA.If anybody have done this testing, please share the results.

Thanks in advance.

inches
Posts: 16
Joined: Tue May 03, 2016 7:55 pm

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Tue Apr 04, 2017 4:20 pm

PhilE wrote:I'm sorry, but that isn't possible. If you download the BCM2835 ARM Peripherals documentation from here and turn to pages 102-103 you will see a map of the alternate functions available on each GPIO pin. The I2S functions are labelled as PCM, and appear in two groups - 18-21 and 28-31. Later Models A and B use 28-31 brought out onto a separate header (P5), but the Pluses and Pi 2 use 18-21 for I2S, the other group being used for I2C and as GPIOs to control on-board devices.

So the declarations of pin usage in Device Tree has prevented you from making a configuration error. By not enabling I2S you would be able to use GPIO18, and vice-versa, but you can't have both. (I realise you may know this, but not all readers will.)
If you change the config to is2_arm=on I'm assuming it uses 18-21. How does one enable I2S on pins 28-31 rather than the default 18-21?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1864
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Optional interfaces (I2C, I2S, SPI) and Device Tree

Tue Apr 04, 2017 4:27 pm

By changing the contents of i2s_pins in the DTB. Normally I would say you need to write an overlay, but somebody has already done that for you:

Code: Select all

dtoverlay=i2s-gpio28-31

jgdye
Posts: 3
Joined: Wed Aug 15, 2012 1:35 am

Re: STICKY: Optional interfaces (I2C, I2S, SPI) and Device Tree

Mon Dec 04, 2017 7:42 pm

I'm trying to scrounge some extra GPIO pins, and have a design with a single SPI write-only device. Is there a way to tell the device tree to allow CE1 to be GPIO while still using CE0? Are there any pins I could direct it to instead, given that I will not be using the camera or display headers? Similarly, and I expect the answer to this is no, can I force MISO to be a GPIO since I know that the device will never send information?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1864
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: STICKY: Optional interfaces (I2C, I2S, SPI) and Device Tree

Mon Dec 04, 2017 8:42 pm

None of the standard overlays will give you a single CS for SPI0, but it's easy enough to cut down the existing spi0-cs overlay:

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

	[email protected] {
		target = <&spi0_cs_pins>;
		frag0: __overlay__ {
			brcm,pins = <8>;
		};
	};

	[email protected] {
		target = <&spi0>;
		frag1: __overlay__ {
			cs-gpios = <&gpio 8 1>,;
			status = "okay";
		};
	};

	__overrides__ {
		cs0_pin  = <&frag0>,"brcm,pins:0",
			   <&frag1>,"cs-gpios:4";
	};
};
Call it "spi0-1cs-overlay.dts" and compile it with:

Code: Select all

dtc [email protected] -I dts -O dtb -o spi0-1cs.dtbo spi0-1cs-overlay.dts
For the second half of your question, the SPI driver doesn't actually know whether its signals have been mapped to any pins. The "spi0_pins" node in the DTB tells pinctrl to select them on behalf of spi0, but we can change the contents of that node:

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

	[email protected] {
		target = <&spi0_pins>;
		__overlay__ {
			brcm,pins = <10 11>;
		};
	};
};
This overlay will release GPIO9 from MISO duties, but I can't guarantee that the SPI interface will be happy about it.

Oh, and if you want to combine the two overlays, just copy "[email protected]" in the second overlay to "[email protected]" in the first.

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: DEADMOON and 9 guests