libftdi Archives

Subject: usb bulk read failed

From: "John Hein" <47vzntyus9@xxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 10 Feb 2017 09:37:24 -0700
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?

#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   

Current Thread