Search code examples
c++serial-portembeddedftdi

Using GPIO input instead of TDO/DI on the FTDI 2232H Mini-Module


I’m using the FTDI 2232H Mini Module as a module for a system I’m working on. I’m attempting to read data serially from a device using the FTDI’s GPIOs instead of the TDO/DI pin (MPSSE mode). So, for example, my idea of it would be to perhaps connect a GPIO input to the device’s output, and at each SCLK that the FTDI sends, check whether the GPIO input is high or low. By doing this I would be able to store these highs or lows as 1s or 0s, respectively, into a buffer.

Is it possible to do this, or something similar with the FTDI?

Is there a way to keep count of SCLK pulses or rising/falling edges?

I'm using C++ on a Windows environment.

Thanks


Solution

  • What you are describing is using bit banging which FTDI chips support including FT232H. This is the technology I use for my device Nusbio and all the bit banging computation is written in C#.

    Here some source executing SPI bit banging to read data from an EEPROM. EEPROM/SPI/EEPROM_25AAXXX_BASE.cs

    Bit banging is good for chip like the FT232RL or FT231X. But if you have an FT232H, you can do better.

    To answer you question the key is know what is the communication protocol used by the device your are trying to read data from.

    If the protocol is SPI, I2C, JTAG or Serial Port then you should use the native mode supported by the FT232H. As mentioned it is called mpsse, Multi-Protocol Synchronous Serial Engine to simplify synchronous serial protocol (USB to JTAG, I2C, SPI (MASTER) or bit-bang) design.

    If your device support some exoteric protocol with a CLOCK wire which you mentioned, you might have to write your own bit banging.

    Is there a way to keep count of SCLK pulses or rising/falling edges? The Windows PC moslt likely would considered the master so your program is in charge of clocking HIGH and LOW and keeping track of it.

    I2C Bit banging Adafruit 16x9 LED Matrix with Nusbio

    mpsse SPI with the FT232H and OLED 128x64 display