开云体育

Locked rs232 - usb adapter for pi


 

jmri's connection to cmri on my pi has been quite robust with the very old no-name usb - 9pin adapter. i just added a 2nd connection to my command station with the same type adapter, and it is pretty flakey. can anyone list robust working adapters and sources?

thanks!
calvin.


 

开云体育

The FTDI chipset-based adapter sold by ESU dealers for ~$30 as a spare part for their LokProgrammer has proved very reliable on all platforms, as has the very similar?UN8-BE sold by RRCirKits. I use the ESU ones on Mac, Windows and Linux.

I haven't used a Pi, but it has been reported that the FTDI cables work fine with the Pi without any need for any driver installation (a suitable driver is already installed).

--?
Dave in Australia

The New England Convention 2018

On 25 Jul 2018, at 7:12 AM, cmitcham@... wrote:

jmri's connection to cmri on my pi has been quite robust with the very old no-name usb - 9pin adapter. i just added a 2nd connection to my command station with the same type adapter, and it is pretty flakey. can anyone list robust working adapters and sources?


 

Group:

I just went through an assortment of USB/232... All worked with the Pi but only the generic FTDI based one was picked up by the auto detect feature in Steve's RPi-JMRI distro.

Generic, Aten Pricom, Keyspan 19HS... Connected to NCE PH-Pro.

Note and possibly of importance no other adapter connected.

And just what is flaky and what command station? What baud rate for the C/MRI connection?

Jim Albanowski

<snip>


 

flakey means when i first hooked it up, it worked fine and i made trains move with a jmri throttle. for comfort, i rebooted the pi and then it did not work. not the normal "missing serial port, here is the prefs window to play with", but a red message on the main panelpro window saying the connection was not on.

of course it was time to quit for the night, so i'll play more in a couple days.

the command station is nce ph-pro, and it is about 20 feet away. homemade cable from nce to adapter from cat5 cable with soldered on 9 pin connectors.


 

开云体育

Several possibilities:

1) The port name changed across the reboot.
To check this, enter the following command exactly (with spaces and punctuation but excluding the outmost quotes) and press Enter.
"while : ;do clear;ls -lt /dev|head;i=$((i+1));echo $i;sleep 1;done"
The command will sit looping and displaying 10 entries. Unplug/replug the adaptor and watch what port name appears/disappears.

2) You manually changed permissions for the port. This does not persist across a reboot. You need to ensure you are a member of the correct group. I'll have to let a Pi expert comment on that.

3) Since you have a Power Pro, there can be a hardware-related connection flakiness issue. For details and fix, take a look at:
<>

--?
Dave in Australia

The New England Convention 2018

On 26 Jul 2018, at 6:29 AM, cmitcham@... wrote:

flakey means when i first hooked it up, it worked fine and i made trains move with a jmri throttle. for comfort, i rebooted the pi and then it did not work. not the normal "missing serial port, here is the prefs window to play with", but a red message on the main panelpro window saying the connection was not on.

of course it was time to quit for the night, so i'll play more in a couple days.

the command station is nce ph-pro, and it is about 20 feet away. homemade cable from nce to adapter from cat5 cable with soldered on 9 pin connectors.


 

开云体育

Also:
The most useful further information you can give us is the JMRI System Console log. It can be seen by either:
- Going to the Help->System Console menu item, using the Copy to Clipboard button and pasting into a message to the group.
- Going to the Help->Locations menu item, clicking on "Open Log Files Location" and uploading the "session.log" file found therein to a folder (with your name) in the "Problems being worked on" folder.

--?
Dave in?Australia

On 26 Jul 2018, at 6:29 am, cmitcham@... wrote:

flakey means when i first hooked it up, it worked fine and i made trains move with a jmri throttle. for comfort, i rebooted the pi and then it did not work. not the normal "missing serial port, here is the prefs window to play with", but a red message on the main panelpro window saying the connection was not on.

of course it was time to quit for the night, so i'll play more in a couple days.

the command station is nce ph-pro, and it is about 20 feet away. homemade cable from nce to adapter from cat5 cable with soldered on 9 pin connectors.


 

Raspberry pi Console run sudo lsusb

It will show the USB device types connected not the port name but it's the first step to be sure the Raspbian is seeing the device.

Then I would go in JMRI and open the prefs and look at the connections list for the ttyUSBn's With two USB adapters you should have a ttyUSB0 and ttyUSB1.

If all looks good and we still have a problem I would look at a loop back connector and a terminal program... which so far I haven't found for the Pi... sigh... I'll keep looking.... The idea is to be sure that even though the USB is detected we're actually getting data out and in...

