Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Raspberry Pi with RS232<->USB adapter

740 views
Skip to first unread message

Markos

unread,
Feb 24, 2017, 9:12:17 AM2/24/17
to
Hi

I'm trying to read the serial output of this instrument:
http://www.c2o.pro.br/automacao/figuras/MultiLine_P4.jpg

When I use an RS232 <-> USB adapter:
usb 1-1.2: new full-speed USB device number 7 using dwc_otg
usb 1-1.2: New USB device found, idVendor=1a86, idProduct=7523
usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
ch341 1-1.2:1.0: ch341-uart converter detected
usb 1-1.2: ch341-uart converter now attached to ttyUSB0

And configure the Tcl:
set serial_port /dev/ttyUSB0

set serial_ID [open $serial_port r+]

fconfigure $serial_ID -mode 9600,n,8,1 -buffering none


I get strange characters:

b ߗwzÙÛ'7÷W‡C°°  ° °° °
ïÌG°° ° °TóÙ6vÍÃፏ‘
“°0Ì ÷ w §7g ׏° Ì33
×× °° ° °2³¿µ°øx׏Ä
b חwzÙÛ77÷W‡C°° °° ° °o
ÌǠ° ° °ÖóÙ6vÍÃፏ


But if I change the adapter:

usb 1-1.3: new full-speed USB device number 8 using dwc_otg
usb 1-1.3: New USB device found, idVendor=067b, idProduct=2303
usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1.3: Product: USB-Serial Controller D
usb 1-1.3: Manufacturer: Prolific Technology Inc.
pl2303 1-1.3:1.0: pl2303 converter detected
usb 1-1.3: pl2303 converter now attached to ttyUSB0

And I use the same script:
set serial_port /dev/ttyUSB0

set serial_ID [open $serial_port r+]

fconfigure $serial_ID -mode 9600,n,8,1 -buffering none

I receive correct messages from the instrument:

01.01.16 01:51
183 mV 23.6 øC

199 æS/cm 23.6 øC
nLF Tref25

But I see driver error messages with the dmesg command:

pl2303 ttyUSB0: pl2303_get_line_request - failed: -32
pl2303 ttyUSB0: error sending break = -32
pl2303 ttyUSB0: pl2303_get_line_request - failed: -32
pl2303 ttyUSB0: error sending break = -32

And when I close and reopen the serial channel I get a lot of messages stored in the buffer. I can not empty the buffer with the command close $serial_ID command

With the first adapter I don't see driver error messages but I can't decode the characters.

And with the second adapter I get the characters correctly but with driver error messages and I stop receiving the characters after about 1h of reading.

Any suggestion?

Thanks,
Markos






Joerg Honerla

unread,
Feb 24, 2017, 11:03:03 AM2/24/17
to
Hello Marcos,

of often used a Prolific USB<->Serial adapter with very good results,
but up to date only on X86_64 systems. I have two comments to your code,
see below!

If nothing happened, I would try to check it out with a program like
minicom or so, to check what the instrument sends.

Joerg

Am 24.02.2017 um 15:12 schrieb Markos:
> Hi
>
> I'm trying to read the serial output of this instrument:
> http://www.c2o.pro.br/automacao/figuras/MultiLine_P4.jpg
>
> When I use an RS232 <-> USB adapter:
> usb 1-1.2: new full-speed USB device number 7 using dwc_otg
> usb 1-1.2: New USB device found, idVendor=1a86, idProduct=7523
> usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
> ch341 1-1.2:1.0: ch341-uart converter detected
> usb 1-1.2: ch341-uart converter now attached to ttyUSB0
>
> And configure the Tcl:
> set serial_port /dev/ttyUSB0
>
> set serial_ID [open $serial_port r+]

try "w+"

>
> fconfigure $serial_ID -mode 9600,n,8,1 -buffering none

try "-buffering line" and if needed "-translation ..."
--
Joerg Honerla
High Voltage Laboratory
University Duisburg-Essen
Germany
http://www.ets.uni-due.de

Björn Lundin

unread,
Feb 24, 2017, 11:08:41 AM2/24/17
to
On 2017-02-24 15:12, Markos wrote:
> Hi
>
> I'm trying to read the serial output of this instrument:
> http://www.c2o.pro.br/automacao/figuras/MultiLine_P4.jpg
>
> When I use an RS232 <-> USB adapter:

If the adpter gives you trouble try using the onboard serial port.
You will need an adapter in between to get the voltage levels correct.

see

<http://www.davidhunt.ie/add-a-9-pin-serial-port-to-your-raspberry-pi-in-10-minutes/>


--
--
Björn

Markos

unread,
Mar 2, 2017, 7:35:43 AM3/2/17
to
Thanks for the suggestions.

I will try this type of adapter.

Markos

khaled...@ensi-uma.tn

unread,
Jul 2, 2019, 10:17:13 AM7/2/19
to

Uwe Klein

unread,
Jul 3, 2019, 8:59:53 AM7/3/19
to
What does [fconfigure $serial_ID] return in both cases?

could you try
fconfigure -translation crlf -encoding binary
or
fconfigure -translation crlf -encoding ascii

Uwe


Christopher Chavez

unread,
Jul 5, 2019, 11:38:58 AM7/5/19
to
This is a very old thread (February 2017) that someone (spammer?)
forwarded without adding any new info. Some suggestions have already
been given to the original asker. The entire thread can be viewed at
https://groups.google.com/forum/#!topic/comp.lang.tcl/geiWXzGXJNU if
you're like me and don't have those earlier messages downloaded.
0 new messages