Jump to content

Enable SPI1 at Orange PI WIN (Plus)


kimberlite

Recommended Posts

Hello, dear users and developers. Could you help me to enable SPI1 subsystem and use the corresponding device file /dev/spi... to test/probe SPI communications on my Orange Pi Win (Plus) machine?
For the sake of that I am ready go migrate from currently good for me and quite fresh "raspbian for orange pi" where I've already implemented about 95% of required functionality. And it seems the only place where I can talk to people about SPI stuff in ready linux distributions is right here. I actually read here about some SPI issues on Orange Pi Zero but I have some troubles at getting possible packages to experiment at my current distribution and I am not skilled,at all, at knowing which particular actions are required from me on Armbian.

Accorting to schematics (which is of not ideal accuracy at all) of OrangePi WIN,  I understand that SPI0 is engaged in emmc communication and is not accessible from the environment.
So the only possibility is to access and use SPI1 lines from external port pins.


Next, I see that SPI1 is not standalone but shared with UART4.
PD2/LCD-D4/UART4-TX/SPI1-MOSI/CCIR-HSYNC
PD3/LCD-D5/UART4-RX/SPI1-MISO/CCIR-VSYNC
and UART3 (SPI1-CS,CLK : PDO-PD1) 
But I see, as well, for ext port UART3 is already configured and enabled alternatively ( "PH4", "PH5", "PH6", "PH7").

If to open device tree (at current armbian 5.41 or at other "device-tree"- featured distribution)
we can see there is no actually conflicts between UART4 and SPI1
            uart4@0 {
                linux,phandle = <0xa6>;
                phandle = <0xa6>;
                allwinner,pins = "PD2", "PD3", "PD4", "PD5";
                allwinner,function = "uart4";
                allwinner,pname = "uart4_tx", "uart4_rx", "uart4_rts", "uart4_cts";
                allwinner,muxsel = <0x3>;
                ...
            };

            spi1@0 {
                ...
                allwinner,pins = "PD0";
                ...
                allwinner,muxsel = <0x4>;
                ...
            };
            spi1@1 {
                ...
                allwinner,pins = "PD1", "PD2", "PD3";
                allwinner,function = "spi1";
                allwinner,pname = "spi1_sclk", "spi1_mosi", "spi1_miso";
                allwinner,muxsel = <0x4>;
                ...
            };

And both devices are currently disabled in system
        uart@01c29000 {
            compatible = "allwinner,sun50i-uart";
            device_type = "uart4";
            reg = <0x0 0x1c29000 0x0 0x400>;
            interrupts = <0x0 0x4 0x4>;
            clocks = <0x24>;
            pinctrl-names = "default", "sleep";
            pinctrl-1 = <0x26>;
            uart4_port = <0x4>;
            uart4_type = <0x4>;
            status = "disabled";
            pinctrl-0 = <0xa6>;
        };
        spi@01c69000 {
            #address-cells = <0x1>;
            #size-cells = <0x0>;
            compatible = "allwinner,sun50i-spi";
            device_type = "spi1";
            reg = <0x0 0x1c69000 0x0 0x1000>;
            interrupts = <0x0 0x42 0x4>;
            clocks = <0x4 0x56>;
            clock-frequency = <0x5f5e100>;
            pinctrl-names = "default", "sleep";
            pinctrl-1 = <0x59>;
            spi1_cs_number = <0x1>;
            spi1_cs_bitmap = <0x1>;
            status = "disabled";
            pinctrl-0 = <0xa9 0xaa>;
        };


So. For ARMBIAN (5.41) the only action I do is changing status "disabled" to "okay" for SPI in /boot/dtb/sun50iw1p1-orangepiwin.dts and compiling it again to the .dtb file.
After booting the system and  modprobing spidev, I actually see the spidev module is loaded and I still do not see /dev/spidevX.X device file.
Could you please suggest about next steps to proceed. 
Thank you very much.

 

Link to comment
Share on other sites

I was struggling to enable the SPI one my board too.

However i've found this tutorial that explain how to properly enable the SPI on the Pine64, which seem to work as well on the OrangePi Win+

 

http://synfare.com/599N105E/hwdocs/pine64/spidev.html

 

Because i have no access to SPI devices excepted my LoRa Gateway, i was not able to properly test the SPI Bus. Could you test if for me ?

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