[Ftdi-usb-sio-devel] Strange behaviour discovered
Brought to you by:
bryder
From: Valentin K. <val...@go...> - 2013-02-07 21:43:04
|
Hello everyone, For those who may be interessted (yeah, i'm laughing too :D): I have written a year ago regarding low baudrates. The problem was solved a couple of days later: The reading device was not fast enough to process the input. The solution was (in this case :D) to increase stop-bits to 2. To understand what I am talking about I first need to explain what is the environment: I am working on an high-speed electricity measurement device. This device is run by an Atmel AtMega1280 (18 Mhz) and uses the "Bus 003 Device 009: ID 0403:6010 Future Technology Devices International, Ltd FT2232C Dual USB- UART/FIFO IC" FTDI chip for communication. The communication partners are standard personal computers running ubuntu 12.10 (linux 3.2.0-35-generic). Those machines run a variety of perl-scripts to communicate with the device. The scripts are using the "Device::SerialPort" package. As you can see from the lsusb output the ftdi chip offers two serial ports. They are both used for the communication with the device and opened / closed independently. A couple of weeks ago someone stated that he "could not connected to the device" when using some scripts multiple times. My first though was: Broken scripts, however i have discovered that they are not and further more that the problem may lie in other system components. It "sometimes" happen that closing one serial port while the other one is opened, both serial ports some kind of get broken. With broken I mean concretely: The posix call "open(serialPort, O_RDWR | O_NOCTTY | O_NONBLOCK) blocks a while (on my machine, 17 seconds) and the driver prints errors to the kernel log. Afterwards the serial port is opened and works for the "session". When closing and reopening the port, it randomly opens correctly or not. Those errors are printed to kernel log: [18033.824011] ftdi_sio ttyUSB1: ftdi_set_termios FAILED to set databits/stopbits/parity [18034.776535] ftdi_sio ttyUSB0: ftdi_set_termios urb failed to set baudrate [18044.762011] ftdi_sio ttyUSB0: urb failed to clear flow control I was able to reproduce this behaviour with 100% hit rate. I have written a small C-programm that just opens and closes a serialport forever. Running this programm twice, one for each port, will result in hanging "open(...)" syscalls. The programm is attached. As i am no driver developer nor chip expert i cannot say whats going on and seek for help. I speculated that it could be a reentrance problem within the ftdi-driver or another kernel module (i could be really wrong :D), or the chip does things I do not understand :D Many thanks in advance Valentin Kautz |