int ft2232_bb_init(void) {
struct ftdi_context *ftdic = &ftdic_context;
enum ftdi_interface ft2232_interface = INTERFACE_B;
if (ftdi_init(ftdic) < 0) {
printf("ftdi_init failed\n");
return EXIT_FAILURE; // TODO
f = ftdi_usb_open(ftdic, FTDI_VID, FTDI_PID);
printf("Unable to open FTDI device: %d (%s)\n", f, ftdi_get_error_string(ftdic));
if (ftdi_set_interface(ftdic, ft2232_interface) < 0) {
printf("Unable to select interface: %s\n", ftdic->error_str);
if (ftdi_usb_reset(ftdic) < 0) {
printf("Unable to reset FTDI device\n");
if (ftdi_set_latency_timer(ftdic, 2) < 0) {
printf("Unable to set latency timer\n");
if (ftdi_write_data_set_chunksize(ftdic, 512)) {
printf("Unable to set chunk size\n");
if (ftdi_set_bitmode(ftdic, 0xc0, BITMODE_BITBANG_NORMAL) < 0) { // BITMODE_BITBANG_NORMAL = 1
printf("Unable to set bitmode to bitbangin'\n");
As long as you've not also run ftdi_usb_open(), this works fine. I'm having trouble figuring out what to do next though. Do I just send a 0x80 (set data bits lowbyte) ?
I'd like to blink some leds on BDBUS6 and 7, and I'd like to read two interrupts on BDBUS0 and 1. But it's not clicking for me what it is that I need to do.
John O.