SPIDEV not found in ARMBIAN with BPI M2z

Hello, I am trying to work with SPI in my BPI M2Z. With Raspbian, I have no problems with SPI. With several ARMBIAN images, I do not see the SPIDEV port in /dev folder, I have try many things however nothing works. With ‘lsmod’ I can see that the SPIDEV is loaded. In the boot process I can see that the overlays a fixup script are loaded correctly:

Found mainline kernel configuration
34107 bytes read in 11 ms (3 MiB/s)
478 bytes read in 9 ms (51.8 KiB/s)
Applying kernel provided DT overlay sun8i-h3-cpu-clock-1.2GHz-1.3v.dtbo
374 bytes read in 10 ms (36.1 KiB/s)
Applying kernel provided DT overlay sun8i-h3-i2c0.dtbo
788 bytes read in 10 ms (76.2 KiB/s)
Applying kernel provided DT overlay sun8i-h3-spi-spidev.dtbo
502 bytes read in 11 ms (43.9 KiB/s)
Applying kernel provided DT overlay sun8i-h3-uart1.dtbo
502 bytes read in 11 ms (43.9 KiB/s)
Applying kernel provided DT overlay sun8i-h3-uart2.dtbo
502 bytes read in 10 ms (48.8 KiB/s)
Applying kernel provided DT overlay sun8i-h3-uart3.dtbo
504 bytes read in 10 ms (48.8 KiB/s)
Applying kernel provided DT overlay sun8i-h3-usbhost0.dtbo
504 bytes read in 10 ms (48.8 KiB/s)
Applying kernel provided DT overlay sun8i-h3-usbhost1.dtbo
504 bytes read in 10 ms (48.8 KiB/s)
Applying kernel provided DT overlay sun8i-h3-usbhost2.dtbo
504 bytes read in 10 ms (48.8 KiB/s)
Applying kernel provided DT overlay sun8i-h3-usbhost3.dtbo
4185 bytes read in 10 ms (408.2 KiB/s)
Applying kernel provided DT fixup script (sun8i-h3-fixup.scr)

This is writen in my armbianEnv.txt file:

overlays=i2c0 spi-spidev uart3 usbhost0 usbhost1 usbhost2 usbhost3

param_spidev_spi_bus=0

param_spidev_spi_cs=0


dmesg | grep spi

[    6.679088] spidev spi0.0: probing from DT

I have try to work with spi_bus=1 and spi_cs=1. I have try to change the spidev.dtbo files

Someone have any idea how to make SPI bus works in Banana Pi M2 Zero?

Use Armbian forum for support. Hint: switch to kernel 5.10.y since it most recent few functions broke down.

Dear Igor,

Thank you for your reply.

I have also write a post in ARMBIAN forum:

https://forum.armbian.com/topic/20091-spidev-dissappeared-on-armbian-2202-bullseye-51526/#comment-137159

https://forum.armbian.com/topic/18939-i-am-starting-out-with-a-bananpi-pro-im-a-newbie-to-linux-troubleshooting-why-are-some-dt-overlays-not-loading-on-boot/#comment-137224

I have finally found a solution. The solution is to use a old ARMBIAN version and not upgrade it. Now, I am using the image: “Armbian_20.02.3_Bananapim2zero_bionic_current_5.4.18” Now, SPI is working. I can not upgrade this image because if I upgrade the OS, SPI will not work anymore. I have tested it. Thanks

You don’t need to use that ancient image and you can upgrade system. Just freeze kernel upgrades in armbian-config

Kernel 5.10.y is also good.

hello friend I had the same problem a while ago so I decided to create my own images based on ubuntu

Focal armbian 21.08.0 Kernel 5.15.25

If you like, you can download them from my git. I also made a script and step-by-step configuration of gpio pins so that you can use them. All i2c, spi, uart and gpio interfaces work.

you go to the download section and there are all these ubuntu base

others here I leave you the video that wase in case you do not understand the script very well.

Hello Roxas, hola,

Thank you for your work. It has been very useful for me. After testing the oficial Banana Pi Image, I began to use your images. I have seen your Youtube videos and follow your scripts. Very good job! However, all my problems with SPI have been using your images. I have try several images with ARMBIAN. Finally, I used: Armbian_21.11.0-trunk_Bananapim2zero_focal_current_5.10.75_minimal 05-11-2021 and I configured it manually because your automatic script did’t work automatically. As I told you before, I had to change to an old ARMBIAN version in order to make SPI to work. Now, I am happy because I can control displays with the driver ILI9225.

1 Like

Hello friend, I am glad that my work and the images have been useful to you and if you are right, by default in my script the spi is not enabled and I have not thought to show its function, but I am glad that it will be useful for you to configure and use the spi :smile:

Hey there. How exactly does one enable SPI? Can you point me at some instructions as I’m drawing a blank after hours of searching.

Thanks a LOT in advance

sudo armbian-config

System–>Hardware–>spi-spidev

1 Like

Thanks! I’d tried this but it was still not working. I got it working by activating as you describe AND editing /boot/armbianEnv.txt and adding the entries:

 param_spidev_spi_bus=0
 param_spidev_max_freq=100000000