User avatar
danpeirce
Posts: 100
Joined: Thu May 10, 2012 8:32 am
Location: Richmond & Surrey BC Canada
Contact: Website

Re: FTDI USB Serial Hangs

Wed Aug 29, 2012 6:29 am

I am finding I am having the same issue of the rpi hanging if I open and close /dev/ttyUSB0 several times. In my case it is a PHP page that is accessing /dev/ttyUSB0. It typically works fine six or more times then hangs (so far as I can tell with a headless setup).

On the other hand when I am using minicom and keeping /dev/ttyUSB0 open I have no issues.

Details at http://danpeirce.net46.net/dokuwiki/dok ... r_option_5

and

http://danpeirce.net46.net/dokuwiki/dok ... l_option_1

Freemann
Posts: 10
Joined: Wed Jun 27, 2012 8:20 pm

Re: FTDI USB Serial Hangs

Thu Aug 30, 2012 7:39 am

I also use a php script, but also a C program that uses the tty/usbX.

Both are hanging the Rpi and its very annoying!

It looks like a hardware problem on the Rpi. All my other hardware is working properly with these converters and the Rpi hangs within several seconds.....

User avatar
danpeirce
Posts: 100
Joined: Thu May 10, 2012 8:32 am
Location: Richmond & Surrey BC Canada
Contact: Website

Re: FTDI USB Serial Hangs

Tue Sep 04, 2012 12:29 am

danpeirce wrote:I am finding I am having the same issue of the rpi hanging if I open and close /dev/ttyUSB0 several times. In my case it is a PHP page that is accessing /dev/ttyUSB0. It typically works fine six or more times then hangs (so far as I can tell with a headless setup).

On the other hand ...
I don't seem to have the same issue with a C program I wrote as with the PHP code (with the C program I can run it over and over again and it does not hang the port and LAN as the PHP code did).

see http://danpeirce.net46.net/dokuwiki/dok ... 0_option_6

dauhee
Posts: 59
Joined: Fri Sep 07, 2012 1:50 pm

Re: FTDI USB Serial Hangs

Fri Sep 07, 2012 3:36 pm

I have a ver 2 board. updated firmware via rpi-update. a PL2303 usb to serial converter connected directly into the RPi with no other usb devices attached. I can open/close the port a number of different times ranging from 5 to 30 but they all end with the dreaded hang.

Kemp
Posts: 29
Joined: Tue Jul 03, 2012 12:56 pm

Re: FTDI USB Serial Hangs

Fri Sep 07, 2012 5:35 pm

Just to add my own experience, I have a peripheral with a FT232BM chip in. Opening /dev/ttyUSB0 results in an immediate hang (with no other USB peripherals plugged in).

From what I've read here and on other threads, there seem to be two distinct problems we are hitting: 1) a conflict between high speed and low speed devices on the same bus and 2) a buggy implementation of the USB-serial driver for older chips.

From what I've read, the former is (hopefully) being solved in the elephant thread. The latter, unfortunately, seems to be the issue I have.

dennyfmn
Posts: 33
Joined: Thu Aug 16, 2012 1:36 pm
Location: Minnesota/California USA

Re: FTDI USB Serial Hangs

Fri Sep 07, 2012 8:37 pm

Updating to the latest kernel, dated Sat Sep 1, from the Raspberry Pi foundation did not resolve my issue.

My looping test with the Smarthome Insteon PLM (Power Line Modem) with embedded Future Technology Devices International, Ltd FT232 USB-Serial (UART) hung after 1759 sec (29.3 min). This may be a bit of an improvement or just random data. The previous kernel ran this test for 662 seconds before dying.

Code: Select all

[email protected]:~# uname -a
Linux raspbian 3.2.27+ #102 PREEMPT Sat Sep 1 01:00:50 BST 2012 armv6l GNU/Linux

mikepont
Posts: 2
Joined: Sun Sep 09, 2012 4:26 am

Re: FTDI USB Serial Hangs

Sun Sep 09, 2012 4:34 am

Same here with latest Raspbian image
Distribution: Debian GNU/Linux wheezy/sid
Kernel: Linux 3.2.27+ armv6l
Firmware: #114 PREEMPT Tue Sep 4 00:15:33 BST 2012
tried two different FTDI USB to RS485 converters - both hang the raspberry pi within an hour or two of writing and reading serial data
Both of these work fine on a Fedora 16 server
oh well looks like this project is on hold for the time being - might try a Beaglebone but that at least doubles the cost of my project

