doceme / py-spidev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FileNotFoundError: [Errno 2] No such file or directory

tarantelot opened this issue · comments

Do I have this error because of the incorrect path specified in spidev_module.c. The default path to look for devices is dev/spidevX.Y, whereas my appear at /sys/bus/spi/devices/spiX.Y.

commented

i came across the same error because i forgot to enable SPI in the Raspberry Pi settings

/sys/bus/spi/devices/spiX.Y are sysfs entries which indicate that one or more SPI bus master devices are present, and have SPI controller drivers loaded and bound to them, with the corresponding chip-select lines configured (bus X and chipselect Ys in your example).

If you don't have spidev devices, then either udev hasn't created them on your system (because of a deliberate or accidental misconfiguration), or (more likely) because the spidev driver is not bound to any SPI peripheral devices. It used to be possible to do this using devicetree rules, or using dynamic binding (e.g. using udev rules). More recent kernels have deprecated the devicetree mechanisms, so udev rules should be used.