FTDI USB Serial Hangs


131 posts   Page 1 of 6   1, 2, 3, 4, 5, 6
by stevewardell » Sun Jun 10, 2012 10:07 am
I, like a few others, have been having various problems using USB/Serial adapters with RPi. One of them is the FTDI adapter and so far my search for an answer has been unsuccessful.

The problem is the device is recognised by RPi and lists correctly from dmesg

Code: Select all
usb 1-1.2.3: new full speed USB device number 5 using dwc_otg
usb 1-1.2.3: New USB device found, idVendor=0403, idProduct=6001
usb 1-1.2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1.2.3: Product: USB <-> Serial
usb 1-1.2.3: Manufacturer: FTDI
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for FTDI USB Serial Device
ftdi_sio 1-1.2.3:1.0: FTDI USB Serial Device converter detected
usb 1-1.2.3: Detected FT232BM
usb 1-1.2.3: Number of endpoints 2
usb 1-1.2.3: Endpoint 1 MaxPacketSize 64
usb 1-1.2.3: Endpoint 2 MaxPacketSize 64
usb 1-1.2.3: Setting MaxPacketSize 64
usb 1-1.2.3: FTDI USB Serial Device converter now attached to ttyUSB0
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver


But as soon as you try to access the device it hangs the RPi requiring a reset.

I do not know what the problem is, the FTDI driver has been part of the kernel for some time, the avenue I am pursuing now is that the driver is not ARM compatible, the FTDI web site doesn't list an ARM linux driver (cant say if that's even relevant).

There is this http://www.ftdichip.com/Support/Documen ... ndroid.pdf regarding cross compiling to ARM (for Android).

So my train of thought is that the current driver is not ARM compatible and requires compiling for ARM, with all that entails and the pitfalls associated.

However I may be barking up completely the wrong tree so any more experienced kernel/driver peeps with a thought?
Steve
@stevewardell
stevewardell.wordpress.com
Posts: 16
Joined: Thu Jun 07, 2012 9:15 pm
by selsinork » Sun Jun 10, 2012 2:36 pm
Works For Me (tm) on a R-Pi, albeit with a slightly newer ftdi chip. Using 'screen /dev/ttyUSB0', so no driver problem as such.

My first thought would be power supply problem, but it's possible that your FT232BM is somehow the problem as mine is a FT232RL

Code: Select all
[ 3425.039231] usbcore: registered new interface driver usbserial
[ 3425.039251] usbserial: USB Serial Driver core
[ 3425.044142] USB Serial support registered for FTDI USB Serial Device
[ 3425.044690] usbcore: registered new interface driver ftdi_sio
[ 3425.044708] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
[ 3474.143681] usb 1-1.2: new full speed USB device number 4 using dwc_otg
[ 3474.251090] usb 1-1.2: New USB device found, idVendor=0403, idProduct=6001
[ 3474.251118] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3474.251133] usb 1-1.2: Product: FT232R USB UART
[ 3474.251144] usb 1-1.2: Manufacturer: FTDI
[ 3474.255242] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
[ 3474.255618] usb 1-1.2: Detected FT232RL
[ 3474.255637] usb 1-1.2: Number of endpoints 2
[ 3474.255649] usb 1-1.2: Endpoint 1 MaxPacketSize 64
[ 3474.255661] usb 1-1.2: Endpoint 2 MaxPacketSize 64
[ 3474.255672] usb 1-1.2: Setting MaxPacketSize 64
[ 3474.256656] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
Posts: 151
Joined: Mon Apr 16, 2012 8:31 am
by stevewardell » Sun Jun 10, 2012 3:09 pm
Thanks for posting, that's useful to know. I'm glad it seems I was barking up the wrong tree and the problem may be nothing more than an older chipset v's a newer one

I cant see how it can be power, even without a powered hub these devices draw less than 25mA, but the problem persists with a powered hub.

I get the same hang using screen

Can you post a link or more info on your adapter, the easy option is to buy the same as the one you have
Steve
@stevewardell
stevewardell.wordpress.com
Posts: 16
Joined: Thu Jun 07, 2012 9:15 pm
by stevePIman » Sun Jun 10, 2012 4:36 pm
Mine's hanging too when using an LCD via USB. The logs indicate FT8U232AM is detected.
Posts: 12
Joined: Tue May 29, 2012 8:07 am
by stevewardell » Sun Jun 10, 2012 4:53 pm
The FT232BM and FT8U232AM are both, according the FTDI web site older (discontinued) lines, so its quite possible the that the FTDI drivers in the kernel are no longer supporting them.

