JonB
Posts: 220
Joined: Tue Nov 29, 2011 9:26 pm

Another problem with logging in via ttyUSB0

Wed Mar 05, 2014 5:33 pm

Hi

I have connected a pl2303 USB-serial adapter to my Pi and am using a proper terminal to login (it's a WYSE 120). anyway, I want to know what the correct settings are and how to set them. In particular the low control and number of bits / parity, because although it is working, sometimes data is corrupted coming to the terminal, and I am getting a local echo which I can't switch off. I have it configured as a VT100 and the getty is in /etc/inittab as:

Code: Select all

0:23:respawn:/sbin/getty -L ttyUSB0 19200 vt100
I can set various comms settings on the terminal, but I don't see a way of setting any apart from the speed on the Pi.

Can anyone help?

Thanks

JonB

JonB
Posts: 220
Joined: Tue Nov 29, 2011 9:26 pm

Re: Another problem with logging in via ttyUSB0

Thu Mar 06, 2014 12:37 pm

I have managed to disable the local echo, but I'm still getting corruption.

I wonder whether the Pi is unable to communicate to the USB serial adapter? Anyone else got this problem? Could it be power related?

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Another problem with logging in via ttyUSB0

Thu Mar 06, 2014 12:55 pm

Not a lot of help, but I do have 1 question and 1 comment:

1) Why not use ttyAMA0? (the serial port built into the GPIO)

2) Just FWIW, but I sometimes get dropped characters myself using ttyAMA0. You can see this if you do something that generates a lot of output (like ifconfig or something like that). Every once in a while, the last bit of the output will be truncated/dropped. Seems like a lack of flow control is the problem.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5105
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Another problem with logging in via ttyUSB0

Thu Mar 06, 2014 3:15 pm

JonB wrote:Hi
I have connected a pl2303 USB-serial adapter to my Pi and am using a proper terminal to login (it's a WYSE 120). anyway, I want to know what the correct settings are and how to set them. In particular the low control and number of bits / parity, because although it is working, sometimes data is corrupted coming to the terminal, and I am getting a local echo which I can't switch off. I have it configured as a VT100 and the getty is in /etc/inittab as:

Code: Select all

0:23:respawn:/sbin/getty -L ttyUSB0 19200 vt100
I can set various comms settings on the terminal, but I don't see a way of setting any apart from the speed on the Pi.
Can anyone help?
Thanks
JonB
FWIW, I tried out a similar device(?) some time ago:
http://www.cpmspectrepi.webspace.virgin ... apter.html
However, I installed and used GtkTerm which provides easy comns. configuration (more info. here: http://www.cpmspectrepi.webspace.virgin ... rtRep.html ), and did not use such a high baud-rate. What happens if you drop down to say 9600 baud? (A loopback test of the "other device", ie. 2nd. web-link, appeared to be O.K. for me).
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

JonB
Posts: 220
Joined: Tue Nov 29, 2011 9:26 pm

Re: Another problem with logging in via ttyUSB0

Thu Mar 06, 2014 4:52 pm

Joe Schmoe wrote:1) Why not use ttyAMA0? (the serial port built into the GPIO)
2) Just FWIW, but I sometimes get dropped characters myself using ttyAMA0. You can see this if you do something that generates a lot of output (like ifconfig or something like that). Every once in a while, the last bit of the output will be truncated/dropped. Seems like a lack of flow control is the problem.
hi Joe
To answer: 1, because I don't have a converter handy (but I have one on order). 2, this is what I am seeing. One can enable flow control using stty but it makes no difference.
FTrevorGowen wrote:FWIW, I tried out a similar device(?) some time ago:
http://www.cpmspectrepi.webspace.virgin ... apter.html
However, I installed and used GtkTerm which provides easy comns. configuration (more info. here: http://www.cpmspectrepi.webspace.virgin ... rtRep.html ), and did not use such a high baud-rate. What happens if you drop down to say 9600 baud? (A loopback test of the "other device", ie. 2nd. web-link, appeared to be O.K. for me).
Trev.
Hi Trev

When connected to a PC running hyperterm it works flawlessly, irrespective of baud rate, so I have to conclude that the terminal, cable and USB RS-232 converter are working correctly. I have tried setting XON/XOFF flow control in stty but it's not making any difference, I am still getting dropped bits/chars. I did seem to have it working for a short while but I cannot recreate the conditions so far.

Cheers

JonB

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Another problem with logging in via ttyUSB0

Thu Mar 06, 2014 9:14 pm

One can enable flow control using stty but it makes no difference.
I read an article here (on this forum) within the last day or two, describing how to setup hardware flow control (aka, RTS & CTS) on the Pi using ttyAMA0. It involved two steps:

1) Some soldering - since RTS/CTS isn't available on the default pins (the 3 that we all use for ttyAMA0)

