1

I'm trying to get SPI working on my board. That's what I came up:

  • SPI is not enabled by default in armbian, we need to enable it first (enable corresponding DT overlay)
  • in linux SPI can only be accessed via /dev/spidev*.* files
  • if I don't see any spi devices in my dev folder then SPI is not enabled on my board
  • in the latest versions of armbian spi can be enabled in armbain-config (under System/Hardware/spi-spidev)
  • in previous versions it was needed to decompile /boot/script.bin into fex file,  enable SPI there and compile it back

I did clean install of Armbian Bionic (I also did try Stretch earlier), updated it and enabled spi-spidev,  restarted the board but still got no spidev files. 

Here is my armbianmonitor log. That's how I check if SPI is enabled:

dima@orangepipcplus:~$ cat /boot/armbianEnv.txt
verbosity=1
logo=disabled
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootdev=UUID=09e9478d-c7f2-4b16-a2d7-66f5313ff813
rootfstype=ext4
overlays=spi-add-cs1 spi-jedec-nor spi-spidev
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
dima@orangepipcplus:~$ ls /dev/*spi*
ls: cannot access '/dev/*spi*': No such file or directory

BTW, my goal is to create smart home project with nrf24l01 communication, but I'm stuck on script error that says could not open /dev/spidev0.0 (not exact paste)

So my question is: how to enable spi so that /dev/spidev*.* files will appear?

  • 1
    I would guess you would need to edit a dts compile it to a dtb, then swap it with the one uboot is useing (might need to remake a initial-ram-disk if that is in use, and recompile the kernel) – user1133275 Jan 22 at 21:38
1

Okay, this was really stupid. I just needed to read about Device Tree overlays carefully.

I didn't set the required SPI parameter param_spidev_spi_bus. Here is my armbianEnv.txt now:

verbosity=1
logo=disabled
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootdev=UUID=09e9478d-c7f2-4b16-a2d7-66f5313ff813
rootfstype=ext4
overlays=spi-spidev
param_spidev_spi_bus=0
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

Note that armbain-config does not set this parameter, so you can't get SPI working using this tool only. So for now it's easier just to edit armbianEnv.txt directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.