Couldn't open tty port </dev/ttyS3> on WSL
lieuzhenghong opened this issue · comments
I refer to PR #2.
I am running Ubuntu 20.04 on WSL.
I have installed the CP210x USB to UART Bridge VCP Drivers and checked on Device Manager: the USB to UART bridge is indeed COM3.
However, running the command pi-install /dev/ttyS3 labs/0-blink/part1/blink-pin20.bin
gives the following error:
support.c:open_tty_raw:78:couldn't open tty port </dev/ttyS3>
support.c:open_tty:122:retrying
support.c:open_tty_raw:78:couldn't open tty port </dev/ttyS3>
support.c:open_tty:122:retrying
support.c:open_tty_raw:78:couldn't open tty port </dev/ttyS3>
support.c:open_tty:122:retrying
support.c:open_tty_raw:78:couldn't open tty port </dev/ttyS3>
support.c:open_tty:122:retrying
support.c:open_tty_raw:78:couldn't open tty port </dev/ttyS3>
support.c:open_tty:122:retrying
support.c:open_tty:126:PANIC:could not open after 5 tries.
Running ls -la
revealed that /dev/ttyS3
only gave read/write permissions to root:
ls -la /dev/ttyS3
crw------- 1 root root 4, 67 Dec 13 16:05 /dev/ttyS3
I ran pi-install
again after setting read and write permissions with chmod
but get a new tcgetattr
error:
sudo chmod 666 /dev/ttyS3
pi-install /dev/ttyS3 dev/cs140e-20win/labs/0-blink/part1/blink-pin20.bin
tty.c:set_tty_to_8n1:22:PANIC:tcgetattr failed
I had this problem too and fixed it by switching from WSL 2 to WSL 1:
wsl --set-version Ubuntu 1
The blink started working immediately after that:
~/dev/cs140e-20win/labs/0-blink$ pi-install /dev/ttyS3 part1/blink-pin20.bin
my-install: going to clean up UART
my-install: about to boot
simple-boot.c:simple_boot:84:*****************************sending 72 bytes
sent True: done.
my-install: going to echo
^C
I don't think this has anything to do with the course materials. The WSL 2 FAQ says: "As of right now WSL 2 does not include serial support, or USB device support."
thank you very much for tracking this down! very helpful. we're going to try to make a FAQ this year and add this.