mikepont
Posts: 2
Joined: Sun Sep 09, 2012 4:26 am

Re: FTDI USB Serial Hangs

Mon Sep 10, 2012 3:26 am

I might try interfacing an RS485 driver chip directly with the GPIO serial pins - this will avoid the USB problem completely

KarlAustin
Posts: 1
Joined: Mon Sep 10, 2012 12:52 pm

Re: FTDI USB Serial Hangs

Mon Sep 10, 2012 1:13 pm

Another FTDI user here who would very much like to see it working. I have 3 Pi I want to deploy right now, but they depend on me getting USB -> at least 4 serial working :(

kilroy1205
Posts: 7
Joined: Wed Sep 12, 2012 3:21 pm

Re: FTDI USB Serial Hangs

Wed Sep 12, 2012 3:30 pm

Same Problem here, ftdi232bm hangs the pi after opening the port.
The ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port hangs the after randomly after one or two days.

Code: Select all

Linux raspberrypi 3.2.27+ #143 PREEMPT Tue Sep 11 02:02:37 BST 2012 armv6l GNU/Linux

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5380
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: FTDI USB Serial Hangs

Thu Sep 13, 2012 9:01 pm

Gordon's update is in the latest rpi-udpate kernel. It holds off responding to the NAKs generated by these deviced to reduce the high rate of interrupts.

The fiq fix is now enabled by default, as is Gordon's new patch (you can disable it with dwc_otg.nak_holdoff_enable=0 if you suspect it of causing problems).
Let us know is anything new is broken, or anything is improved.

dmaunder
Posts: 7
Joined: Fri Sep 14, 2012 8:12 am

Re: FTDI USB Serial Hangs

Fri Sep 14, 2012 8:17 am

I am using a Raven USB stick that talks via Zigbee to a Smart Power meter.

I am not getting the hangs, because I am not getting that far trying to use the D2XX drivers.

I have followed the read me from http://www.ftdichip.com/Drivers/D2XX/Li ... -linux.txt , and get to the point where it says:


With an FTDI device connected to a USB port, try one of the
examples, e.g. reading EEPROM.

3. cd EEPROM/read
4. sudo ./read

I then get the error:

./read: error while loading shared libraries: libftd2xx.so: cannot open shared object file: No such file or directory

The library is in the correct folder:

[email protected] ~/release/examples/EEPROM/read $ ls /usr/local/lib
libftd2xx.a libftd2xx.so.1.1.12 python2.7
libftd2xx.so python2.6 python3.2

I am pretty new to Pi and Linux, sorry if this is a newbie question.

Daryl

kilroy1205
Posts: 7
Joined: Wed Sep 12, 2012 3:21 pm

Re: FTDI USB Serial Hangs

Fri Sep 14, 2012 1:54 pm

dom wrote: Let us know is anything new is broken, or anything is improved.
Hello Thank you all for working on this bug.
My first quick test results:

Test with ftdi232bm
after connection no problem:

Code: Select all

[email protected] ~ $ uname -a
Linux raspberrypi 3.2.27+ #148 PREEMPT Thu Sep 13 21:36:23 BST 2012 armv6l GNU/Linux

[   93.039404] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[   93.142175] usb 1-1.2: New USB device found, idVendor=0403, idProduct=6001
[   93.142206] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   93.142223] usb 1-1.2: Product: USB <-> Serial
[   93.142235] usb 1-1.2: Manufacturer: FTDI
[   93.210462] usbcore: registered new interface driver usbserial
[   93.212207] USB Serial support registered for generic
[   93.214058] usbcore: registered new interface driver usbserial_generic
[   93.214087] usbserial: USB Serial Driver core
[   93.229078] USB Serial support registered for FTDI USB Serial Device
[   93.230382] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
[   93.230996] usb 1-1.2: Detected FT232BM
[   93.231022] usb 1-1.2: Number of endpoints 2
[   93.231038] usb 1-1.2: Endpoint 1 MaxPacketSize 64
[   93.231054] usb 1-1.2: Endpoint 2 MaxPacketSize 64
[   93.231067] usb 1-1.2: Setting MaxPacketSize 64
[   93.232410] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
[   93.234281] usbcore: registered new interface driver ftdi_sio
[   93.234308] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver

Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Then i tested the Solar inverter Software aurora to get data from the inverter (no hardware connected, only the usb2rs485 with ftdi232bm)

