4

Goal: configure serial to USB cable for 9600 8-N-1

Cable is plugged-in and observed:

root@OpenHAB:~# uname -a
Linux OpenHAB 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv7l GNU/Linux
root@OpenHAB:~# lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
root@OpenHAB:~# ls /dev/ttyUSB*
/dev/ttyUSB0

Is there a good reference for configuring a Manhattan Serial to USB cable

Is there a litmus test that can be performed from the command line to confirm that the serial port is online and at the ready?

Patrick Cook
  • 6,365
  • 7
  • 37
  • 63
gatorback
  • 637
  • 1
  • 6
  • 20
  • Hello and welcome to Raspberry Pi! related (if not dupe): http://raspberrypi.stackexchange.com/questions/7730/how-to-configure-serial-port-settings-of-dev-ttyama0/7733#7733 – Ghanima Jan 24 '16 at 10:03
  • @Ghanima: thank you for the good link. The goal is similar, however, the context is a little different (which may or may not make a difference). The serial communication is to be performed through a USB adapter and not a pin on the rPi. – gatorback Jan 24 '16 at 17:26

1 Answers1

4

If you mean configure the Linux end which is using /dev/ttyUSB0

stty -F /dev/ttyUSB0 -cstopb cs8 -parenb 9600

where

-cstopb is 1 stop bit
cs8 is 8 bits
-parenb is no parity
9600 is the baud rate

For full details man stty

Actually 9600-8-N-1 is the default.

The presence of /dev/ttyUSB0 implies the device is ready. Unless the device supports handshake signals that's the best you can do without actually trying to read/write to the device.

joan
  • 71,024
  • 5
  • 73
  • 106
  • Thank you for the actionable response. Exactly what was called for. Is there a way to prove that Bus 001 Device 006: is represented by /dev/ttyUSB0? – gatorback Jan 24 '16 at 17:19
  • @gatorback Not my area of knowledge. Try the lsusb command. – joan Jan 24 '16 at 17:53
  • root@OpenHAB:~# dmesg | grep pl2303 [ 1641.828007] usbcore: registered new interface driver pl2303 [ 1641.828171] usbserial: USB Serial support registered for pl2303 [ 1641.828287] pl2303 1-1.4:1.0: pl2303 converter detected [ 1641.832474] usb 1-1.4: pl2303 converter now attached to ttyUSB0 [ 1871.361673] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0 [ 1871.361757] pl2303 1-1.4:1.0: device disconnected [ 1922.390068] pl2303 1-1.4:1.0: pl2303 converter detected [ 1922.394341] usb 1-1.4: pl2303 converter now attached to ttyUSB0 – gatorback Jan 24 '16 at 23:28