Jump to content

Orangepi zero mainline kernel both spi cs pins on spi1


Dolf Andringa

Recommended Posts

Armbianmonitor:

I want to drive 2 SPI devices on my orangepi zero. I enabled `spi-spidev` and `spi-add-cs1` overlays and set `param_spidev_spi_bus` to 1. But by I still get only `/dev/spi1.0` available. When I add `param_spidev_spi_cs=1`, I get `/dev/spi1.1` but `/dev/spi1.0` disappears. Do I see it correctly that I can choose *either* `/dev/spi1.0` *or* `/dev/spi1.1` but not both with that overlay?

How can I activate both cs pins? There are a bunch of example custom files out there, but none are meant specifically for the setup where I need spi1 (instead of spi0) and need to use a GPIO pin for cs1. And I can't really find any docs on how to write my own overlay. So any help is appreciated.

 

Link to comment
Share on other sites

OK, lol, I figured it out.

 

I created a file (in my homedir on the orangepi) called spi-double-spidev-cs.dt` with the folliowing content:

/dts-v1/;
/plugin/;

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

        fragment@0 {
                target = <&spi1>;
                __overlay__ {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        status = "okay";

                        spidev@0 {
                                reg = <0>; /* Chip Select 0 */
                                compatible = "spidev";
                                spi-max-frequency = <1000000>;
                                status = "okay";
                        };

                        spidev@1 {
                                reg = <1>; /* Chip Select 1 */
                                compatible = "spidev";
                                spi-max-frequency = <1000000>;
                                status = "okay";
                        };
                };
        };
};

 

 

Then I enabled that overlay with `armbian-add-overlay spi-double-spidev-cs.dts`. This automatically compiles the overlay and adds it to `/boot/armbianEnv.txt`. Just make sure you add the following parameter to `/boot/armbianEnv.txt` as well:

param_spidev_spi_bus=1

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines