nic.le.douarec
nic.le.douarec

Reputation: 21

GNU SCREEN - USB serial tty communication problems with MAC OS X 10.8.2

we succesfully manage USB to serial communication with a device with Putty on Windows 7 and GNU screen on LINUx but half fail to do so with Terminal / screen on MAC OS.

simple basic communication setup is required on the LINUX windows machine :

57600 bps, 8 bits , no parity, no flow control

the device mounts succesfully and is profiled as described here ( sorry in French) :

Identifiant du produit: 0x6160

Identifiant du fournisseur: 0x03eb (Atmel Corporation)

Version: 1.10

Vitesse:Jusqu’à 12 Mb/s

Identifiant de l’emplacement: 0x06200000 / 2

Courant disponible (mA):500

Courant requis (mA):0

a cu.usbmodem621 and a tty.usbmodem621 do appear in the list of ls /dev/tty* or ls /dev/cu*

we activate screen using the following screen command on terminal.app

screen /dev/tty.usbmodem621 57600

or

sudo screen /dev/tty.usbmodem 57600

initally no screenrc file existed, I eventually created one to marginally tune the terminal settings and make sure that there was no flow control :

defscrollback 5000

termcapinfo xterm* ti@:te@

defflow off

hardstatus alwayslastline "%{rk}%H %{gk}%c %{yk}%M%d %{wk}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{wk}%?%+Lw%?"

I have tried without specific drivers, then with the 2 following references

FTDI http://www.ftdichip.com/FTDrivers.htm

Prolific PL2303 http://osx-pl2303.sourceforge.net/

I have also copied and pasted all the settings listed on a stty -a as per the LINUX machine. Here they are :

speed 57600 baud; 92 rows; 145 columns;

lflags: icanon isig iexten echo echoe echok echoke -echonl echoctl -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo -extproc

iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8 -ignbrk brkint -inpck -ignpar -parmrk

oflags: opost onlcr -oxtabs -onocr -onlret

cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow -dtrflow -mdmbuf

cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = ;  eol2 = ; erase = ^?; intr = ^C; kill = ^U; lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;

In ALL cases, the device correctly receives and interprets all commands we send from the screen terminal window but screen fails to display any communication FROM the device.

I have tried Goserial as well a Zterm with the same result.

any hint of what is going on ?

Upvotes: 2

Views: 10758

Answers (1)

vron
vron

Reputation: 21

Among the common pitfalls of serial communication are:

  • RX-to-TX, TX-to-RX
  • Baud Rate Mismatch
  • Bus Contention (such as a getty process; cf. sudo lsof /dev/tty.usbmodem)
  • Overrun (of chip buffer; occurs when characters come into the serial communication chip too fast)
  • Bad Communications Parameters
  • Framing errors (BAUD, PARITY, DATA BITS and/or STOP BITS may not be correct)
  • Parity errors
  • ... (see "Troubleshooting Serial Lines" by cisco)

An alternative to using screen would be to use picocom / setserial or cu -l /dev/tty.usbmodem -s 9600 (for troubleshooting purposes).

To get a virtual serial port to troubleshoot screen you may use something like:

socat GOPEN:/dev/ptyp0,ignoreeof TCP:10.0.1.93:10002

Make sure that no flow control (hardware or software) is being used.

For more information on "Setting up a Serial Console in Mac OS X" see here (e. g. .plist file that starts getty; screen /dev/cu.usbserial 115200 8N1).

Upvotes: 2

Related Questions