M. Hatef Posted Wednesday at 06:50 PM Posted Wednesday at 06:50 PM (edited) Hi I have spent couple of days to enable the SPI3 (the only SPI that has been routed to the 40-pin header) on Rock3A, but no success. I am trying to enable SPI3M1C0 with following pins on my Rock 3A GPIO4_C2 (CLK), GPIO4_C3 (MOSI), GPIO4_C5 (MISO), and GPIO4_C6 (CS0). I am out of idea, try different overlays but still not able to enable them. I used this overlay from this repo https://github.com/radxa/overlays/blob/main/arch/arm64/boot/dts/rockchip/overlays/rk3568-spi3-m1-cs0-spidev.dts I expect to see “/dev/spidev3.0” but nothing appeared. I have already added 2 overlays, 1 for 1-wire, and the other for I2C, and they are working now. Here some info from my Rock3A: root@rock-3a:~# uname -a Linux rock-3a 6.12.19-current-rockchip64 #2 SMP PREEMPT Thu Mar 13 12:02:20 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux rroot@rock-3a:~# cat /boot/armbianEnv.txt verbosity=1 bootlogo=false console=both extraargs=cma=256M overlay_prefix=rk35xx fdtfile=rockchip/rk3568-rock-3a.dtb rootdev=UUID=8a5d56b7-1e1b-49b6-8384-5ef8a0460c96 rootfstype=ext4 overlays=rockchip-rk3568-spi3-m1-cs0-spidev param_spidev_spi_bus=3 param_spidev_max_freq=10000000 user_overlays=rk3568-i2c3m0-enable rk3568-w1-gpio3-a2 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u root@rock-3a:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Armbian 25.2.3 noble Release: 24.04 Codename: noble # nothinig shown in the kernel log root@rock-3a:~# dmesg | grep -i spi [ 0.000000] GICv3: 320 SPIs implemented [ 0.000000] GICv3: 0 Extended SPIs implemented root@rock-3a:~# lsmod | grep -i spi spidev 24576 0 spi_rockchip_sfc 16384 0 root@rock-3a:~# ls -d /proc/device-tree/spi* /proc/device-tree/spi@fe300000 /proc/device-tree/spi@fe610000 /proc/device-tree/spi@fe620000 /proc/device-tree/spi@fe630000 /proc/device-tree/spi@fe640000 # this is from my live dts. it shows the SPI is enabled, but I still cannot see it in my file system "/dev/spi*" spi@fe640000 { pinctrl-names = "default\0high_speed"; #address-cells = <0x01>; pinctrl-0 = <0x22e 0x22d>; clock-names = "spiclk\0apb_pclk"; interrupts = <0x00 0x6a 0x04>; clocks = <0x0f 0x158 0x0f 0x157>; #size-cells = <0x00>; dma-names = "tx\0rx"; compatible = "rockchip,rk3568-spi\0rockchip,rk3066-spi"; pinctrl-1 = <0x22e 0x264>; status = "okay"; max-freq = <0x2faf080>; reg = <0x00 0xfe640000 0x00 0x1000>; phandle = <0x12b>; dmas = <0x27 0x1a 0x27 0x1b>; spidev@0 { spi-max-frequency = <0x2faf080>; compatible = "rockchip,spidev"; status = "okay"; reg = <0x00>; }; }; root@rock-3a:~# ls -tlhr /dev/spi* ls: cannot access '/dev/spi*': No such file or directory would be appreciate it if anyone can help. Thanks Edited Wednesday at 07:14 PM by M. Hatef 0 Quote
Werner Posted 23 hours ago Posted 23 hours ago 9 hours ago, M. Hatef said: overlay from this repo These overlays are most likely not made to be used with mainline kernel. I suggest to retry with vendor kernel. Standard overlays for it have been pushed yesterday:https://github.com/armbian/linux-rockchip/pull/345/files 0 Quote
M. Hatef Posted 21 hours ago Author Posted 21 hours ago @Werner Thanks, I compiled the one from the mainline kernel you shared. I am still not seeing anything on /dev/spi* I also hooked up the serial debugger to collect kernel logs I cannot see any issue with loading the overlay. here is the kernel log snippet ## Executing script at 00c00000 Boot script loaded from mmc 1:1 reading /armbianEnv.txt 499 bytes read in 2 ms (243.2 KiB/s) reading /uInitrd 23359976 bytes read in 1938 ms (11.5 MiB/s) reading /Image 37335552 bytes read in 3095 ms (11.5 MiB/s) reading /dtb/rockchip/rk3568-rock-3a.dtb 124861 bytes read in 17 ms (7 MiB/s) reading /overlay-user/rk3568-spi3-m1-cs0-spidev.dtbo 1053 bytes read in 3 ms (342.8 KiB/s) Applying user provided DT overlay rk3568-spi3-m1-cs0-spidev.dtbo reading /overlay-user/rk3568-i2c3m0-enable.dtbo 398 bytes read in 2 ms (194.3 KiB/s) Applying user provided DT overlay rk3568-i2c3m0-enable.dtbo Trying kaslrseed command... Info: Unknown command can be safely ignored since kaslrseed does not apply to all boards. Unknown command 'kaslrseed' - try 'help' Fdt Ramdisk skip relocation No misc partition looks like it was successfully read and applied. but still there is no SPI device available. Here is my armbianEnv.txt for reference. I am not sure what I am missing. verbosity=1 bootlogo=false console=both extraargs=cma=256M overlay_prefix=rk35xx fdtfile=rockchip/rk3568-rock-3a.dtb rootdev=UUID=8a5d56b7-1e1b-49b6-8384-5ef8a0460c96 rootfstype=ext4 #overlays=rockchip-rk3568-spi3-m1-cs0-spidev #param_spidev_spi_bus=3 #param_spidev_max_freq=10000000 param_spidev_spi_bus=1 #user_overlays=rk3568-i2c3m0-enable rk3568-w1-gpio3-a2 rk3568-spi3-m1-cs0-spidev user_overlays=rk3568-spi3-m1-cs0-spidev rk3568-i2c3m0-enable usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u 0 Quote
Werner Posted 16 hours ago Posted 16 hours ago Hi Providing logs with PASTE_SERVER_HOST=paste.armbian.de armbianmonitor -u helps with troubleshooting and significantly raises chances that issue gets addressed. 0 Quote
M. Hatef Posted 11 hours ago Author Posted 11 hours ago Hi @Werner I ran the command, it looks like it uploads multiple kernel boot log. so I the most bottom one is the last kernel log I am dealing with. https://paste.armbian.de/fexaxufalu Last night, I played with dts, and I got the SPI3 enumerated at /dev/spi3. but it still not working. I mean when I run a script to use the SPI3, I cannot see any clock gets generated on SPI3.CLK. Here is the dts file: (venv) root@rock-3a:~# cat my-spi3-overlay.dts /dts-v1/; /plugin/; / { compatible = "rockchip,rk3568"; /* Update to match your SoC */ fragment@0 { target = <&spi3>; /* Correct SPI3 node */ __overlay__ { #address-cells = <1>; #size-cells = <0>; pinctrl-names = "default"; pinctrl-0 = <&spi3m1_pins>; /* Reference correct pin configuration */ status = "okay"; /* Enable SPI3 */ spidev@0 { compatible = "armbian,spi-dev"; reg = <0x00>; spi-max-frequency = <5000000>; status = "okay"; }; }; }; fragment@1 { target = <&pinctrl>; /* Ensure this matches your pin controller node */ __overlay__ { spi3m1_pins: spi3m1-pins { rockchip,pins = < 4 18 3 0 /* GPIO4_C2 as SPI3_CLK_M1 */ 4 19 3 0 /* GPIO4_C3 as SPI3_MOSI_M1 */ 4 21 3 0 /* GPIO4_C5 as SPI3_MISO_M1 */ 4 22 3 0 /* GPIO4_C6 as SPI3_CS0_M1 */ >; }; }; }; }; here is the armbianEnv.txt (venv) root@rock-3a:~# cat /boot/armbianEnv.txt verbosity=1 bootlogo=false console=both extraargs=cma=256M overlay_prefix=rk35xx fdtfile=rockchip/rk3568-rock-3a.dtb rootdev=UUID=8a5d56b7-1e1b-49b6-8384-5ef8a0460c96 rootfstype=ext4 #overlays=rockchip-rk3568-hk-spi-spidev user_overlays=rk3568-i2c3m0-enable rk3568-w1-gpio3-a2 my-spi3-overlay param_spidev_spi_bus=1 param_spidev_max_freq=1000000 param_spidev_spi_cs=0 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u Here is the logic analyzer output while the script was running. noted CS pin is alway Low and other pins are always High no matter what I am running the script. I have also attached the script that I am running to test out the SPI3 adc_reader.py 0 Quote
Solution M. Hatef Posted 8 hours ago Author Solution Posted 8 hours ago ok I got it working by modifying my dts file. I am sharing it here for those who face the issue. So you dont have to waste days while pulling your hairs /dts-v1/; /plugin/; / { compatible = "rockchip,rk3568"; /* Update to match your SoC */ fragment@0 { target = <&spi3>; /* Correct SPI3 node */ __overlay__ { #address-cells = <1>; #size-cells = <0>; pinctrl-names = "default"; pinctrl-0 = <&spi3m1_pins &spi3m1_cs0>; /* Reference correct pin configuration */ status = "okay"; /* Enable SPI3 */ spidev@0 { compatible = "armbian,spi-dev"; reg = <0x00>; spi-max-frequency = <5000000>; status = "okay"; }; }; }; }; 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.