msperl / rgbled-fb

GNU General Public License v2.0
14 stars 4 forks source link

Complete device tree example #1

Open zeeMonkeez opened 7 years ago

zeeMonkeez commented 7 years ago

Could you give a complete device tree overlay example, please? I modified the snippet to get it to compile and tried to load it on my Raspberry Pi, but there doesn't even seem to be an error ... Thanks for your work!

msperl commented 7 years ago

Wrapping them up should be relatively straight-forward...

/dts-v1/;
/plugin/;

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

        fragment@0 {
                target = <&spi0>;
                __overlay__ {
                        status = "okay";
                };
        };

        fragment@1 {
                target = <&spidev0>;
                __overlay__ {
                        status = "disabled";
                };
        };

        fragment@2 {
                target = <&spidev1>;
                __overlay__ {
                        status = "disabled";
                };
        };

        fragment@3 {
                target = <&spi0>;
                frag1: __overlay__ {
                        /* needed to avoid dtc warning */
                        #address-cells = <1>;
                        #size-cells = <0>;
                        <example from readme.txt>
                };
        };
};

Should do what you need...

zeeMonkeez commented 7 years ago

Thanks, this helped me get the fb device created (is there a way to not having to load he modules by hand / in /etc/modules?). However, using an APA102 matrix, I don't seem to get an output. It is likely a software issue as the same matrix works with this Python library: https://github.com/tinue/APA102_Pi. FWIW, the /OE pins of the level shifter are tied low. I tried to write to /dev/fb1 using https://gist.github.com/rafalrusin/1482697, and can confirm that the write to the fb's memory is successful (it reads back). Any hints for where to start debugging?

msperl commented 7 years ago

If I remember correctly then I have passed both CLK and MOSI thru the 74HCT125 and connected the enable (/OE) to the chip-select.

What else can you do? Check with a logic analyzer if the signal comes thru correctly - an oscilloscope may do it as well...

In principle you should be able to see also the spi counters going up in /sys/class/spi_master/* ...