RPi py-spidev 三线无效参数错误

RPi py-spidev threewire invalid argument error

使用py-spidev, if I set the flag spi.threewire=True I get a response similar to this one时:

Traceback (most recent call last):
File "program.py", line 1333, in <module> transferRead("MUXOUT", 0)
File "program.py", line 132, in transferRead resp = spi.xfer2([regW, 0]) # response from register
OSError: [Errno 22] Invalid argument.

我正在使用 Raspberry Pi 来控制多个 SPI 设备。其中一台设备与 spi.threewire=False 成功通信(暗示我的 code/workflow 的其余部分正常运行),但另一台设备共享 SI/SO 信号并需要 spi.threewire =正确。

有什么建议吗?这可能是 py-spidev 或内核的问题吗?

(注意是RPi 4B has the BCM2711, not BCM2835

谢谢,

乔纳森

pi@raspberrypi:~ $ uname -a Linux raspberrypi 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l GNU/Linux
pi@raspberrypi:~ $ cat /proc/cpuinfo | grep Model Model : Raspberry Pi 4 Model B Rev 1.2
pi@raspberrypi:~ $ cat /proc/cpuinfo | grep Revision Revision : c03112
pi@raspberrypi:~ $ modinfo spi-bcm2835 filename: /lib/modules/4.19.118-v7l+/kernel/drivers/spi/spi-bcm2835.ko license: GPL v2 author: Chris Boot <bootc@bootc.net> description: SPI controller driver for Broadcom BCM2835 srcversion: CC0CA8084657816640759C9 alias: of:N*T*Cbrcm,bcm2835-spiC* alias: of:N*T*Cbrcm,bcm2835-spi depends: intree: Y name: spi_bcm2835 vermagic: 4.19.118-v7l+ SMP mod_unload modversions ARMv7 p2v8
pi@raspberrypi:~ $ python3 Python 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

为了将来参考,请参阅有用的讨论 here on GitHub