On that basis I've ordered an FT232R based cable from http://www.tronisoft.com/cat_usbtoseria ... fAodqiKKZQ I guess we will see if that works when it arrives, I'll post back the results
Steve
@stevewardell
stevewardell.wordpress.com
Posts: 16
Joined: Thu Jun 07, 2012 9:15 pm
by selsinork » Sun Jun 10, 2012 9:15 pm
Ok, but not sure how useful it is...

Get one of these http://uk.farnell.com/ftdi/ft232rl/ic-usb-to-uart-smd-ssop28-232/dp/1146032

Take this cct diagram:
http://i.imgur.com/ieiTv.png

and build this:
http://i.imgur.com/Aqggg.jpg

plug it into the Pi using the standard in-kernel driver in 3.1.9...

I built this in early 2009 and the FT232BM was already obsolete back then, gives you an idea just how out of date they are. IIRC the FT8U232AM is even older. I'd be surprised if the driver doesn't support them, but it could simply be that nobody has one to test with anymore.
Posts: 151
Joined: Mon Apr 16, 2012 8:31 am
by stevewardell » Tue Jun 12, 2012 10:25 am
great news, the new FTDI adapter worked fine


usb 1-1.2.1: new full speed USB device number 5 using dwc_otg
usb 1-1.2.1: New USB device found, idVendor=0403, idProduct=6001
usb 1-1.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.2.1: Product: USB Serial Converter
usb 1-1.2.1: Manufacturer: FTDI
usb 1-1.2.1: SerialNumber: FTFWT6IX
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for FTDI USB Serial Device
ftdi_sio 1-1.2.1:1.0: FTDI USB Serial Device converter detected
usb 1-1.2.1: Detected FT232RL
usb 1-1.2.1: Number of endpoints 2
usb 1-1.2.1: Endpoint 1 MaxPacketSize 64
usb 1-1.2.1: Endpoint 2 MaxPacketSize 64
usb 1-1.2.1: Setting MaxPacketSize 64
usb 1-1.2.1: FTDI USB Serial Device converter now attached to ttyUSB0
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver

so the older chipset is not working with the current kernel driver but the newer chipset is, this solves my problem.
Steve
@stevewardell
stevewardell.wordpress.com
Posts: 16
Joined: Thu Jun 07, 2012 9:15 pm
by selsinork » Wed Jun 13, 2012 11:28 am
stevewardell wrote:so the older chipset is not working with the current kernel driver but the newer chipset is, this solves my problem.


the 3.1.9 kernel isn't exactly current :) Looking at the current linux mainline - 3.5-rc2 - there's been quite a few changes to the ftdi_sio driver. So it's entirely possible that the older chips could start working with some of those changes applied.
Posts: 151
Joined: Mon Apr 16, 2012 8:31 am
by mc1970 » Wed Jun 27, 2012 11:05 am
I too have the FT232BM revision of the chip and am experiencing the same hangs. This problem doesn't happen with the i386 debian so must be a bug exclusive to the ARM(pi) code. I don't see why I should throw away a perfectly good piece of hardware so have reported it to FTDI themselves. Hopefully from that they'll get us a fixed version. Fingers crossed, we live in hope :P
Posts: 2
Joined: Thu Jun 21, 2012 6:17 pm
by stevePIman » Mon Jul 02, 2012 12:40 pm
Hi,

FTDI support have just let me know that there are some FTDI drivers specifically for the Pi. I'll hopefully try them this week.

Try here: http://www.ftdichip.com/Drivers/D2XX.htm

Big thank you to FTDI for these.

Steve
Posts: 12
Joined: Tue May 29, 2012 8:07 am
by selsinork » Mon Jul 02, 2012 2:07 pm
It's worth noting that the D2xx stuff isn't so much a driver as it's a port of their windows dll over to linux. Nothing wrong with that as such, but I wouldn't expect normal /dev/ttyUSBn style linux serial port access. You'll have to build your own apps to their API.

Also as they don't provide source, you'll be limited to what they provide, probably armel/soft float. That'll probably make Raspian a problem unless they release an armhf (ARMv6+VFP for Raspbian IIRC) version as well
Posts: 151
Joined: Mon Apr 16, 2012 8:31 am
by stevePIman » Mon Jul 02, 2012 3:01 pm
Thanks for the clarification
Posts: 12
Joined: Tue May 29, 2012 8:07 am
by selsinork » Mon Jul 02, 2012 4:34 pm
Oh, should have mentioned, if a different-than-kernel-driver API is interesting then you can also look at the libftdi stuff here http://www.intra2net.com/en/developer/libftdi/
It won't match up with the ftdi D2xx library, but the intention is similar - to give you access to more of the capabilities of the ftdi chips. Open source, so can be built for anything and I'd be surprised if it's not in Debian already (didn't check).
Posts: 151
Joined: Mon Apr 16, 2012 8:31 am
by mc1970 » Mon Jul 02, 2012 4:55 pm
I've used the driver using debian linux on my laptop without any problems so I see no reason as to why the arm(pi) compiled versions should behave any different.

