How To Setup Com Port Windows 10
I hope that this web log post is constitute and helps someone. I wasn't sure what to title information technology. Hope Google Juice got you here!
Read this whole postal service, at that place's a lot initially but there's really just 2 or iii small pieces. It'll be worth it because you lot'll be able to have a nice 1 click carte and drop directly into a serial port concluding on Windows in the Windows Terminal
Often when you're doing embedded systems evolution y'all'll desire to monitor or talk to the COM/Serial Port just like you SSH into remote system. Folks ask questions similar "How to connect to a serial port as simple as using SSH?"
On Linux you'll use things like "screen /dev/ttyS0" for COM0. With Windows, still, the historical guidance has ever been to use Putty. It'll work but it'due south somewhat old, quirky, and information technology doesn't integrate well with the Windows Terminal and a more modern workflow.
Say I have a pocket-sized embedded microcontroller device that talks over a COM Port (normally via a USB->COM bridge) similar an Arduino.
Permit'south assume this device talks to the COM port as if information technology were a terminal and it's outputting stuff I want to see. I'll utilise this corking little CLI instance app for Arduino from Mads Aasvik to simulate such a device.
Hither's what it looks like under Arduino'due south Serial Monitor, for instance. This is a Windows app doing serial communication with its ain interface wrapping around it. I want to do this at a control line, and bonus points if it'south in Windows Last.
Setup WSL1
If you accept Windows x y'all can the Windows Subsystem for Linux quickly with this command at a Admin prompt:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Then go to the Windows Store and get any small Linux. Ubuntu or Kali volition do for our purposes. Run it and set your user and password. (I tried Alpine but it still has issues with screen and /dev/null/utmp)
Annotation: If you are using WSL2 and have set it as default, run wsl --list -v and ensure that your new distro is using WSL1 equally merely WSL1 volition permit us talk to the COM Ports. You can change it to WSL1 with "wsl --set-version DISTRONAME 1" from whatever command prompt.
To test this out now, run your new distro from any control line prompt like this. Add the "screen" app with sudo apt update
" and "sudo app install screen
".
You can see here that my Arduino serial device is on COM4. On Linux that device is /dev/ttyS4
That means that I should exist able to talk information technology from any WSL1 Linux Distro on Windows like "screen /dev/ttyS4 9600
" where 9600 is the speed/baud rate.
> wsl --list -v
NAME State VERSION
* Ubuntu-18.04 Stopped 2
kali-linux Stopped 1
Ubuntu-20.04 Stopped 2
WLinux Stopped 2
Become Minicom on your WSL1 distro
Screen is somewhat persnickety for Serial Port piece of work so try Minicom. Minicom is a dainty little text com plan. Install with apt install minicom and run for the first time with "sudo minicom -southward" to set your default. Note I've change the default port from /dev/modem to /dev/ttyS4 and the speed, in my case, to 9600.
Then I hit enter and salvage settings as the dft (default) in minicom. You can likewise turn on Local Echo with "Ctrl-A Due east" and toggle it if needed. At present I can talk to my Arudino with minicom.
Ensure dialout permissions to talk to the COM port
Annotation: If you get "cannon open /dev/ttyS4: Permission denied, you may need to add your user to the dialout group. This fashion we don't demand to sudo and get no prompt when running minicom!
> wsl -d kali-linux minicom
minicom: cannot open up /dev/ttyS4: Permission denied
> wsl -d kali-linux
$ groups scott
scott : scott adm cdrom sudo dip plugdev
$ sudo gpasswd --add scott dialout
[sudo] countersign for scott:
Adding user scott to grouping dialout
I tin can now run minicom on my configured COM port 4 (/dev/ttyS4) with wsl -d DISTRONAME minicom without sudo
.
Here I'1000 talking to that Arduino program. This embedded app doesn't need to me hit enter afterwards I blazon, so recall your own embedded devices will vary.
Make a nice menu
Bonus points, now I'll add a card item for Minicom by irresolute my Windows Concluding settings AND I'll get more points for calculation a squeamish serial port icon!
I hit settings and add a new profile like this at the top under profiles in the "list." Again, your distro proper noun volition exist different.
{
"guid": "{61c54bbd-a2c6-5271-96e7-009a87fa45cf}",
"name": "Minicom on Serial COM4",
"hidden": false,
"commandline": "wsl -d kali-linux minicom",
"startingDirectory": "%USERPROFILE%",
"icon": "C:/Users/scott/Desktop/serial_port_icon_138204.png"
},
To review:
- Use a WSL1 distro
- Install minicom, run with minicom -s once to make settings
- Make sure you are using the correct /dev/ttyS0 device for your situation
- Ensure your catamenia command, baud, etc are all correct in minicom
- Add your user to the dialout group so you don't have to sudo minicom
- Make a menu item in Windows Concluding
- or run minicom manually in your WSL1 instance whenever you similar
Hope this helps!
Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!
Most Scott
Scott Hanselman is a former professor, old Chief Builder in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-upward comic, a cornrower, and a book author.
Nearly Newsletter
Hosting By
Source: https://www.hanselman.com/blog/connect-to-a-device-over-serial-com-port-on-windows-10-with-wsl1-tty-devices-with-windows-terminal-and-minicom
Posted by: simpsondincovizincy.blogspot.com
0 Response to "How To Setup Com Port Windows 10"
Post a Comment