michaeljquinn
Posts: 39
Joined: Sun Oct 21, 2012 8:19 am

Re: Problems with serial port adaptors?

Tue Oct 30, 2012 2:11 am

Spoke

hopefully my wifi dongle will be arriving soon (ordered 2 days ago), and then I can try the wireless version. There has been some discussion on the net that setting pi to USB 1.1 has an impact on ethernet performance, although I cant tell the diff via my wired ethernet.

We'll see soon

raspberry314159
Posts: 3
Joined: Sun Feb 10, 2013 9:22 pm

Re: Problems with serial port adaptors?

Sun Feb 10, 2013 9:42 pm

I have been doing some work with my Pi and trying to get "aurora" to communicate
with my solar panel inverter.
I believe I've found a "potential" fix ... (not just for aurora and my solar panel inverter)

I too have found that my Pi locks up after a short while of use.
I have not edited my /boot/cmdline.txt file to force the USB-driver into USB-1.1.
(I use a USB-wifi adapter and did not want to have any loss of performance).

The long-and-short of the fix is to have a simple command PERL script that does the following:

#!/usr/bin/perl
open(TTY, "/dev/ttyUSB0");
while(1) {sleep 1;}

In fact, this script is started auto-magically on boot up using crontab.
I guess the while loop could be replaced with a sleep 99999999.
In reality, the script simply opens up the port (once) but never closes it.
Simply opening the port up does not lock it and it appears that other processes
(like aurora) can continue to use it sucessfully!

With this fix, I have successfully run aurora (and 123solar) for over a week now with no
problems (I'm crossing my fingers now!).

Some background notes may be of assistance

I had a little script that would do the following

#!/bin/bash
a=1
while true
do
stty -F /dev/ttyUSB0
a=$((a+1))
echo $a
sleep 1
done

This script simply loops endlessly and opens up the device file every 1 second.
(stty -F /dev/ttyUSB0 simply reports back on some port parameters like baud rate).
This script would cause the Pi to randomly hang after somewhere between 300 and 3,000 loops.
However, when I open up the port using the PERL script, then I was able to successfully
execute stty script and loop over 35,000 times. That seemed quite a result.

It would be interesting if anyone else finds this "fix" works for them.

123solar pings the solar inverter remarkably regularly (once or more a second)
using aurora. And this process has been running now for over a week.
Before the fix, I would only get about 5-10minutes of operation.

skingchico
Posts: 27
Joined: Mon Dec 10, 2012 5:48 am

Re: Problems with serial port adaptors?

Mon Feb 11, 2013 6:53 am

I am having problems using my "1-wire" interface either using the USB adapter or a USB to serial adapter. After a random amount of time I loose network connection to the Pi. I am also using a USB wireless adapter. I started your perl script and will let it run overnight and cross my fingers. My USB serial adapter is a PL2303 (old adapter). I will try using the DS9490 (USB to 1-wire adapter) tomorrow, which I have also had issues with. I will let you know if it is still running or dead, tomorrow morning. My problem could be the same as yours.

Steve

raspberry314159
Posts: 3
Joined: Sun Feb 10, 2013 9:22 pm

Re: Problems with serial port adaptors?

Mon Feb 11, 2013 7:54 am

I should have mentioned that my USB <-> serial converter is a
USB <-> RS232/RS485 converter using the FTDI chip-set. The
USB-end of the converter is plugged into a powered USB-hub and the
RS485 end plumbed into the solar inverter.

skingchico
Posts: 27
Joined: Mon Dec 10, 2012 5:48 am

Re: Problems with serial port adaptors?

Mon Feb 11, 2013 2:53 pm

Eight hours and it is still running. I have two SSH windows open to the Pi. One is just looping and reading a 1-wire temperature sensor connected PL2303 (USB to serial) and the other is pinging my wireless access point with a 2K packet every point two seconds. After the sun comes up and hits the camper, I will move the Pi to the truck camper, where I have the DS9490, USB 1-Wire system. It is currently using a Router with OpenWrt installed. It operates 24-7 monitoring temperatures and voltages. It has a Bluetooth GPS mounted in the ceiling fan to get location as well as date and time. My long term plan is to switch to the Model A Pi when it becomes available in the US and my hangs go away. It will lower my power consumption some as well as provide a visual display without me having to connect to the web server with a touch pad or laptop while camping.

The frustration is that I have had the Pi sometimes operate this long so I am cautiously excited.

Again, fingers crossed! Whether it works or not. Great work looking for a solution!

Steve

skingchico
Posts: 27
Joined: Mon Dec 10, 2012 5:48 am

Re: Problems with serial port adaptors?

Mon Feb 11, 2013 11:10 pm

Well, it died after just under 6 hours. But, since my setup is so different than yours, it really does not add to your testing. I just had my fingers crossed that it might fix my problems as well. When my cron script gets a temperature from the 1-wire server, it sometimes hangs. So, at the next cron job, it hangs another script and eventually crashes (at least I can no longer access it through the wireless network interface). I have another cron that will kill/restart the 1-wire USB server if I see more than two copies of my script running but the kill (-9) hung Sometimes it kills the process and sometimes it also hangs.

It was worth a try for me since it was so easy to run the test.

Steve

raspberry314159
Posts: 3
Joined: Sun Feb 10, 2013 9:22 pm

Re: Problems with serial port adaptors?

Tue Feb 12, 2013 8:57 am

Sorry to hear that the "fix" didn't work for you.
I'm half expecting my setup to fail at some point as well, but it
is remarkably more reliable than it used to be.
I'm crossing my fingers.

skingchico
Posts: 27
Joined: Mon Dec 10, 2012 5:48 am

Re: Problems with serial port adaptors?

Thu Feb 14, 2013 4:13 am

This morning, I did a kernel update based on http://www.raspberrypi.org/phpBB3/viewt ... 00#p284800 to the latest bleeding edge kernel. It has run all day which, like before, is promising. Before, the syslog had many "failed to read index 000114" or "failed to read index 000118" errors, which seems to be gone now. Probably getting too excited, "again", but I, "again", have my fingers crossed.

Steve

Return to “Troubleshooting”