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..