Anyone Implemented FTDI 4232 Mini-Module Bit Bang?

Discussion in 'Embedded Systems and Microcontrollers' started by Brownout, Sep 29, 2013.

  1. Brownout

    Thread Starter Well-Known Member

    Jan 10, 2012
    2,375
    998
    So far, I have not been able to see any output from the FTDI 4232 Mini-Module when using bit-bang mode. I can get my computer to recognize the device and load the drivers. I can get my program to compile and link FTDI's libraries, load and run without any errors. But so far, no luck in getting an output bit on Channel A, bit 0. In fact, after reading all the example programs, and going through the documemtation, I can't figure out how to even specifiy channel A. Here is one version of the code I've tried. I've also tried flashing the otuput on and off.

    Code ( (Unknown Language)):
    1.  
    2. // ftdi_hello_world_led.cpp : Defines the entry point for the console application.
    3. //
    4.  
    5. #include "stdafx.h"
    6. #include <stdio.h>
    7. #include <stdlib.h>
    8. #include <windows.h>
    9. #include <string.h>
    10. #include <math.h>
    11. #include "ftd2xx.h"
    12. //#include <ftdi.h>
    13. int _tmain(int argc, _TCHAR* argv[])
    14. {
    15. unsigned char c = 0xff;
    16. DWORD bytes;
    17. FT_HANDLE handle;
    18. printf("FTDI Hello World\n");
    19. if(FT_Open(0, &handle) != FT_OK) {
    20. printf("Cannot open device\n");
    21. return 1;
    22. }
    23. FT_SetBitMode(handle, 0xff, 0x1); //handle, mask, mode
    24. FT_SetBaudRate(handle, 921600);
    25. FT_Write(handle, &c, 1, &bytes);
    26. for(;;) {}
    27. return 0;
    28. }
    29.  
    30.  
     
  2. Brownout

    Thread Starter Well-Known Member

    Jan 10, 2012
    2,375
    998
    Ok, maybe someone can answer this question. It usually takes 3 -6 attempts plugging in the module before windows recognizes the device and loads the drivers. Does that sound like it might point to the cause of the problem described above?
     
  3. Brownout

    Thread Starter Well-Known Member

    Jan 10, 2012
    2,375
    998
    OK, I finally got this to work! I threw it in the junk drawer out of disgust. But today I dug it out and went over all the connections again. Turns I had a simple wiring mistake. Now, I can turn the LED on and off on I/O port A0. I'll need a slightly more complex breadboard to go forward with the rest of the I/O's. Also will try the MPSSE functions.
     
Loading...