libftdi Archives

Subject: Write buffer relationship to chunksize?

From: David Hawkins <dwh@xxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 20 Nov 2013 14:34:21 -0800
Hi all,

I'm writing code to access Altera's USB-Blaster FPGA
JTAG programmers. The "standard" devices are based on
USB 1.x FT245B and FT245R devices. I'm testing a
(faster) USB 2.0 FT232H version using a UM232H module
wired into an FPGA development kit.

I'm having a problem with libftdi writes failing.
I'm also testing with libftd2xx and writes work with it,
so I know there is not a hardware problem.

I'm using the libftdi1-1.0 release, under Centos 6.2.
The problem occurs both under a native boot of the
OS, and when running the OS inside a VirtualBox VM
(with the USB 2.0 extension enabled, and WinXP host).

Based on the libftdi1-1.0 source:

http://www.intra2net.com/en/developer/libftdi/documentation/ftdi_8c_source.html

ftdi_write_data() sets write_size to ftdi->writebuffer_chunksize,
which defaults to 4096-bytes. This code implies that writes
get blocked up into bulk transfers of 4096-bytes or less
(and then I assume these get further divided into actual
USB bulk transfers of ftdi->max_packet_size each).

However, when using an FT245B or R device, the size
passed to ftdi_write_data needs to be around 6 times
the ftdi->max_packet_size (6 x 64 = 384-bytes), and for
an FT232H device the limit appears to be near 2 times
the ftdi->max_packet_size (2 x 512 = 1024-bytes),
otherwise writes fail, with the error message
"usb bulk write failed".

Any idea what I could be doing wrong?

If someone else wants to duplicate the issue, I could write
a program that writes large blocks to a UM232H module or a
C232H cable, eg., using MPSSE loopback mode or something like
that.

I figured I'd ask here first, in case this is an old issue
that is resolved in the git repo - in which case I'll clone
it and test the mainline code.

Thanks!

Cheers,
Dave


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
Current Thread
  • Write buffer relationship to chunksize?, David Hawkins <=