2) Some software, to do two things:
2a) A C program that the guy wrote to enable RTS/CTS in the SOC.
2b) An "stty" command (as you mentioned) to enable it in the Linux terminal driver.

It looked interesting to me, but I shy away from anything requiring soldering.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

JonB
Posts: 220
Joined: Tue Nov 29, 2011 9:26 pm

Re: Another problem with logging in via ttyUSB0

Fri Mar 07, 2014 10:03 am

Hmm, interesting... I will have to look it up, but I don't think that the boards I have ordered will support it without modification.

http://www.ebay.co.uk/itm/281260965951

They are crazy cheap though, and for this you get two of them, so I may have a go. It's just a matter of making two additional connections to the MAX3232 chip on the board on top of the mods I imagine are described in the article you read. Looking at the board, CTS/RTS don't appear to be connected, so that will need to be worked out too. Maybe using this as a guide:

http://pcmanager.narod.ru/other/images/cable3.gif

I don't suppose you have a link to the article / thread do you you?

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Another problem with logging in via ttyUSB0

Fri Mar 07, 2014 10:49 am

I don't suppose you have a link to the article / thread do you you?
I looked around a bit using the forum search (yeah, yeah, I know, people always say the forum search feature is broken, don't use it, use Google instead, etc, etc, whatever) but couldn't find it. Anyway, you might want to search for either "hardware flow control" or "rtscts" (like that, one word). You might have better luck than I did.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

JonB
Posts: 220
Joined: Tue Nov 29, 2011 9:26 pm

Re: Another problem with logging in via ttyUSB0

Fri Mar 21, 2014 9:54 am

Hmm, I don't think it can be done.

I've found a description of how to enable CTS/RTS but it needs a Rev 2 PCB (which has additional pins adjacent to the GPIO header). I have an early Model B (Rev 1 PCB) and it doesn't have the additional pins to be assigned to RTS/CTS. I bought an RS232 adapter (MAX3232CPE based board) and tried using the console output but it is still presenting a garbled screen when lets of data is sent (say, when doing sudo dmesg. That's without hardware flow control, obviously.

But what is bothering me is that the USB serial adapter can't do HW flow control either. I tried to turn it on using stty but it makes no difference. It uses a recognised chipset - Prolific - but seems to ignore the flow control settings. I'm using stty crtscts for this. Maybe the Prolific driver is at fault?

User avatar
uc3a
Posts: 3
Joined: Sun Aug 12, 2012 6:00 am
Location: Тольятти

Use RTS/CTS

Sun May 11, 2014 9:39 am

Нow to use Raspberry Pi Serial Port four wires RXD/TXD and RTS/CTS ?

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Use RTS/CTS

Sun May 11, 2014 11:25 am

uc3a wrote:Нow to use Raspberry Pi Serial Port four wires RXD/TXD and RTS/CTS ?
You will need a Ground wire as well.

If you want to connect to some other device with an rs232 serial interface you will need an external signal level convertor.

See http://elinux.org/RPi_Serial_Connection
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

Return to “Troubleshooting”