I'm using LibSerial on Ubuntu to read and write data on serial port. At the moment, I'm able to write and receive strings over the serial port, but my code does not work very well: in particular, I'd like to control the reading function in order to read only if there is something to read and exit when there is no information to read in order to send another command without bloicking the flow. The command above using grep shows port 22 only and sshd service is listening on that port Use the ss Command. Netstat is not install on Ubuntu by default the ss command is installed as a replacement for netstat. As with netstat, the ss command is use to display network information on Linux systems.
This article will describe changing GRUB2 and Linux to serial console.
This is not for desktop environment but embedded system and virtual machine environment.
Ubuntu Serial Port Monitor Gui
Table of Contents
- 4. Execution result
1 Why using serial console
The serial console is helpful for CUI environment.
- An embedded system which has no monitor display like router can be operated by serial console with RS232C.
- A virtual machine like KVM + libvirt can be operated by serial console with CUI tools like virsh.
2 /etc/default/grub
Change /etc/default/grub as below.
- Change GRUB terminal to console and ttyS0. This will provide one GRUB to a monitor display and serial console.
- Remove hidden parameter for avoiding 'no video mode activated' error. And change GRUB timeout from 10 seconds to 1 second.
- Change linux kernel console to tty1 and ttyS0. This setting will be taken over to userland, and there will be two login prompt for tty1 and ttyS0.
3 grub-mkconfig
Update /boot/grub/grub.cfg with grub-mkconfig.
Reboot Ubuntu 16.04.
Linux Serial Port Tool
4 Execution result
GRUB to monitor display is as below.
GRUB to serial console is as below.
This article used 'sudo virsh console <vmname>' for connecting serial console.
Login prompt to monitor display is as below.
tty1 is displayed with press Ctrl + Alt + F1.
Login prompt to serial console is as below.
4.1 Single user mode / Recovery mode
- When running single user mode, there will be two root prompt for tty1 and ttyS0.
- When running recovery mode, there will be one root prompt for ttyS0. If you want to switch prompt to tty1, you need to move 'console=ttyS0,115200' to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub because recovery mode does not user GRUB_CMDLINE_LINUX_DEFAULT.
- When running single user mode or recovery mode, root prompt for ttyS0 will be corrupted, e.g. noecho. Please append 'stty sane' to root.bashrc as below.
A root prompt for ttyS0 with using 'stty sane' is as below.
If you’re looking for a free and solid application to use for your serial COM connections, try PuTTY. It’s free for commercial and private use, and takes up a mere 444KB of disk space.
The latest PuTTY version can be downloaded here:http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Windows Vista and Windows 7 only support the private edition of HyperTerminal. Windows 7 does not even ship with HyperTerminal. The private edition is NOT FREE for commercial use. Its license requires you purchase the application if used commercially, with the cost of the application being US$59.99, as listed on Hilgraeve’s website.
Ubuntu Serial Port Monitor
To use PuTTY for your serial COM connections, follow these steps:
- Figure out the COM port you’ll be using.
- Run PuTTY.
- Switch the Connection Type to Serial.
- Edit the Serial Line to match the COM port you want to use.
- Edit the Speed to match the BAUD Rate you want to use.
- Select the Serial category from the menu on the left.
- Make sure all of the settings are correct (the settings in the screenshot are what I used for my session, yours could look different depending on what you’re connecting to).
- Select the Open button to start the session.
Your connection should now be fully functional.
If you find yourself using PuTTY quite extensively, you could save settings to different profiles for fast future usage. To create a profile for your settings:
Ubuntu Serial Port Monitor Windows 10
- Make sure you have the settings you require.
- Enter a profile name under Saved Sessions.
- Click the Save button.
On your next PuTTY session, you can load your profile by selecting it from the list and clicking the Load button.
Logging is also a great feature that PuTTY provides. It lets you output your entire session to a log file. To enable logging, follow these steps before you open your connection:
- Select Logging from the category list on the left.
- Choose your desired logging method (All session output, printable output, etc…)
- Enter a file name.
- Select the file handling settings.
- Open your connection.
13 Comments on Using PuTTY for serial COM connections (HyperTerminal replacement)
13 Responses to “Using PuTTY for serial COM connections (HyperTerminal replacement)”
- bam says:July 30, 2013 at 4:24 pm
Hello,Your info is very helpful.Thanks.
Bam
Reply - jan says:February 11, 2014 at 9:28 am
my serial putty configuration to an ubuntu system has wrong output: e.g. ýûþþüÌþüis as keyboardoutput. Is there anything to change to get readable output ?
Reply- juan says:February 18, 2014 at 4:55 pm
Try differents baud rates.
Reply
- juan says:February 18, 2014 at 4:55 pm
- Parya Myanka says:March 2, 2014 at 2:35 pm
SimpleTerm Gold – Stater Liteis a free alternative and is much easier for COM port or RS232, TTL based development work.
Reply - Jimoh Mojisola says:April 16, 2014 at 9:33 am
thanks for the infoI am trying to program a bluetooth adaptar using Putty, having done the configuration as above, i couldn’t get any response(after writing the command(using Attention (AT) command)
Reply - Muzz says:December 31, 2014 at 3:47 am
This is great stuff. Not quite putty in my hands tho’. I went to full screen but had no idea how to get out of it. I tried right click – nothing, esc – also nothing
Reply - pandyanadiad says:August 24, 2015 at 5:58 pm
Thanks for such a useful information. I have putty software long back but i don’t know how to use thanks for information.
Reply - slim says:January 10, 2016 at 12:10 pm
Thx, it’s useful and you made it easy :)
Reply - Bill says:March 12, 2016 at 2:16 am
Doesn’t allow me to type anything.The black window opens, green cursor flashes and that’s it.Doesn’t accept any keyboard input. (Yes, the keyboard works)
Reply- Sandy says:August 7, 2016 at 10:24 am
How do I edit text from serial SLABS CP2104 of Option Globesurfer 3.I need to reset to factory and I know how to but I cannot get the text editor to work
Reply
- Sandy says:August 7, 2016 at 10:24 am
- The year of our lord MMXVI says:April 20, 2016 at 9:59 pm
Thanks for the info! Wasn’t working at first but I was testing the wrong COM ports.
Reply - Manel Rabhi says:June 24, 2016 at 1:49 am
thank you for the info , I am using Putty serial with a sipex SP3232ECP ,after connecting my cart via vpga , i open my putty connexion but i receive error messages .
Reply - RIDHA says:August 7, 2017 at 6:09 am
my serial monitor does not response to the keyboard , the cursor standstill with no any response to the key board
Reply