Code: Select all

[email protected] ~ $ aurora -a2 -b  -e /dev/ttyUSB0 

aurora -a2 -b -e /dev/ttyUSB0 

szttyDevice: /dev/ttyUSB0
yDelay:     1
yTimeout    0 mS
yMaxRunTime ~
devLCKfile: </var/lock/LCK..ttyUSB0>
devLCKfileNew: </var/lock/LCK..ttyUSB0.2452>
Got Params

RunTime 20120914-15:40:23 v1.8.3 
Endian : Little
PID : 2452

Attempting to get lock on Serial Port /dev/ttyUSB0...
Checking for lock

Checking process 2452 for lock
rPID: 2452 SubStrPos: aurora command: aurora = me
Appears we got the lock.

Opening Serial Port /dev/ttyUSB0...  
Now the pi do nothing, just hang.


Same test with pl2303:

Code: Select all



Bus 001 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port



[  115.899068] usb 1-1.2: USB disconnect, device number 4
[  115.999960] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
[  116.000036] pl2303 1-1.2:1.0: device disconnected
[  119.719819] usb 1-1.2: new full-speed USB device number 5 using dwc_otg
[  119.821441] usb 1-1.2: New USB device found, idVendor=067b, idProduct=2303
[  119.821475] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  119.821492] usb 1-1.2: Product: USB-Serial Controller
[  119.821506] usb 1-1.2: Manufacturer: Prolific Technology Inc.
[  119.825395] pl2303 1-1.2:1.0: pl2303 converter detected
[  119.828900] usb 1-1.2: pl2303 converter now attached to ttyUSB0


[email protected] ~ $ aurora -a2 -b -e /dev/ttyUSB0

aurora -a2 -b -e /dev/ttyUSB0 

szttyDevice: /dev/ttyUSB0
yDelay:     1
yTimeout    0 mS
yMaxRunTime ~
devLCKfile: </var/lock/LCK..ttyUSB0>
devLCKfileNew: </var/lock/LCK..ttyUSB0.2535>
Got Params

RunTime 20120914-15:46:48 v1.8.3 
Endian : Little
PID : 2535

Attempting to get lock on Serial Port /dev/ttyUSB0...
Checking for lock

Checking process 2535 for lock
rPID: 2535 SubStrPos: aurora command: aurora = me
Appears we got the lock.

Opening Serial Port /dev/ttyUSB0...  Serial Port /dev/ttyUSB0 successfully opened.
Configuring serial device... Flushing unread data first...  Success!
Flushing serial device buffer... Success!

Comm Check: Let's see if the Aurora is listening... 
Elapsed time since last comm 0 us
Attempt 1
Clearing read buffer Success!
szSerBufferSave OK! 02 3a 00 00 00 00 00 00 00 00 
command: 02 3a 00 00 00 00 00 00 01 b7 
Flushing serial device buffer... Success!
Sending command... sent 10 characters
Draining serial device buffer... Success!
Cleared data buffer: 00 00 00 00 00 00 00 00 00 00 
Read char #1 RC=0 (00) waited/max    92940/1000000  uS 
answer:  Got -1 characters
Comm Check: Failure, aborting...

Restoring Serial Port settings /dev/ttyUSB0... Success!
Flushing serial device buffer... Success!
Closing Serial Port /dev/ttyUSB0... Success!

devLCKfile: </var/lock/LCK..ttyUSB0>
devLCKfileNew: </var/lock/LCK..ttyUSB0.2535>
Clearing Serial Port Lock (2535)... done.

20120914-15:46:49: aurora: ERROR: Received bad return code (-1 0)

Complete 20120914-15:46:49

Thas the same like before the patch, but the longt day test with the plc is ongoing
hope this helps

User avatar
k4gbb
Posts: 52
Joined: Sun Aug 12, 2012 5:33 am
Location: Dunnellon, FL USA - EL88tx

Re: FTDI USB Serial Hangs

Sat Sep 15, 2012 1:58 am

Daryl,
Did you install the link?
sudo ln –s libftd2xx.so.1.1.12 libftd2xx.so
I dropped the -s because nether was a Dir.

I'm fighting the same battle with the FTDI interfade in a TNC-X.
With the additional FTDI RT libs I can get the TNC to send and receive data, but it locks the system up
after awhile.

The instructions in the PDF say to remove the usbserial module and the ftdi_sio module then power cycle or reset the device. With a remote site this is a real pain in the *,

