On Mon, Jun 27, 2011 at 8:33 PM, Xiaofan Chen <xiaof...@gmail.com> wrote: > On Mon, Jun 27, 2011 at 7:29 PM, Tom Schouten <t...@zwizwa.be> wrote: >> Any suggestion on where I might to look in the code to fix this? >> What I find strange is that the data rate doesn't go proportional to the >> clock speed. >> >> Maybe combination of communication delay and waiting for the ack when >> sending out a page? Some other polling delay that's too large? >> > > I do not know much about the internals of OpenOCD (not that > interested to learn about Jtag, only interested in USB) but I think > this thread should help: "USB latency limiting JTAG speed". > > I think Øyvind Harboe's suggestion is quite good. > https://lists.berlios.de/pipermail/openocd-development/2010-October/016724.html > https://lists.berlios.de/pipermail/openocd-development/2010-October/016727.html > > "One interesting modification to OpenOCD might be to add some profiling > metrics on inter-jtag_execute_queue() times. > > If there are large inter-jtag_execute_queue() times then I'd expect an > async interface to help." > > To use async interface, libusb-1.0 and libftdi can help (with quite > significant code changes in the JTAG adapter driver side). But the > higher level profiling about OpenOCD should come first. >
If you want to have a potentially not that complicated changes to switch to libftidi-1.0, you can try to modify ft2232.c. http://openocd.git.sourceforge.net/git/gitweb.cgi?p=openocd/openocd;a=blob;f=src/jtag/drivers/ft2232.c;hb=HEAD 382 #if BUILD_FT2232_FTD2XX == 1 383 #define FT2232_BUFFER_READ_QUEUE_SIZE (64*64) 384 #else 385 #define FT2232_BUFFER_READ_QUEUE_SIZE (64*4) 386 #endif So ftd2xx h has some advantages here in OpenOCD. This could be partly the reason why ftd2xx is faster than libftdi, especially under Windows. You can take some hint from this commit from the urjtag project. http://urjtag.git.sourceforge.net/git/gitweb.cgi?p=urjtag/urjtag;a=commitdiff;h=ad53771377357e1f10206b2916069373fda01122 Explanations by the author of Jie Zhang, the author of libftdi-1.0. He is now also on the OpenOCD list and you can check with him as well if you encounter issues. http://developer.intra2net.com/mailarchive/html/libftdi/2010/msg00065.html If you look at the urjtag code, you can see the following. http://urjtag.git.sourceforge.net/git/gitweb.cgi?p=urjtag/urjtag;a=tree;f=urjtag/src/tap/usbconn;hb=HEAD /* Maximum chunk to receive from ftdi/ftd2xx driver. 30 Larger values might speed up comm, but there's an upper limit 31 when too many bytes are sent and the underlying libftdi or libftd2xx 32 don't fetch the returned data in time -> deadlock */ 33 #ifdef HAVE_LIBFTDI_ASYNC_MODE 34 #define URJ_USBCONN_FTDI_MAXRECV (63 * 64) 35 #else 36 #define URJ_USBCONN_FTDI_MAXRECV ( 4 * 64) 37 #endif 38 #define URJ_USBCONN_FTD2XX_MAXRECV (63 * 64) To use 63 * 64 instead of 4 *64 can boost the performance by quite a bit. -- Xiaofan _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development