kreestyahn Posted July 1 Posted July 1 Hello, I have connected a microSD module to the SPI1 CS0 pins Is there a way to mount an SPI device? I tried, but I got this error: mount: /mnt/sdcard: /dev/spidev1.0 is not a block device. What is the best way to easily manage files on this secondary SD card? 0 Quote
going Posted July 1 Posted July 1 12 минут назад, kreestyahn сказал: I have connected a microSD module to the SPI1 CS0 pins Can you publish the connection diagram of this device. What's in the brief? 15 минут назад, kreestyahn сказал: Is there a way to mount an SPI device? First, you need to write an overlay for the DTS. Compile it and add it to /boot/dtb*/overlay, and a line to load into armbianEnv.txt the file. After that, the SD card will be automatically mounted as /dev/mmcblkXp1 0 Quote
kreestyahn Posted July 1 Author Posted July 1 I have created an sun50i-h616-spi-sd.dts: /dts-v1/; /plugin/; / { compatible = "allwinner,sun50i-h616"; fragment@0 { target = <&spi1>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; mmc@0 { reg = <0>; compatible = "mmc-spi-slot"; voltage-ranges = <3300 3300>; spi-max-frequency = <50000000>; status = "okay"; }; }; }; }; compiled it and added into /boot/dtb/allwinner/overlay orangepiEnv.txt: verbosity=1 bootlogo=false console=both disp_mode=1920x1080p60 overlay_prefix=sun50i-h616 rootdev=UUID=6cd6cb54-48bc-4b6a-a615-2abfb7d74fe0 rootfstype=ext4 overlays=pi-i2c1 spi-sd usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u only the main SD is detected: root@orangepizero2w:/ # ls /dev/mmc* /dev/mmcblk1 /dev/mmcblk1p1 root@orangepizero2w:/ # dmesg | grep -i spi dmesg | grep -i mmc [ 1.415702] spi-nor spi0.0: ZB25VQ128A (16384 Kbytes) [ 1.451348] mmc_spi spi1.0: SD/MMC host mmc0, no WP, no poweroff, cd polling [ 1.451348] mmc_spi spi1.0: SD/MMC host mmc0, no WP, no poweroff, cd polling [ 1.482498] sunxi-mmc 4021000.mmc: allocated mmc-pwrseq [ 1.482663] sunxi-mmc 4020000.mmc: Got CD GPIO [ 1.508525] sunxi-mmc 4020000.mmc: initialized, max. request size: 16384 KB, uses new timings mode [ 1.546705] mmc1: host does not support reading read-only switch, assuming write-enable [ 1.548649] mmc1: new high speed SDHC card at address 0001 [ 1.549859] mmcblk1: mmc1:0001 EITSD 7.50 GiB [ 1.552553] mmcblk1: p1 [ 1.712888] sunxi-mmc 4021000.mmc: initialized, max. request size: 16384 KB, uses new timings mode [ 1.731008] mmc2: new high speed SDIO card at address 8800 [ 3.149516] EXT4-fs (mmcblk1p1): mounted filesystem with writeback data mode. Quota mode: none. [ 6.629778] EXT4-fs (mmcblk1p1): re-mounted. Quota mode: none. Quote Can you publish the connection diagram of this device. What's in the brief? I can't show you the physical connections because the orange pi is built into a custom board that I don't have access to right now, but the microSD module it connected to the SPI1-MOSI, -MISO, -CLK, -CS0 pins. 0 Quote
going Posted July 1 Posted July 1 46 минут назад, kreestyahn сказал: mmc@0 { reg = <0>; Pins are recorded for the mmc0 node dts/allwinner/sun50i-h616.dtsi#L275 bat mmc0_pins: Add fragment0: aliases By analogy with this aliases /omit-if-no-ref/ - This line says that they are missing from your dtb Add fragment1: spi1_pins: spi1_pins: spi1-pins { pins = "PH6", "PH7", "PH8"; function = "spi1"; }; spi1_cs0_pin: spi1-cs0-pin { pins = "PH5"; function = "spi1"; }; Your fragment has now become the third. Add a description of the pins to it by analogy with this: pinctrl-names 0 Quote
kreestyahn Posted July 1 Author Posted July 1 Like this? /dts-v1/; /plugin/; / { compatible = "allwinner,sun50i-h616"; fragment@0 { target-path = "/aliases"; __overlay__ { spi0 = "/soc/spi@5010000"; spi1 = "/soc/spi@5011000"; }; }; fragment@1 { target = <&spi1>; __overlay__ { spi1_pins: spi1-pins { pins = "PH6", "PH7", "PH8"; function = "spi1"; }; spi1_cs0_pin: spi1-cs0-pin { pins = "PH5"; function = "spi1"; }; }; }; fragment@2 { target = <&spi1>; __overlay__ { #address-cells = <1>; #size-cells = <0>; pinctrl-0 = <&spi1_pins>; pinctrl-names = "default", "default"; status = "okay"; mmc@0 { reg = <0>; compatible = "mmc-spi-slot"; voltage-ranges = <3300 3300>; spi-max-frequency = <50000000>; status = "okay"; }; }; }; }; 0 Quote
going Posted July 1 Posted July 1 6 часов назад, kreestyahn сказал: fragment@2 { target = <&spi1>; __overlay__ { #address-cells = <1>; #size-cells = <0>; pinctrl-0 = <&spi1_pins>; pinctrl-names = "default", "default"; status = "okay"; fragment@2 { target = <&spi1>; __overlay__ { #address-cells = <1>; #size-cells = <0>; pinctrl-names = "default", "default"; pinctrl-0 = <&spi1_pins>, <&spi1_cs0_pin>; status = "okay"; And try to experience 0 Quote
kreestyahn Posted July 2 Author Posted July 2 now it looks like this:I replaced the target = <&spi1>; to target-path = </soc/spi@5011000>; because i got errors (Reference to non-existent node or label "spi1"). /dts-v1/; / { compatible = "allwinner,sun50i-h616"; fragment@0 { target-path = "/aliases"; __overlay__ { spi0 = "/soc/spi@5010000"; spi1 = "/soc/spi@5011000"; }; }; fragment@1 { target-path = "/soc/spi@5011000"; __overlay__ { spi1_pins: spi1-pins { pins = "PH6\0PH7\0PH8"; function = "spi1"; }; spi1_cs0_pin: spi1-cs0-pin { pins = "PH5"; function = "spi1"; }; }; }; fragment@2 { target-path = "/soc/spi@5011000"; __overlay__ { #address-cells = <0x01>; #size-cells = <0x00>; pinctrl-names = "default\0default"; pinctrl-0 = <&spi1_pins>, <&spi1_cs0_pin>; status = "okay"; mmc@0 { reg = <0x00>; compatible = "mmc-spi-slot"; voltage-ranges = <0xce4 0xce4>; spi-max-frequency = <0x2faf080>; status = "okay"; }; }; }; }; Now I could compile it without any error, but in /dev there is still only one mmcblk. root@orangepizero2w:allwinner/overlay # dmesg | grep -i 'spi' [ 1.415511] spi-nor spi0.0: ZB25VQ128A (16384 Kbytes) [ 24.548702] platform 5011000.spi: deferred probe pending 0 Quote
kreestyahn Posted July 2 Author Posted July 2 Quote [ 24.548702] platform 5011000.spi: deferred probe pending The error disappears and the SPI1 pins' mode set back to ALT4 when only "spi1-cs0-spidev" overlay is enabled. But if only "spi-sd" or both is enabled it set them back to "OFF" and the error appears. 0 Quote
going Posted July 2 Posted July 2 @kreestyahn Maybe start from the beginning. Disable all overlays. Download the OS. On a running OS, extract the DTS: dtc --sort -I fs -O dts /sys/firmware/devicetree/base > dts-base.txt Connect the overlay. Reboot. On a running OS, the DTS is extracted to another file. Compare. 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.