Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SPI on Orange Pi Zero H2+

Featured Replies

Hi all.

I have problem with SPI on my board .

I find solution but I want to know why .. 

On first :

Linux orangepizero 5.4.20-sunxi #20.02.1 SMP Mon Feb 17 02:09:41 CET 2020 armv7l armv7l armv7l GNU/Linux

If go to armbian-config and enable SpiDev .. then reboot not find SPI device on my dev tree ..

if look to armbianEnv.txt there is spi-spidev but on dev tree no SPI device ..

My solution is this :

on /boot/dtb/overlay is file sun8i-h3-spi-spidev.dtbo , decompile it and there is this text :

/dts-v1/;
/plugin/;

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

	fragment@0 {
		target-path = "/aliases";
		__overlay__ {
			spi0 = "/soc/spi@01c68000";
			spi1 = "/soc/spi@01c69000";
		};
	};

	fragment@1 {
		target = <&spi0>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			spidev {
				compatible = "spidev";
				status = "disabled";
				reg = <0>;
				spi-max-frequency = <1000000>;
			};
		};
	};

	fragment@2 {
		target = <&spi1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			spidev {
				compatible = "spidev";
				status = "disabled";
				reg = <0>;
				spi-max-frequency = <1000000>;
			};
		};
	};
};

I don't know why  but if change text to this :

/dts-v1/;
// magic:               0xd00dfeed
// totalsize:           0x314 (788)
// off_dt_struct:       0x38
// off_dt_strings:      0x2b4
// off_mem_rsvmap:      0x28
// version:             17
// last_comp_version:   16
// boot_cpuid_phys:     0x0
// size_dt_strings:     0x60
// size_dt_struct:      0x27c

/ {
    compatible = "allwinner,sun8i-h3";
    fragment@0 {
        target-path = "/aliases";
        __overlay__ {
            spi0 = "/soc/spi@1c68000";
            spi1 = "/soc/spi@1c69000";
        };
    };
    fragment@1 {
        target = <0xffffffff>;
        __overlay__ {
            status = "okay";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            spidev@0 {
                compatible = "spidev";
                reg = <0x00000000>;
                spi-max-frequency = <0x000f4240>;
            };
        };
    };
    fragment@2 {
        target = <0xffffffff>;
        __overlay__ {
            status = "okay";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            spidev@0 {
                compatible = "spidev";
                reg = <0x00000000>;
                spi-max-frequency = <0x000f4240>;
            };
        };
    };
    __fixups__ {
        spi0 = "/fragment@1:target:0";
        spi1 = "/fragment@2:target:0";
    };
};

and recompile then all working ..

on my dev tree I see two devices:

crw-rw---- 1 root spidev 153, 0 Mar  8 16:55 /dev/spidev0.0
crw-rw---- 1 root spidev 153, 1 Mar  8 16:55 /dev/spidev1.0
 

 I test it on my Osciloscope and see signal , then I connect MISO wit MOSI and make test with spidev-test and work ..

now I connect real SPI device (any radio nRF24L01 or similar .. and try real test..

 

question is why I must do this ???

what is wrong??

 

best regards..

 

Edited by Sevc Dominik

  • Author

On line status = "disabled" change to "okay" and move line to different position then works..

Edited by Sevc Dominik

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.