luma.core.error.DeviceNotFoundError:找不到SPI设备

时间:2018-08-29 15:57:09

标签: python raspberry-pi3 gpio i2c led

我正在尝试在树莓派PI3上使用MAX7219设置新的点矩阵MCU LED显示模块8x32。

我遵循了https://max7219.readthedocs.io/en/0.2.3/的所有步骤,当然也使用了他们建议的针脚。

当我午餐吃测试样品时:

sudo python examples/matrix_demo.py

然后我将收到一个永远不会启动示例测试的错误:

Traceback (most recent call last):
  File "examples/matrix_demo.py", line 120, in <module>
    demo(args.cascaded, args.block_orientation, args.rotate)
  File "examples/matrix_demo.py", line 20, in demo
    serial = spi(port=0, device=0, gpio=noop())
  File "/usr/local/lib/python2.7/dist-packages/luma.core-1.7.2-py2.7.egg/luma/core/interface/serial.py", line 263, in __init__
    raise luma.core.error.DeviceNotFoundError('SPI device not found')
luma.core.error.DeviceNotFoundError: SPI device not found

问题不是luma.core,因为它存在:

luma.core                1.7.2     
luma.led-matrix          1.0.8

使用命令lsmod | grep -i spi,答案是:

spidev                  7373  0 
spi_bcm2835             7596  0 

命令ls -l /dev/spi*的答案是:

crw-rw---- 1 root spi 153, 0 Aug 29 17:17 /dev/spidev0.1

我还附上对find /sys/bus | grep spi

的回复
/sys/bus/platform/devices/3f204000.spi
/sys/bus/platform/drivers/spi-bcm2835
/sys/bus/platform/drivers/spi-bcm2835/bind
/sys/bus/platform/drivers/spi-bcm2835/unbind
/sys/bus/platform/drivers/spi-bcm2835/module
/sys/bus/platform/drivers/spi-bcm2835/uevent
/sys/bus/platform/drivers/spi-bcm2835/3f204000.spi
/sys/bus/spi
/sys/bus/spi/drivers_probe
/sys/bus/spi/devices
/sys/bus/spi/devices/spi0.0
/sys/bus/spi/devices/spi0.1
/sys/bus/spi/uevent
/sys/bus/spi/drivers
/sys/bus/spi/drivers/spidev
/sys/bus/spi/drivers/spidev/bind
/sys/bus/spi/drivers/spidev/unbind
/sys/bus/spi/drivers/spidev/spi0.1
/sys/bus/spi/drivers/spidev/module
/sys/bus/spi/drivers/spidev/uevent
/sys/bus/spi/drivers/stmpe-spi
/sys/bus/spi/drivers/stmpe-spi/bind
/sys/bus/spi/drivers/stmpe-spi/unbind
/sys/bus/spi/drivers/stmpe-spi/uevent
/sys/bus/spi/drivers/fb_st7735r
/sys/bus/spi/drivers/fb_st7735r/spi0.0
/sys/bus/spi/drivers/fb_st7735r/bind
/sys/bus/spi/drivers/fb_st7735r/unbind
/sys/bus/spi/drivers/fb_st7735r/module
/sys/bus/spi/drivers/fb_st7735r/uevent
/sys/bus/spi/drivers_autoprobe

这是我的/boot/config.txt

 For more options and information see
# http://rpf.io/configtxtreadme
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
dtparam=i2c1=on
#dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
enable_uart=1

0 个答案:

没有答案