无法打开 40 针接头上的 UART
Cannot open UART on the 40-pin header
我正在开发 Coral 开发板。我正在尝试在开发板上的 40 针接头上使用 UART1_TXD/RXD、UART3_TXD/RXD。我正在学习教程 Connect to the GPIO pins。
[serial_test.py]
from periphery import Serial
serial = Serial("/dev/ttyS0", 115200)
serial.write(b"Hello World!")
buf = serial.read(128, 0.5)
print("read %d bytes: _%s_" % (len(buf), buf))
serial.close()
我测试板子的时候:
$ python3 serial_test.py
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/periphery/serial.py", line 166, in _open
termios.tcsetattr(self._fd, termios.TCSANOW, [iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
termios.error: (5, 'Input/output error')
在处理上述异常的过程中,又发生了一个异常:
Traceback (most recent call last):
File "serial.py", line 5, in <module>
serial = Serial("/dev/ttyS0", 115200)
File "/usr/local/lib/python3.5/dist-packages/periphery/serial.py", line 60, in __init__
self._open(devpath, baudrate, databits, parity, stopbits, xonxoff, rtscts)
File "/usr/local/lib/python3.5/dist-packages/periphery/serial.py", line 168, in _open
raise SerialError(e.errno, "Setting serial port attributes: " + e.strerror)
AttributeError: 'error' object has no attribute 'errno'
$ stty -F /dev/ttyS0
stty: /dev/ttyS0: Input/output error
其余的ttyS1~3结果相同
正确的设备路径是什么?
Coral 开发板上公开的两个 UART 端口(UART1 和 UART3)映射到以下文件句柄:
- UART1→
/dev/ttymxc0
- UART3→
/dev/ttymxc2
您可以通过 40-pin I/O connector and through the serial console 接口访问这些端口(USB 转 UART 桥在连接到您的工作站时公开两个端口)。
当前版本的 Mendel (chef) 附带以下注意事项:
- UART1 与串行调试控制台共享。您需要在 Linux 中禁用控制台才能将此端口用于应用程序。
- UART3在基础包中默认不启用。您需要更新板上的软件包才能启用此功能。我们已将说明添加到 I/O documentation.
我正在开发 Coral 开发板。我正在尝试在开发板上的 40 针接头上使用 UART1_TXD/RXD、UART3_TXD/RXD。我正在学习教程 Connect to the GPIO pins。
[serial_test.py]
from periphery import Serial
serial = Serial("/dev/ttyS0", 115200)
serial.write(b"Hello World!")
buf = serial.read(128, 0.5)
print("read %d bytes: _%s_" % (len(buf), buf))
serial.close()
我测试板子的时候:
$ python3 serial_test.py
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/periphery/serial.py", line 166, in _open
termios.tcsetattr(self._fd, termios.TCSANOW, [iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
termios.error: (5, 'Input/output error')
在处理上述异常的过程中,又发生了一个异常:
Traceback (most recent call last):
File "serial.py", line 5, in <module>
serial = Serial("/dev/ttyS0", 115200)
File "/usr/local/lib/python3.5/dist-packages/periphery/serial.py", line 60, in __init__
self._open(devpath, baudrate, databits, parity, stopbits, xonxoff, rtscts)
File "/usr/local/lib/python3.5/dist-packages/periphery/serial.py", line 168, in _open
raise SerialError(e.errno, "Setting serial port attributes: " + e.strerror)
AttributeError: 'error' object has no attribute 'errno'
$ stty -F /dev/ttyS0
stty: /dev/ttyS0: Input/output error
其余的ttyS1~3结果相同
正确的设备路径是什么?
Coral 开发板上公开的两个 UART 端口(UART1 和 UART3)映射到以下文件句柄:
- UART1→
/dev/ttymxc0
- UART3→
/dev/ttymxc2
您可以通过 40-pin I/O connector and through the serial console 接口访问这些端口(USB 转 UART 桥在连接到您的工作站时公开两个端口)。
当前版本的 Mendel (chef) 附带以下注意事项:
- UART1 与串行调试控制台共享。您需要在 Linux 中禁用控制台才能将此端口用于应用程序。
- UART3在基础包中默认不启用。您需要更新板上的软件包才能启用此功能。我们已将说明添加到 I/O documentation.