Jim Albanowski


 

Okay, found two terminal emulators that work on the Pi with Stretch...

PuTTY and Cutecom

Standard install...

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install putty

or

sudo apt-get install cutecom

Found my loop back DB9 (2-3,4-6,7-8)

Set the port settings in each program for ttyUSB0 or ttyUSB1 and can see data.

If that works then there no problem with the USB dongle. We have some other problem either with JMRI end or C/MRI end.

Jim Albanowski


 

If all looks good and we still have a problem I would look at a loop back connector
and a terminal program... which so far I haven't found for the Pi... sigh... I'll keep looking....
Putty?


Free SSH & Telnet client.


 

开云体育

The web page that Marcus Ammann put together (with assistance from me) explains both how to make a loopback connector and also how use JMRI to test the looped-back connection. It was written specifically to diagnose problems with NCE Power Pro, USB to Serial cables and JMRI.
<>

No terminal program needed for this loopback test.

--?
Dave in Australia

The New England Convention 2018

On 26 Jul 2018, at 8:32 PM, jimalbanowski <jimalbanowski@...> wrote:

If all looks good and we still have a problem I would look at a loop back connector and a terminal program... which so far I haven't found for the Pi... sigh... I'll keep looking.... The idea is to be sure that even though the USB is detected we're actually getting data out and in...


 

thanks?everyone for the help.

tonight is train night, so i'll be back at it. I'm interested to see the output of the new usb check commands I have seen here. I have always just relied on "dmesg" to show status when I plug or unplug a usb device from Linux.

jim, you had one line... "Note and possibly of importance no other adapter connected" ... was that? a list of adapters that worked with the pi but didn't play well with nce?

calvin.


 

Calvin:

I had no other USB connected when I wrote that.

When I used the lsusb and found the terminal programs and did my loop back tests I did.

When I tried to set the prefs in JMRI I also had the two USB dongles attached.

Good luck as always when trying to find odd problems break things down the simplest and as few parts configuration as possible.

Jim Albanowski


 

开云体育

Jim's comment regarding one device is probably because Linux has a habit of naming USB ports sequentially, based on plug-in order. Hence having multiple devices connected can muddy the waters when troubleshooting.

I just happen to have my generic USB Linux Setup Instructions "on my fingertip" (i.e. The iPad paste buffer) from using in an offline email. May not be all applicable to Pi, I'd like the Pi gurus to comment. I'll paste it now, before I inadvertently "wash it off" my finger ? ??.

Generic USB Linux Setup
==================
Open a Terminal window and put in this command ?EXACTLY (except for the double quotes):
"while : ;do clear;ls -lt /dev|head;i=$((i+1));echo $i;sleep 1;done"
Press ENTER and watch the screen as you slowly ?plug/unplug the USB device, watching what device appears/disappears and record the name. If nothing appears/disappears your device is not loading a driver.

You will also need to enter the following command EXACTLY (except for the double quotes):
"sudo adduser ${USER} dialout"
? ?(This assumes "dialout" is the group shown beside your device in the list above.)

Do not:
* ?Try to bypass group membership by running as root. That will create further problems.
* Try to change permissions of the serial port you see. They will be lost every time you plug/unplug/logout/reboot.

Then logout and back in again so the group membership takes effect.

Then go to JMRI Preferences->Connections and the device name you saw earlier should be in the dropdown list once you select a serial connection.

In your case set up connection as NCE Power Pro Serial as per:
<>

If you are still having problems, you need to check the /var/lock directory and remove any stale lock files for the device. This can particularly be a problem if you have ever run JMRI as root.

--?
Dave in Australia

The New England Convention 2018

On 27 Jul 2018, at 2:52 AM, cmitcham@... wrote:

tonight is train night, so i'll be back at it. I'm interested to see the output of the new usb check commands I have seen here. I have always just relied on "dmesg" to show status when I plug or unplug a usb device from Linux.

jim, you had one line... "Note and possibly of importance no other adapter connected" ... was that? a list of adapters that worked with the pi but didn't play well with nce?


 

with you guys'?advice back in july, i simply replaced the suspect adapter with a new one, and all has been great. until now :(

all of a sudden, the pi does not know the serial assignments for the usb dongles at boot-up. (one for cmri, one for nce command station). if i unplug them both and plug them back in, then they are there and everything works fine. i forget which pi version this is, it has 4 usb ports but pre-wifi.

anyway, i see this system on thursdays, and next week i plan to try some persistence tricks with /etc/udev/rules.d/* and symlink. i just think it is odd that it has worked fine until now.

thanks for any thoughts.
calvin.