Peppermint OS Community Forum

Support => Software & Applications => Topic started by: emegra on August 16, 2019, 05:10:17 am

Title: Serial to USB (SOLVED)
Post by: emegra on August 16, 2019, 05:10:17 am
Hi guys

I'm still working on my friends laptop, and I'm trying to get a weight monitor device to connect to Peppermint, this device connects to a weighbridge via a serial connection and to a PC/laptop also via a serial connection he's been using a serial to usb cable that comes with a Windows & Mac driver (no linux driver surprise surprise), and then connecting via Putty, I can't see any reason why this shouldn't work in Linux if I can find a driver to convert the serial signal to usb such as the Windows & Mac driver that comes with the cable.

So my question is does anyone know of a Linux driver or any other way I can solve the problem ?


Graeme
Title: Re: Serial to USB
Post by: PCNetSpec on August 16, 2019, 04:45:33 pm
With the USB to Serial adapter plugged in, what's the output from
Code: [Select]
lsusb
then unplug the adapter .. wait 5 seconds .. replug the adapter .. then post the output from:
Code: [Select]
dmesg | tail -n 30
Title: Re: Serial to USB
Post by: emegra on August 21, 2019, 02:40:26 pm
Outputs as requested, apologies for the time it's taken to get back to you, I have a lot going on right now

Code: [Select]
grant@Grants-Thinkpad ~ $ lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 003 Device 004: ID 04f2:b39a Chicony Electronics Co., Ltd
Bus 003 Device 003: ID 8087:07dc Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub[/code
[code]

grant@Grants-Thinkpad ~ $ dmesg | tail -n 30
[  306.634875] usb 3-3: USB disconnect, device number 2
[  306.635273] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
[  306.635325] pl2303 3-3:1.0: device disconnected
[  328.136779] usb 3-3: new full-speed USB device number 5 using xhci_hcd
[  328.285803] usb 3-3: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 3.00
[  328.285808] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  328.285812] usb 3-3: Product: USB-Serial Controller
[  328.285814] usb 3-3: Manufacturer: Prolific Technology Inc.
[  328.287490] pl2303 3-3:1.0: pl2303 converter detected
[  328.288435] usb 3-3: pl2303 converter now attached to ttyUSB0
[  380.314700] usb 3-3: USB disconnect, device number 5
[  380.315106] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
[  380.315141] pl2303 3-3:1.0: device disconnected
[  391.788883] usb 3-3: new full-speed USB device number 6 using xhci_hcd
[  391.937702] usb 3-3: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 3.00
[  391.937705] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  391.937707] usb 3-3: Product: USB-Serial Controller
[  391.937708] usb 3-3: Manufacturer: Prolific Technology Inc.
[  391.939129] pl2303 3-3:1.0: pl2303 converter detected
[  391.939965] usb 3-3: pl2303 converter now attached to ttyUSB0
[  470.095727] usb 3-3: USB disconnect, device number 6
[  470.096216] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
[  470.096269] pl2303 3-3:1.0: device disconnected
[  481.544642] usb 3-3: new full-speed USB device number 7 using xhci_hcd
[  481.693840] usb 3-3: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 3.00
[  481.693844] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  481.693847] usb 3-3: Product: USB-Serial Controller
[  481.693849] usb 3-3: Manufacturer: Prolific Technology Inc.
[  481.695463] pl2303 3-3:1.0: pl2303 converter detected
[  481.696302] usb 3-3: pl2303 converter now attached to ttyUSB0
grant@Grants-Thinkpad ~ $ [/code



Graeme


Title: Re: Serial to USB
Post by: PCNetSpec on August 21, 2019, 03:24:27 pm
Have you seen this
https://askubuntu.com/questions/471821/pl2303-attached-to-ttyusb0-change-it-to-ttys

it seems like the PL2303 adapter is probably working, but you may need to add yourself to the dialout group before you can access it.

Probably wisest/safest to add yourself to dialout via:-
Menu > Settings > Users and Groups
rather than by using the command at the above link
Title: Re: Serial to USB
Post by: emegra on August 22, 2019, 04:40:02 am
Ok i did as you suggested and added the user to the dialout group but sadly i'm still not getting anything working

to give you some background this is completely new to me and I've never seen it working but from what I understand when it's plugged in a terminal window should open up via PuTTY and live data from the weighbridge should be displayed in the terminal.

the device I'm trying to connect is a simulator that streams the same data a weighbridge would if it was connected the output weight can be adjusted with a dial.

To add to the confusion he told me it was working in Windows 10 but when we tried it it wasn't working, it's doing exactly the same as it's doing in Linux,

The serial to USB cable he has comes with a Windows driver which appears to have been installed I say that because when I run the disc I'm only given the option to uninstall or reinstall so I don't know why it's not working in Windows either yet he assured me it was, so it's quite probable that whatever reason it's not working in Windows is the same reason it's not working in Linux, what he can't be sure of is that it's the same cable that worked in Windows, so do I have a faulty or incompatible cable, so my view is to get this working in Windows first because I know it does work in Windows and go from there. but I'd appreciate any advice anyone can give me,

He desperately want's to run Linux as much as possible and I want to help him do that but to be honest I've bitten off more than I can chew and it's getting me down :(


Graeme


Title: Re: Serial to USB
Post by: murraymint on August 22, 2019, 05:31:14 am
from what I understand when it's plugged in a terminal window should open up via PuTTY and live data from the weighbridge should be displayed in the terminal.


That must be a function of the Windows software. Have you tried installing statserial as in the terminal commands in Mark's link?
Title: Re: Serial to USB
Post by: emegra on August 22, 2019, 06:52:42 am

Quote
That must be a function of the Windows software. Have you tried installing statserial as in the terminal commands in Mark's link?

Not yet to be honest I find most of the info on that link a little hard to get my head round, ie is it suggesting I use statserial in the terminal to make the connection ?, or do I just need to make config changes using statserial ?, can I still use PuTTY to make the connection ?.

My guess is I use statserial to make config changes so PuTTY can communicate but I'm not sure


Graeme

Title: Re: Serial to USB
Post by: murraymint on August 22, 2019, 07:30:30 am
Putty is the Windows-only equivalent of SSH. The link suggests that you read the device's info via statserial. Apologies I don't have time to look into this further at the moment.

Title: Re: Serial to USB
Post by: PCNetSpec on August 22, 2019, 07:41:45 am
Well like I said the USB to Serial adapter seems to be recognised and working.
(so no additional drivers should be necessary .. at least as far as the adapter is concerned)

It's also possible to install PuTTY in Linux
https://numato.com/blog/how-to-install-putty-on-linux/
(though probably not strictly necessary .. Linux already has TTY functionality)

But if this thing requires any Windows specific software (in addition to PuTTY) to work you may be in a world of problems.
Title: Re: Serial to USB
Post by: emegra on August 22, 2019, 09:15:53 am
I've already installed PuTTY from the repos, The only Windows software I'm aware of is the driver disc that comes with the serial to USB cable, but as I said in my earlier post this is not working in Windows now either although he assures me it did  but he can't guarantee it worked with that particular cable, so I have to question the cable, is it possible I have a faulty or incompatible cable.

I don't see any point in beating my head against a brick wall anymore trying to get this running in Linux untill I get it working in Windows so I can be sure the cable's good

Does that make sense ?


Graeme



Title: Re: Serial to USB
Post by: PCNetSpec on August 22, 2019, 10:16:41 am
Makes perfect sense .. taint gunna werk in Linuks if its broked.
Title: Re: Serial to USB
Post by: emegra on August 22, 2019, 12:07:12 pm
Quote
Makes perfect sense .. taint gunna werk in Linuks if its broked.

if the cables broked taint gunna werk in windirs ither :)