<<Charley>>
ARS K4GBB

<<Charley>
The Grass may be greener on the other side of the fence, but it still has to be mowed.

kilroy1205
Posts: 7
Joined: Wed Sep 12, 2012 3:21 pm

Re: FTDI USB Serial Hangs

Sun Sep 16, 2012 8:25 am

After 3 days a little review.

Code: Select all

Bus 001 Device 005: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
The PC2303 ist now working for 3 Days without any Problem. But the ftdi232bm hang the pi at the first connection to the port.

There are no messages. Can i do anything to get some debug messages?

Sven

meknow0
Posts: 2
Joined: Mon Sep 17, 2012 10:13 am

Re: FTDI USB Serial Hangs

Mon Sep 17, 2012 10:32 am

I just wanted to echo Daryl's (dmaunder) earlier problem with loading the libftd2xx library, following the readme file.
When trying to run the first example I too am getting,

./read: error while loading shared libraries: libftd2xx.so: cannot open shared object file: No such file or directory

I'm fairly sure I've followed the instructions correctly and have the symbolic link in /usr/local/lib.
Anybody have a suggestion what we're doing wrong? Do I need to do something to get /usr/local/lib in the path for root or sudo use?
I'm getting limited chance to tinker unfortunately. Since my FT232R USB-RS485 adapter works fine from a Fedora 17 laptop and from Windows XP, I was expecting the Rasberry Pi to have no issues. Very disappointed with these problems and not really sure if the new library is going to help anyway.
PS, I'm trying to interface to a Fronius IG TL Inverter for solar panel logging to pvoutput.org. The code works but not on the Pi. :-(

gonesurfing
Posts: 7
Joined: Wed Aug 22, 2012 1:13 am

Re: FTDI USB Serial Hangs

Wed Sep 19, 2012 12:56 am

After a recent update, my device is now working with the cat command and perl read() without invoking screen first.
I'm having similar troubles with an FTDI converter accessing an xbee module. I can't access /dev/ttyUSB0 with cat, tail, or any perl script. However, I found that not only will screen access the device, but after running it I can access it with any normal method including cat.

I need to be able to run a perl script at startup that access ttyUSB, so I am currently looking for some sort of workaround using screen. Possibly, something similar to launching screen with a non-recognized command that will take control of the port and allow normal access.

relevant dmesg output below.

Code: Select all

 5.957681] ftdi_sio 1-1.3:1.0: FTDI USB Serial Device converter detected
[    6.271705] usb 1-1.3: Detected FT232RL
[    6.357296] usb 1-1.3: Number of endpoints 2
[    6.364055] usb 1-1.3: Endpoint 1 MaxPacketSize 64
[    6.484717] usb 1-1.3: Endpoint 2 MaxPacketSize 64
[    6.567253] usb 1-1.3: Setting MaxPacketSize 64
[    6.695408] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0
[    6.787454] usbcore: registered new interface driver ftdi_sio
[    6.795483] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver

Varol Keskin
Posts: 2
Joined: Wed Sep 19, 2012 8:12 pm

Re: FTDI USB Serial Hangs

Wed Sep 19, 2012 8:26 pm

I was trying USB to Serial adapter for some relays but pi hanged every time. I've searched for post on the net about the solution of this problem and found that some people managed to run some FTDI devices. Today I bougth a new USB to Serial device which has FT232RL chipset, as adviced some users. This device solved my problem and I am now using serial port of pi for my relays.

If some other pi users have same hanging problem, this would help. :D

dennyfmn
Posts: 33
Joined: Thu Aug 16, 2012 1:36 pm
Location: Minnesota/California USA

Re: FTDI USB Serial Hangs

Thu Sep 20, 2012 11:14 pm

Updating to the latest kernel, dated Mon Sep 17, from the Raspberry Pi foundation did not resolve my issue. This is the new one just announced that supports overclocking without voiding your warranty. My Pi would not run at 1 GHz, but it seems to run fine at 950 MHz.

My looping test with the Smarthome Insteon PLM (Power Line Modem) with embedded Future Technology Devices International, Ltd FT232 USB-Serial (UART) hung after only 91 sec requiring a power down/up to clear.

Since I must run with the embedded FT232, and have no option of changing, I hope someone comes up with a fix for all the older devices that don't work :)

Code: Select all

