• ...
  • base images
  • SDK
  • ...
  • ...
  • tools
  • premade packages

How to use SPI#

Kernel drivers#

Kernel driver is recommended way of interacting with SPI device. If kernel driver for particular SPI device exists and compiled in or compiled as a module, device should be claimed automatically. To check what devices are detected by kernel you can explore following sysfs path:

$ ls -la /sys/bus/spi/devices/
drwxr-xr-x    2 root     root             0 Apr 28 17:42 .
drwxr-xr-x    4 root     root             0 Apr 28 17:42 ..
lrwxrwxrwx    1 root     root             0 Apr 28 17:42 spi0.0 -> ../../../devices/platform/soc@0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0
lrwxrwxrwx    1 root     root             0 Apr 28 17:42 spi1.0 -> ../../../devices/platform/soc@0/30800000.bus/30820000.spi/spi_master/spi1/spi1.0
lrwxrwxrwx    1 root     root             0 Apr 28 17:42 spi1.1 -> ../../../devices/platform/soc@0/30800000.bus/30820000.spi/spi_master/spi1/spi1.1
lrwxrwxrwx    1 root     root             0 Apr 28 17:42 spi2.0 -> ../../../devices/platform/soc@0/30800000.bus/30830000.spi/spi_master/spi2/spi2.0
lrwxrwxrwx    1 root     root             0 Apr 28 17:42 spi2.1 -> ../../../devices/platform/soc@0/30800000.bus/30830000.spi/spi_master/spi2/spi2.1