I've tried both the kernel modules plus built the vendor's website supplied ones without any success.
I would hope they're working on fixing this. There must be a lot of people out there with the same chip revision no matter how out of date it is.
Posts: 2
Joined: Thu Jun 21, 2012 6:17 pm
by selsinork » Mon Jul 02, 2012 5:52 pm
mc1970 wrote:I've used the driver using debian linux on my laptop without any problems so I see no reason as to why the arm(pi) compiled versions should behave any different.

Your laptop uses the same SoC as the Pi ? If not, then the comparison isn't necessarily valid, different hardware, different usb host controller, there could be some endianness issue, the compiler used to build the RPi kernel could have produced crap code, the kernel on your laptop is a different one from what's on the Pi (and has a fix the Pi kernel doesn't) or a million other reasons it doesn't work.

One thing that springs to mind is that the Pi has it's challenges with USB, perhaps there's some conflict between the usb controller on the Pi and the older ftdi chips at a hardware level. Something like that could be difficult to fix.

It probably needs someone with knowledge of the linux usb stack, knowledge of the usb host controller in the RPi, a sample of an old ftdi chip that doesn't work, and an itch they feel like scratching....

mc1970 wrote:I would hope they're working on fixing this.

Who is 'they' ?
Posts: 151
Joined: Mon Apr 16, 2012 8:31 am
by mpfisher » Tue Jul 03, 2012 8:03 am
I would strongly recommend to use newer chips from ftdi. FT232BM is outdated in terms of performance and quite complicated to use (component count). FT232R for example is smaller than FT232BM and you can get it to work with just USB connector and a couple of capacitors on your PCB. Not to mention Virtual Com Port works straight out of the box. I personally use FT2232H chip from FTDI connected to my Pi to read ADC and drive DAC in one of my projects. It works a treat.
Posts: 5
Joined: Sat Mar 03, 2012 9:51 am
by RPiFan » Wed Aug 01, 2012 2:23 pm
mpfisher wrote:I would strongly recommend to use newer chips from ftdi. FT232BM is outdated in terms of performance and quite complicated to use (component count). FT232R for example is smaller than FT232BM and you can get it to work with just USB connector and a couple of capacitors on your PCB. Not to mention Virtual Com Port works straight out of the box. I personally use FT2232H chip from FTDI connected to my Pi to read ADC and drive DAC in one of my projects. It works a treat.


You are right. The FT232R works great. The FT232B(L) is outdated but still sold. However it has been implemented in many many devices which are in the field today.

The FT232BL device is recognised by RPi and lists correctly from dmesg and lsusb. I'm experiencing the same hangs when I open the device.

selsinork wrote:It probably needs someone with knowledge of the linux usb stack, knowledge of the usb host controller in the RPi, a sample of an old ftdi chip that doesn't work, and an itch they feel like scratching....


Would there be someone out there with this knowledge and a FT232B device?
Posts: 3
Joined: Wed Aug 01, 2012 1:42 pm
by zakapatul » Thu Aug 02, 2012 9:25 am
Hello everyone,

I bought my RaspberryPi to integrate it in my home automatioon system but i sadly discovered that my 2 main devices use FTDI chips, moreover both faces the same problem, my RPi crashes when i try to access them...

These devices are the following :

If someone know a working solution to be able to use those FTDI devices, i'm interested :)

PS : How can i know exactly which FTDI chip these devices use ?
Posts: 3
Joined: Thu Aug 02, 2012 9:12 am
by MacJL » Thu Aug 02, 2012 9:43 am
I have the same problem with my automation system. I have 2 FTDI chips. One is working fine (RFXcom rfxtrx433), not the other (Lacrosse WS2300).

Stil no solutions now? Did someone try with a different kernel?
Posts: 7
Joined: Thu Aug 02, 2012 9:40 am
by henriwagner » Fri Aug 03, 2012 12:52 pm
I have new ftdi usb-serial (rs-422) adapter which is recognized as FT232RL chip. And that is correct.
I've application which acquires data from serial device. Program simply opens connection, send few bytes, receives few byte, closes connection and exits.
BUT after executing this program couple of times raspi hangs -> I've to take power off.
So driver works occasionally but finally it always hangs.

Dmesg output:
Code: Select all
[  223.845982] usbcore: registered new interface driver usbserial
[  223.846151] USB Serial support registered for generic
[  223.846300] usbcore: registered new interface driver usbserial_generic
[  223.846332] usbserial: USB Serial Driver core
[  223.863362] USB Serial support registered for FTDI USB Serial Device
[  223.863771] usbcore: registered new interface driver ftdi_sio
[  223.863792] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
[  232.105586] usb 1-1.3: new full speed USB device number 4 using dwc_otg
[  232.214414] usb 1-1.3: New USB device found, idVendor=0403, idProduct=6001
[  232.214452] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  232.214481] usb 1-1.3: Product: USB-RS422 Tester Cable
[  232.214498] usb 1-1.3: Manufacturer: FTDI
[  232.214514] usb 1-1.3: SerialNumber: FTSF83IE
[  232.227378] ftdi_sio 1-1.3:1.0: FTDI USB Serial Device converter detected
[  232.227589] usb 1-1.3: Detected FT232RL
[  232.227624] usb 1-1.3: Number of endpoints 2
[  232.227642] usb 1-1.3: Endpoint 1 MaxPacketSize 64
[  232.227658] usb 1-1.3: Endpoint 2 MaxPacketSize 64
[  232.227673] usb 1-1.3: Setting MaxPacketSize 64
[  232.228803] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0


