Arduino Uno assembled in US now available in the Store @arduino & Adafruit #TeamArduinoCC

USB/serial/FTDI problem
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

USB/serial/FTDI problem

by Bartabas on Tue Jul 24, 2012 9:57 am

Hello,

I bought my bone a few days ago, I installed Ubuntu on it and it works perfectly. I installed some additional packages, python modules, as I do it on my desktop. :D

Now I encounter a problem trying to connect via the USB host to a FTDI port on a arduino card.
It works fine with my desktop, but not with the beaglebone. All look like perfect (/dev/ttyUSB0 appears, ftdi module is loaded in the kernel, dmesg seems to be happy, ...).
The ttyUSB0 are configured the same way on both desktop and bone, stty and /sys/kernel/debug/usb/devices are identicals. At bootup, the arduino card is powered up, it blinks its led the normal way. I have no error when I open ttyUSB0 through python. But the communication refuses to work, the arduino card blinks its led claiming an error each time I send data to it from the bone.

Have you an idea of what is wrong ? Do you think it could work using the clent USB port ?

Thank you in advance.
Bartabas
 
Posts: 7
Joined: Thu Jul 05, 2012 11:49 am

Re: USB/serial/FTDI problem

by adafruit_support_bill on Tue Jul 24, 2012 10:26 am

Is the bone pulling DTR low on transmit? That would reset the 'duino.

adafruit_support_bill
 
Posts: 38672
Joined: Sat Feb 07, 2009 10:11 am

Re: USB/serial/FTDI problem

by Bartabas on Tue Jul 24, 2012 10:34 am

Is the bone pulling DTR low on transmit?

Hum, I don't understand your question, I'm not familiar with electronic. But I can say that the duino is not reseted, it simply blinks to signal an error.

Maybe important : I am using a 5V 1.6 Ah (not 2 Ah) power supply. The result is the same whether the duino is powered by the bone through FTDI or by an external lipo battery.

Thanks for your reply.
Bartabas
 
Posts: 7
Joined: Thu Jul 05, 2012 11:49 am

Re: USB/serial/FTDI problem

by adafruit_support_bill on Tue Jul 24, 2012 10:45 am

I don't understand your question

Here's a little background info: http://arduino.cc/playground/Hacking/FTDIAutoReset
But I can say that the duino is not reseted, it simply blinks to signal an error.

It blinks when it resets too. How do you know there is an error?

adafruit_support_bill
 
Posts: 38672
Joined: Sat Feb 07, 2009 10:11 am

Re: USB/serial/FTDI problem

by Bartabas on Tue Jul 24, 2012 11:27 am

It blinks when it resets too. How do you know there is an error?

Yes but in this case it blinks differently : one long blink, 2 s silence, then one medium blink and 2 short ones.
I think there is an error because normally (as it is on my desktop), the duino should answer to a question (in fact, I use the Multiwii Serial Protocol (MSP)). I wrote a python script which works correctly on my desktop. With the bone, the duino gives no answer at all, it simply blinks the way I described above.
I can be seen with simple shell commands, for example:
Code: Select all | TOGGLE FULL SIZE
echo '$M>' > /dev/ttyUSB0; cat /dev/ttyUSB0

gives something on my desktop, nothing on the bone.

Some commands :
Code: Select all | TOGGLE FULL SIZE
alain@omap:~$ stty -F /dev/ttyUSB0  # same on desktop
speed 115200 baud; line = 0;
eof = ^A; min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
alain@omap:~$ sudo cat /sys/kernel/debug/usb/devices # same on desktop
T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0403 ProdID=6001 Rev= 6.00
S:  Manufacturer=FTDI
S:  Product=FT232R USB UART
S:  SerialNumber=AE01A9ZG
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 90mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=ftdi_sio
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
alain@omap:~$ lsmod
Module                  Size  Used by
nfsd                  225010  2
ftdi_sio               30552  0
usbserial              32085  1 ftdi_sio
spidev                  4708  0
snd_soc_tlv320aic3x    32602  0
alain@omap:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


Thanks for your reply.
Bartabas
 
Posts: 7
Joined: Thu Jul 05, 2012 11:49 am

Re: USB/serial/FTDI problem

by adafruit_support_bill on Tue Jul 24, 2012 11:36 am

Not being familiar with what is running on the Arduino, it is difficult to diagnose. Are you sure that the baud-rate of the Arduino sketch matches the speed you are using on the bone?

adafruit_support_bill
 
Posts: 38672
Joined: Sat Feb 07, 2009 10:11 am

Re: USB/serial/FTDI problem

by Bartabas on Tue Jul 24, 2012 11:59 am

Are you sure that the baud-rate of the Arduino sketch matches the speed you are using on the bone?

Yes I am sure. All works on the desktop, and the bone is configurated exactly the same way. The question, in fact, is : is it normal that the USB, on the desktop and the bone, with same drivers and configuration, have a different behaviour ?

Thanks for your patience.
Bartabas
 
Posts: 7
Joined: Thu Jul 05, 2012 11:49 am

Re: USB/serial/FTDI problem

by adafruit_support_bill on Tue Jul 24, 2012 12:17 pm

Serial port driver implementations are all over the place because the RS-232 standard is pretty vague on more than a few things. That is why I asked about the DTR. But if it is the same driver on both platforms, I would expect them to behave the same.

You might try to connect up a terminal emulator in place of the Arduino so you can see what is actually coming over the line.

adafruit_support_bill
 
Posts: 38672
Joined: Sat Feb 07, 2009 10:11 am

Re: USB/serial/FTDI problem

by Bartabas on Wed Jul 25, 2012 4:39 am

Hum, I have to apologize: you were right, the duino is resetted. So your first proposal should be right, the bone is maybe pulling DTR low on transmit. But I have no idea how to deal with that... Could you explain what I have to do to fix this ?

Thanks you very much.
Bartabas
 
Posts: 7
Joined: Thu Jul 05, 2012 11:49 am

Re: USB/serial/FTDI problem (solved, thanks a lot)

by Bartabas on Wed Jul 25, 2012 6:08 am

SOLVED :D Thanks to your first idea, the DTR low.
Diving into the stty manual, I found the parameter to set :
Code: Select all | TOGGLE FULL SIZE
stty -F  /dev/ttyUSB0 -hupcl

It disables sending a hangup signal when the last process closes the tty. Strangely, this option is not listed when querying stty. I hope this could help somebody else.

So thanks a lot, and sorry for my mistake.
Bartabas
 
Posts: 7
Joined: Thu Jul 05, 2012 11:49 am

Re: USB/serial/FTDI problem

by adafruit_support_bill on Wed Jul 25, 2012 6:25 am

Good to hear that you got it working. And thanks for the follow up! Someone may find this useful in the future. :D

adafruit_support_bill
 
Posts: 38672
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.