But my rationale is I know it can work in Windows I don't know for certain if it can work in Linux,  I need to establish the cable's good before I go any further and it would be simpler to do that on a system I know it can work on rather than on one where i have some doubt



Graeme

Title: Re: Serial to USB
Post by: emegra on August 22, 2019, 02:17:26 pm
OK I've got this working in Windows he had saved settings in PuTTY saved as "test" , so after reinstalling the driver I used these settings and it worked fine the settings are as follows
COM5
Speed 4800
Data Bits: 7
Stop Bits: 2
Parity: Even
Flow Control: Xon/Xoff

So I can say for definite there's nothing wrong with the cable and as far as i can see there's no additional Windows software to make this work

I tried using the identical settings in Linux but I get the following error message

Quote
Unable to open connection to /dev/ttyS0:
Unable to configure serial port

Statserial gives the following output

Code: [Select]
grant@Grants-Thinkpad ~ $ statserial /dev/ttyS0
statserial: TIOCMGET failed: Input/output error
grant@Grants-Thinkpad ~ $



Any ideas ?

Graeme
Title: Re: Serial to USB
Post by: PCNetSpec on August 22, 2019, 03:11:10 pm
According to your dmesg output, the PL2303 is at ttyUSB0
Title: Re: Serial to USB
Post by: PCNetSpec on August 22, 2019, 03:15:25 pm
Try opening putty with
Code: [Select]
gksudo putty
then select Serial and enter /dev/ttyUSB0

Source:
https://askubuntu.com/questions/674723/how-to-use-the-digitus-serial-to-usb-adapter
Title: Re: Serial to USB
Post by: emegra on August 22, 2019, 03:26:03 pm
That's the answer Mark
I changed the Serial line from /dev/ttyS0 to /dev/ttyUSB0 in PuTTY and off it went

You have no idea how happy you've made me :)

All I have to do now is figure out how to save these settings in PuTTY

Many thanks


Graeme
Title: Re: Serial to USB
Post by: PCNetSpec on August 22, 2019, 03:29:53 pm
You're more than welcome Graeme .. can't help you with the PuTTY config saving though, I've never used it :)

[EDIT]

I'm sure it'll be online somewhere, so if ya get stuck give us a shout and we'll see what we can find.
Title: Re: Serial to USB
Post by: emegra on August 22, 2019, 04:20:47 pm
Thanks again Mark

I figured out how to save and load a session so were good to go, another application he won't need Windows for, up to this point we've got him about 80% Linux, if it wasn't for his accountant insisting on VT Transactions we'd have had him 100% Linux (hopefully with the help of the smart guys at WINE HQ we might get that sorted out as well in time)

So another one bites the dust, nothing left but to mark this solved

Thanks again

Graeme

Title: Re: Serial to USB (SOLVED)
Post by: PCNetSpec on August 22, 2019, 05:37:32 pm
The other option might be him insisting on his accountant using something else .. or a new accountant.

There's something wrong with a world where the people YOU pay make the stipulations ???