lsusb output:
Code: Select all
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC


BTW: Supply power is rated ok. Measured 4,90 V TP1-TP2 during data transfer.
Any ideas how to get this chip working?

I think that system hangs either by opening or closing the connection... not during data transfer.
Posts: 5
Joined: Sun Jul 22, 2012 9:02 pm
by MacJL » Fri Aug 03, 2012 3:11 pm
I'e tried with a PL2303 USB to RS232 adapter, and now I have the same issues than henriwagner had.
It worked a couple of time and then the Raspberry hangs.

Moreover, with my other USB 2 RS232 adapter (FTDI), I'm using a different software that keep the device opened. And I have not any problem with it.

Really seems to be an open/close problem.
Posts: 7
Joined: Thu Aug 02, 2012 9:40 am
by henriwagner » Fri Aug 03, 2012 5:49 pm
I think I solved my case...
ftdi kernel driver works fine with FTDI USB-COM422-PLUS1.
I'm shamed to admit but I tried to run application which I had compiled for Synology nas (arm cpu).
So after compiling the source in raspi everything is fine and raspi is now collecting data and saving to sqlite-db.
Posts: 5
Joined: Sun Jul 22, 2012 9:02 pm
by henriwagner » Fri Aug 03, 2012 5:55 pm
zakapatul wrote:If someone know a working solution to be able to use those FTDI devices, i'm interested :)

PS : How can i know exactly which FTDI chip these devices use ?


According to RFXtrx433 user manual (http://www.rfxcom.com/documents/RFXtrx%20User%20Guide.pdf):
Code: Select all
The RFXtrx has the FTDI FT232R USB interface chip installed.
Posts: 5
Joined: Sun Jul 22, 2012 9:02 pm
by henriwagner » Fri Aug 03, 2012 7:17 pm
henriwagner wrote:I think I solved my case...
ftdi kernel driver works fine with FTDI USB-COM422-PLUS1.
I'm shamed to admit but I tried to run application which I had compiled for Synology nas (arm cpu).
So after compiling the source in raspi everything is fine and raspi is now collecting data and saving to sqlite-db.


I was too fast reporting my issue to be solved :(
I modified my application so that it just opens and closes serial port and put it running every 15 seconds. After about 30-50 launch raspi hangs...

if I strace my application with
strace -f -tt -T -v ./myappl
every time the last line traced is:
22:12:13.169085 open("/dev/ttyUSB0", O_RDWR|O_NOCTTY

What should I try next?
Posts: 5
Joined: Sun Jul 22, 2012 9:02 pm
by zakapatul » Sun Aug 05, 2012 12:07 pm
Actually, even with the FT232RL revision which is supposed to be recent and supported, my pi hangs after a few connections...

As others said, the problem appears randomly : my script is executed via cron every 10 minutes. Sometimes my pi hangs after 2 executions, sometimes after 24hours... without obvious reasons...

I think i will modify my scripts to keep the connection opened, i guess it would be an acceptable workaround waiting a real solution ?
Posts: 3
Joined: Thu Aug 02, 2012 9:12 am