我正在开发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的结果相同。
正确的设备路径是什么?
答案 0 :(得分:0)
Coral开发板上公开的两个UART端口(UART1和UART3)映射到以下文件句柄:
/dev/ttymxc0
/dev/ttymxc2
您可以通过40-pin I/O connector和serial console接口访问这些端口(USB至UART桥接器在连接到工作站时公开了两个端口)。
Mendel(chef)的当前版本带有以下警告: