On Thu, 18 May 2006, Emil Mieilica wrote: > Hello All, > > I am developing a software application that depends on a signal > acquisition card that periodically samples a analog signal. The data > acquisition card is build in house and is using a FTDI 245 BM FIFO USB > chip. The data rate is about 640 k bps and the FTDI chip has a buffer > for only about 4 ms worth of data. > > I noticed that some of the USB transfers are incomplete. The controller > that acquires data tries to send a package to the FIFO queue on the USB > chip and the queue fills so part of the packet gets lost. After this > incomplete packet are are lost due to the fact that the FIFO buffer > doesn't get emptied until some 5-10 ms later. > > We are using a FTDI provided library and also libftdi for reading data > from the device. What I have noticed is that both those libraries do > bulk transfer and operate in user space. > > 1. Is it possible to guarantee for a user space application (that is > using libusb) a query rate of 500 queries per second (once every 2-3 ms) > even if the overall load of the system is high(other pretty intensive > computations happen in the background). This should prove to be enough > given the dimensions of buffers involved.
I suspect it's not possible to provide any sort of performance guarantee to a user program when the system is under high load. Linux is not an RTOS. > 2. To my knowledge, the USB bulk transfer is user initiated so the query > rate is dependent on the ability of the user to submit the requests fast > enough to the kernel. That's only partially true. Each query (the correct term is "URB") can request multiple packet transfers. So you could submit a lot of URBs each for 1 packet, or a few URBs each for many packets, and the results would be pretty much the same -- but the rate of submissions would be different. > The other type of transfer is interrupt transfer > and this occurs periodically and is scheduled by the kernel. Can this > type of transfer be used in my current situation or the transfer mode is > controlled by the actual hardware device (if the FTDI chip does bulk > transfers then only those type of transfers work)? Interrupt and bulk transfers are very similar. If the chip supports bulk then it certainly can support interrupt. However you are right that the transfer mode is determined by the device. No doubt you had to program the FTDI chip somehow to configure it for the data acquisition card. So all you would need to do is change the programming (i.e., change the endpoint descriptors) to indicate that the endpoints are interrupt instead of bulk. > 3. Would it be better if I develop a kernel mode application (a module) > to handle the communication. If I run at the kernel level would I be > able to keep the pace with the incoming data stream? You would be in a better position to keep up with a kernel driver. But it might not be necessary. A user space driver can do almost as well. You ought to be able to maintain something on the order of 8 Mb/s with no trouble; 640 Kb/s should be easy. Something you may not have been aware of... To get maximum throughput you must use asynchronous USB requests and submit multiple URBs. Current versions of libusb do support this. In particular, you have to make sure that a request is always queued. If you wait for a request to finish before submitting the next one, you are liable to lose data. > I am using a Debian Linux on an Pentium Centrino @ 1.2 G Hz with 512 MB > RAM. The system is a dedicated one so it has only the minimum hardware > and software (no X, no web, file or database server). > > This is my first post to this forum and I have little to none > understanding of USB and how is it implemented in Linux. If you can send > me some documentation that would help me to understand how the USB > support is implemented, it would be appreciated. Linux's USB support is documented at www.linux-usb.org and in the kernel source. To learn more about the basics of USB, you can get the USB 2.0 specification from www.usb.org. Alan Stern ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-users
