Hello,
I’m upgrading a Beaglebone Green from a Debian 9 image to Debian 12 image. I am mainly concerned with SPI0 /dev/spidev0.0
on Debian 12. The Debian 9 version seemed to have no issue accessing SPI. I’m not sure how this initial configuration was created, if it was out of the box or not, but the permissions are below:
crw-rw---- 1 root spi 153, 1 Feb 26 20:00 /dev/spidev1.0
crw-rw---- 1 root spi 153, 0 Feb 26 20:00 /dev/spidev1.1
crw-rw---- 1 root spi 153, 3 Feb 26 20:00 /dev/spidev2.0
crw-rw---- 1 root spi 153, 2 Feb 26 20:00 /dev/spidev2.1
In particular, the group is spi
and permissions for the group are read and write, and this is what appears on boot without running extra commands. I have no issue using the python spidev library to write or read bytes through SPI0.
As for SPI0 on Debian 12, or rather any of the SPI bus/devices, I’m having permission errors in userspace. I have not applied any device tree overlays other than the default, and my kernel and u-boot are the default as well, from the 12.2 Debian image. Upon initial boot, the permissions are:
crw------- 1 root root 153, 0 Oct 7 20:10 /dev/spidev0.0
crw------- 1 root root 153, 1 Oct 7 20:10 /dev/spidev0.1
crw------- 1 root root 153, 2 Oct 7 20:10 /dev/spidev1.0
crw------- 1 root root 153, 3 Oct 7 20:10 /dev/spidev1.1
I can successfully read and write on SPI0 (spidev0.0
) if I perform these commands:
sudo groupadd spi
sudo adduser debian spi
sudo chgrp spi /dev/spidev0.0
sudo chmod 660 /dev/spidev0.0
and get
crw-rw---- 1 root spi 153, 0 Oct 7 20:10 /dev/spidev0.0
However, upon reboot, the permissions revert back to the root
group without read/write in userspace.
Is there a way to make these userspace permissions stick without using something like a service that would trigger on boot to run the commands above? Is there some kernel config (CONFIG_*
) option(s) I can recompile the kernel with in order to enable SPI0 reads and writes in userspace?
Thanks for the help.