Re: [Ftdi-usb-sio-devel] Resetting the FTDI
Brought to you by:
bryder
From: Chris S. <chr...@ya...> - 2010-11-11 21:36:43
|
BR> CS> My goal is to get a message to the FT245RL and back to the host BR> CS> within each 1ms full speed frame. BR> BR> I see. That will be quite tricky I suspect. About half the time I can do it... at least according to my interpretation of the following: I have an FPGA device that uses FT245RL part. It waits for a 2 byte "request" and ~immediately replies with a 62 byte message. 62 bytes was chosen because, once the 2 bytes of USB status message is appended, will fill up the outgoing FTDI buffer and not need to await a latency timer event. I want to maximize the "ping pong rate" -- the rate at which I can send a request and get a response to one request and one reply per 1ms USB full speed frame (the part runs at full speed). Here is pseudocode for a program I wrote to measure this rate (source attached): fd = Open("ftdi_sio device"); set_serial_parms(); while (true) { // busyloop calling write() until all data written write(fd, "two byte packet requesting 62 bytes"); // busyloop calling read() until 62 read read(fd, "62 bytes"); } Results: The "ping pong rate" is 1000Hz for a few seconds, implying a reply and response within a 1ms frame. The rate then switches to 300-700Hz for a few seconds, then back to 1000Hz. source code: attached program output: 1000.370137 1000.050003 1000.050003 1000.050003 1000.050003 1000.040002 980.430605 900.941484 613.549630 499.990000 393.720938 335.562587 645.177940 1000.030001 1000.060004 1000.030001 1000.040002 1000.050003 1000.040002 ftdi_sio debug output: attached. It implies that when things are running at 1KHz I am sending the OUT and receiving the IN message in one frame. When things are not running at 1KHz, it appears the IN message comes in on the subsequent frame. I have a Beagle USB 480 which I am going to use to try to figure out exactly what is going on. http://www.totalphase.com/products/beagle_usb480/ My next idea is to start an asynchronous read before sending the write. Your thoughts are appreciated! Chris |