Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4581038
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:52:02+00:00 2026-05-21T20:52:02+00:00

It’s a FT2232D chip, and the LED is connected to BDBUS6. The library is

  • 0

It’s a FT2232D chip, and the LED is connected to BDBUS6.

The library is less documented than I might like (better than FTDI’s own library though, which doesn’t even work on modern kernels), the only example code I can find that does this uses a deprecated function (I tried, it doesn’t seem to work), and I’m absolutely stumped.

The harder I try with this thing, the more difficult it seems. I’m not looking for someone to do my homework for me so much as I just need a nudge in the right direction. Any help appreciated (even speculative).

Update: I’ve been trying this, though ftdi_enable_bitbang() is deprecated. The following code compiles, it runs without barfing, but no blinkenlighten. Schematics of the device in question are available at http://www.semtech.com/images/datasheet/sx1211ska_v1_std.pdf , page 23. BDBUS6 and BDBUS7 are hooked up to the LEDs.

#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <ftdi.h>

#define FTDI_VID                0x0403
#define FTDI_PID                0x6010


static struct ftdi_context ftdic_context;

int main(void) {
        int ret;
        unsigned int i;
        unsigned char c = 0;

        // Initialize bitbang.
//      ret = ft2232_bb_init();

        ftdi_usb_open(&ftdic_context, FTDI_VID, FTDI_PID);
        ftdi_set_interface(&ftdic_context, INTERFACE_B);
        ftdi_enable_bitbang(&ftdic_context, 0xb0);

        // Trying to blink some lights.
        printf("\nNow let's try to blinkenlights...\n");
        for (i = 0; i < 20; i++) {
                c ^= 0x80;
                ftdi_write_data(&ftdic_context, &c, 1);
                sleep(1);
        }

        return EXIT_SUCCESS;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T20:52:04+00:00Added an answer on May 21, 2026 at 8:52 pm

    You need to initialize the ftdi context before you can open a device with it.

    ftdi_init(&ftdic_context);

    Also you need to set the interface channel before you open the device.

    Heres the function I use to set up a ftdi context

    int initFTDI(struct ftdi_context * ftdic)
    {
        unsigned char Mask = 0x1F;
        int ret=0;
    
        fprintf(stderr,"start init\n");
    
        ftdi_init(ftdic);
    
        //for multi-channel ftdi chips eg(ft2232)
        if(ftdi_set_interface(ftdic,INTERFACE_B))
            fprintf(stderr,"%s\n",ftdi_get_error_string(ftdic));
    
        if((ret = ftdi_usb_open(ftdic, VID, PID)) < 0){
            fprintf(stderr, "unable to open ftdi device: %d (%s)\n", ret,   ftdi_get_error_string(ftdic));
            return EXIT_FAILURE;
        }
        if(ftdi_usb_reset(ftdic))
            fprintf(stderr,"%s\n",ftdi_get_error_string(ftdic));
    
        if(ftdi_usb_purge_buffers(ftdic)) //clean buffers
            fprintf(stderr,"%s\n",ftdi_get_error_string(ftdic));
    
        if(ftdi_write_data_set_chunksize(ftdic,65536)) //64k transfer size
            fprintf(stderr,"%s\n",ftdi_get_error_string(ftdic));
    
        if(ftdi_read_data_set_chunksize(ftdic,4096)) //64k transfer size
            fprintf(stderr,"%s\n",ftdi_get_error_string(ftdic));
    
        if(ftdi_set_event_char(ftdic,false,0)) //disable event chars
            fprintf(stderr,"%s\n",ftdi_get_error_string(ftdic));
    
        if(ftdi_set_error_char(ftdic,false,0)) //disable error chars
            fprintf(stderr,"%s\n",ftdi_get_error_string(ftdic));
    
        if(ftdi_set_latency_timer(ftdic,2)) //Set the latency timer to 1mS (default is 16mS)
            fprintf(stderr,"%s\n",ftdi_get_error_string(ftdic));
    
        if(ftdi_set_baudrate(ftdic,921600)) 
            fprintf(stderr,"%s\n",ftdi_get_error_string(ftdic));
    
        if(ftdi_setflowctrl(ftdic,SIO_RTS_CTS_HS)) //set flow control
            fprintf(stderr,"%s\n",ftdi_get_error_string(ftdic));
    
        if ((ret = ftdi_set_bitmode( ftdic, 0x00, BITMODE_RESET )) < 0 )
        {
            fprintf(stderr, "can't set bitmode to %x: %d (%s)\n", BITMODE_RESET, ret, ftdi_get_error_string(ftdic));
            fprintf( stderr, "RESET\n" );
            return EXIT_FAILURE;
        }
        if ((ret = ftdi_set_bitmode( ftdic, Mask, BITMODE_BITBANG )) < 0 )
    
            fprintf(stderr, "can't set bitmode to %x: %d (%s)\n", BITMODE_BITBANG, ret, ftdi_get_error_string(ftdic));
            fprintf( stderr, "RESET\n" );
            return EXIT_FAILURE;
        }
    
        //fprintf(stderr,"end init\n");
    
        return ret;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.