*On Fri, Feb 10, 2017, John Hein wrote:*
I'm trying to use bit bang on the fourth interface of the FT4232H.
See program below.
I get an error I don't understand yet:
write err: -16, usb bulk write failed
What am I missing?
I could not find -16 in my libusb.h.
I have BITMODE_BITBANG working on FT4232H.. Things I have done
- If using Linux, make sure the ftdi_sio driver is not loaded.
You can blacklist the device (0x0403, 0x6011) or change the
vendor/product values so Linux does not associate the
chip with ftdio_sio kernel module.
- I call ftdi_set_interface before calling ftdi_usb_open.
#include <ftdi.h>
#include <stdio.h>
int
main()
{
struct ftdi_context *ftdicx;
int rc;
unsigned char buf[1];
ftdicx = ftdi_new();
rc = ftdi_init(ftdicx);
if (rc != 0)
printf("err: %s\n", ftdi_get_error_string(ftdicx));
rc = ftdi_usb_open(ftdicx, 0x0403, 0x6011);
if (rc != 0)
printf("err: %s\n", ftdi_get_error_string(ftdicx));
rc = ftdi_set_interface(ftdicx, INTERFACE_D);
if (rc != 0)
printf("err: %s\n", ftdi_get_error_string(ftdicx));
/* 0xe => pin 0 is an input, pins 1-3 are outputs */
rc = ftdi_set_bitmode(ftdicx, 0xe, BITMODE_BITBANG);
if (rc != 0)
printf("err: %s\n", ftdi_get_error_string(ftdicx));
buf[0] = 0x6; /* pin 1 & 2 => 1 */
rc = ftdi_write_data(ftdicx, buf, 1);
if (rc < 0)
printf("write err: %d, %s\n", rc, ftdi_get_error_string(ftdicx));
return 0;
}
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|