Friday, March 10, 2017

Serial Port

  • Serial Terminal Basics

You can now use the screen command to to establish a simple serial connection.
The terminal will go blank with just a cursor. You are now connected to that port!
To disconnect, type control-a followed by control-\. The screen will then ask if you are sure you want to disconnect.

To be able to issue Serial commands, you must first enter PowerShell. Type powershell to get into PowerShell command mode.
To see a list of all the available COM ports, type
[System.IO.Ports.SerialPort]::getportnames()
Now create an instance of the port you want with this command
https://learn.sparkfun.com/tutorials/terminal-basics/command-line-windows-mac-linux

  • Using GNU screen to debug your serial port
Opening serial port (with the correct baud rate)
   
bash> screen /dev/ttyUSB0 57600
/dev/ttyUSB0 is the serial port, while 57600 sets its baud rate into 57600bps

https://embeddedfreak.wordpress.com/2008/08/12/using-gnu-screen-to-debug-your-serial-port/

  • Client Setup

1) Ensure you have a read/write permissions on /dev/ttyS0.
$ ls -l /dev/ttyS0
crw-rw---- 1 root dialout 4, 64 2007-12-20 13:56 /dev/ttyS0
$ id -Gn |grep dialout

if the last command didn't show an output add yourself to dialout group and logout/login:
sudo adduser $USER dialout


2) Install minicom
sudo apt-get install minicom

Configure minicom.
minicom -s

Configure client serial port settings: In Serial port setup, set the following options
A - Serial device: /dev/ttyS0
E - Bps/Par/Bits: 115200 8N1


Alternative serial client: screen

To install:
sudo apt-get install screen


To start:
screen /dev/ttyS0 115200

To end the session, use Ctrl-A,Shift-K.

https://help.ubuntu.com/community/SerialConsoleHowto


  • 5 Linux / Unix Commands For Connecting To The Serial Console

Find out information about your serial ports
$ dmesg | egrep --color 'serial|ttyS'

You can use setserial command which is designed to set and/or report the configuration information associated with a serial port:
$ setserial -g /dev/ttyS[0123]

The cu command is used to call up another system and act as a dial in terminal.
cu -l /dev/ttyS0 -s 19200

minicom command is a communication program which somewhat resembles the shareware program TELIX from old good MS-DOS days.

PuTTY is a free and open source gui X based terminal emulator client for the SSH, Telnet, rlogin, and raw TCP computing protocols and as a serial console clienPuTTY is a free and open source gui X based terminal emulator client for the SSH, Telnet, rlogin, and raw TCP computing protocols and as a serial console client.

The tip command is used as a serial terminal. tip command can be found under AIX/HP-UX/Solairs/*BSD/Linux operating systems.

if you forced to use MS-Windows, try the following free and open source serial communication programs:
    Putty
    TeraTerm
    Poderosa
https://www.cyberciti.biz/hardware/5-linux-unix-commands-for-connecting-to-the-serial-console/


  • Using the Raspberry Pi’s serial port
The stock Debian image for the Raspberry Pi uses the UART as a serial console.

I was able to connect to it from my Ubuntu laptop via my 3.3-volt USB FTDI TTL-232 cable. I connected Raspberry Pi’s ground pin to the ground pin of the FTDI, the Rasberry Pi’s TX pin to the FTDI’s RX pin and vice versa
Then on my Ubuntu laptop I installed minicom (sudo apt-get install minicom) and fired it up with:

    minicom -b 115200 -o -D /dev/ttyUSB0

http://www.irrational.net/2012/04/19/using-the-raspberry-pis-serial-port

  • Tutorial how to use adapter usb serial cable Ubuntu 14 04
https://www.youtube.com/watch?v=DXgvaibDJzo


  • I came across a problem recently, I needed to configure a Cisco switch and all I had was a Ubuntu machine that had a serial port. Since then I've got a Cisco 2511, with octal cable

dmesg | grep tty
the physical serial port is at ttyS0, where as usb > serial converters will show as ttyUSB0
http://lachlanmiskin.com/blog/2012/08/03/using-minicom-to-interface-with-serial-devices-on-linux

  • How to enable USB-Serial Port adapter (RS-232) in Ubuntu Linux

unplug the device and type “lsusb”
First plug in the USB-Serial Port adaptor to one of your USB port. Wait for a couple of second, then run “dmesg”.

Now we know the vendor id and the product id of the USB-Serial Port converter, this will enable us to load the linux kernel module “usbserial” to activate the device
sudo modprobe usbserial vendor=0x4348 product=0x5523
https://blog.mypapit.net/2008/05/how-to-use-usb-serial-port-converter-in-ubuntu.html

  • Testing a USB RS232 adapter
If  connected,  remove  the  USB  RS232  adapter.  In  Windows,  open  Device  Manager  and  expand  the  Ports  section.  While  Device  Manager 
is open  insert  the  USB  RS232  adapter  and  after  a  few  seconds  a  USB  Serial  Port  should  appear.  If  not,  there  is  a  problem  with  the  adapter  or driver
http://www.compsys1.com/support/docs/usb_rs232_test.pdf

No comments:

Post a Comment