[email protected]:~# uname -a
Linux raspbian 3.2.27+ #160 PREEMPT Mon Sep 17 23:18:42 BST 2012 armv6l GNU/Linux

Jbravo
Posts: 3
Joined: Fri Sep 21, 2012 8:13 am

Re: FTDI USB Serial Hangs

Fri Sep 21, 2012 9:41 am

My first post on the forum. I received my RPi yesterday, everything went smoothly until I connected my usb-cardreader...then the RPi hung :(

Running latest Raspbian “wheezy”;

Code: Select all

Linux raspberrypi 3.2.27+ #160 PREEMPT Mon Sep 17 23:18:42 BST 2012 armv6l GNU/Linux
The cardreader got an embedded FT232BM, and that seems to be the reason for the hang.

I found another thread on the topic, http://www.raspberrypi.org/phpBB3/viewt ... 0&p=164658

The thread above suggest to force usb full speed in cmdline.txt, that change actually fix the issue. But running in usb full speed is not feasible in my little project (Tvheadend with DVB receiver).

Also found an issue about this, waiting for feedback.
https://github.com/raspberrypi/linux/issues/40

kilroy1205
Posts: 7
Joined: Wed Sep 12, 2012 3:21 pm

Re: FTDI USB Serial Hangs

Fri Sep 21, 2012 1:58 pm

Hello,
thanks for the tip dwc_otg.speed=1

Code: Select all

Linux raspberrypi 3.2.27+ #160 PREEMPT Mon Sep 17 23:18:42 BST 2012 armv6l GNU/Linux
[ 8808.331054] usb 1-1.2: new full-speed USB device number 5 using dwc_otg
[ 8808.436153] usb 1-1.2: New USB device found, idVendor=0403, idProduct=6001
[ 8808.436186] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 8808.436203] usb 1-1.2: Product: USB <-> Serial
[ 8808.436216] usb 1-1.2: Manufacturer: FTDI
[ 8808.441555] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
[ 8808.441727] usb 1-1.2: Detected FT232BM
[ 8808.441745] usb 1-1.2: Number of endpoints 2
[ 8808.441761] usb 1-1.2: Endpoint 1 MaxPacketSize 64
[ 8808.441810] usb 1-1.2: Endpoint 2 MaxPacketSize 64
[ 8808.441826] usb 1-1.2: Setting MaxPacketSize 64
[ 8808.444376] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
After some quick tests, it look like that the cmdline.txt with dwc_otg.speed=1 solve the Problem with ftdi232bm

Code: Select all

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait dwc_otg.microframe_schedule=1 sdhci-bcm2708.enable_llm=1 sdhci-bcm2708.sync_after_dma=0 dwc_otg.fiq_fix_enable=1 rootwait dwc_otg.speed=1
I hope the problem can solved without these dwc_otg.speed=1 option.

Regards
Sven

Kemp
Posts: 29
Joined: Tue Jul 03, 2012 12:56 pm

Re: FTDI USB Serial Hangs

Fri Sep 21, 2012 9:49 pm

It works perfectly for me now with the latest updates and the dwc_otg.speed=1 option (with the BM variant). I didn't look into this option before as I only saw it mentioned in relation to devices of different speeds conflicting and this device is the only one I have plugged in.

Jbravo
Posts: 3
Joined: Fri Sep 21, 2012 8:13 am

Re: FTDI USB Serial Hangs

Sat Sep 22, 2012 2:27 pm

Well, the network adapter is connected internally via USB...

IRQ
Posts: 35
Joined: Thu Aug 09, 2012 4:56 pm

Re: FTDI USB Serial Hangs

Sun Sep 23, 2012 1:58 pm

First of all I want to say thanks to the people looking into this issue!

Last night I updated to latest kernel and added the cmdline that Kilroy1205 suggested above and I'm happy to say that now my FTDI USB <-> Serial adapter (using FT8U232AM IC) are not hanging the RasPi when accessed, will do some more testing today...

Naza
Posts: 2
Joined: Mon Sep 24, 2012 7:01 pm

Re: FTDI USB Serial Hangs

Mon Sep 24, 2012 7:09 pm

Just to add to this, (first post on here) the mod to cmdline suggested by kilroy1205 is working here also on FTDI BM chipset which up this point has been extremely problematic with locking up. will continue to test but this is the furthest i have ever got.

At least i can now continue developing the home automation project i have been working on.

I would buy you a beer if i could!!!

Return to “Interfacing (DSI, CSI, I2C, etc.)”