Adafruit FT232H Breakout Created by Tony DiCola Last updated on 2017-07-26 01:18:11 AM UTC
Guide Contents Guide Contents Overview Assembly & Wiring Assembly Wiring Serial UART USB Serial Drivers 2 4 5 5 5 7 7 Windows Serial Driver Installation Serial Usage 9 Windows Mac OSX Linux 9 10 11 Other Serial UART Uses MPSSE Setup Windows libusb Driver Install libftdi Install Adafruit Python GPIO Library Install libusb Driver Uninstall Mac OSX Disable FTDI Driver on OSX 10.
Erase EEPROM For Programming With FT_PROG Downloads Files Schematic Fabrication Print © Adafruit Industries https://learn.adafruit.
Overview Wouldn't it be cool to drive a tiny OLED display (http://adafru.it/eau), read a color sensor (http://adafru.it/1334), or even just flash some LEDs directly from your computer? Sure you can program an Arduino (http://adafru.it/50) or Trinket (http://adafru.
Assembly & Wiring Assembly To assemble the FT232H breakout you'll need to solder the included headers to the breakout board. If you haven't soldered before, make sure to first read the guide to excellent soldering (http://adafru.it/dgp) and try practicing with some scrap wires and components. Start by trimming the male headers to the length of the pin holes on the breakout board. You should have two rows of male headers with 10 pins each.
protocols. You can also use some of them as GPIO pins for digital inputs and outputs. C0 through C9 - These are the ACBUS pins on the FT232H chip and are mainly used as GPIO pins for digital inputs and outputs. Note that pins C8 and C9 are not controlled by software and can only be assigned functionality by changing the EEPROM of the chip. You'll learn more about these two pins in the more info section. © Adafruit Industries https://learn.adafruit.
Serial UART Out of the box the FT232H is configured to act just like anFTDI friend USB to serial UART converter (http://adafru.it/dQa). This is great for talking to a serial device like an Arduino from your computer. It's safe to use with both 3.3 volt and 5 volt signals. This means the FT232H breakout can used to safely talk to an Arduino's 5 volt serial ports, and a Raspberry Pi or BeagleBone Black's 3.
Now click through the setup pages, read and accept the license agreement, etc. to install the driver. The aren't any configuration or setup options you need to change or worry about in the installation. Once the installation is done you might need to reboot your machine if the installation program tells you to do so. After rebooting, plug in the FT232H breakot to your PC using a USB micro cable. You should see a message pop up that the device is recognized and a driver is being installed.
Now unplug and plug in again the FT232H board and check device manager again to find theUSB Serial Port (COMx) node in the Ports (COM & LPT) node. That's it, you're all set to access the device as a serial COM port in Windows! Serial Usage Once any necessary serial port drivers are installed, you're ready to use the FT232H as a USB to serial UART. Let's perform a simple loopback test to confirm you can read and write data with the UART.
On Windows you can use PuTTY (http://adafru.it/aWh) as a serial console. Download and run PuTTY, then configure it for a Connection type of Serial as shown below on the right. The Serial line should be set to the COM port you found for the USB serial converter in device manager (shown on the left), in this case COM5. Speed should be set to 9600 baud. Click open and you should see an empty terminal screen appear.
First start with the FT232H board disconnected and open a terminal to run the following command to list all serial ports. ls /dev/tty.* You should see a list of devices, such as: /dev/tty.Bluetooth-Incoming-Port /dev/tty.usbmodem20 /dev/tty.Bluetooth-Modem /dev/tty.usbmodem22 /dev/tty.usbmodem1d111 /dev/tty.usbmodem24 Now connect the FT232H breakout to the computer, wait a moment, and run the same ls command again. You should see a new device in the list, such as: /dev/tty.
Use PuTTY or screen to open the FT232H serial port at 115200 baud and you'll be accessing the Raspberry Pi's serial port! You can find more details on accessing a Raspberry Pi through its serial console in thisconsole cable guide (http://adafru.it/jFr). The FT232H breakout can be used instead of the console cable mentioned in the guide! © Adafruit Industries https://learn.adafruit.
MPSSE Setup The Multi-Protocol Synchronous Serial Engine, or MPSSE, is the heart of the FT232H chip which allows it to speak many different protocols such as I2C, SPI, and more. When the chip is in MPSSE mode it changes the D0 to D3 pins to have special serial protocol functions: D0 - Clock signal output. This line can be configured as a clock that runs at speeds between ~450Hz to 30Mhz. D1 - Serial data output. This is for outputting a serial signal, like the MOSI line in a SPI connection.
Windows To access the MPSSE mode of the FT232H on Windows we need to install special drivers and software. We'll use a tool called Zadig to replace the FTDI driver for the FT232H with a libusb-based driver required by libftdi. Then we'll download a libftdi binary and install it for Python to access. Finally we'll install the Adafruit Python GPIO library. Carefully follow the steps below to setup the software. Note: When you enable MPSSE mode the serial UART driver will be disabled.
Click the up/down arrows on the driver select box to the right of the green arrow and select thelibusbK driver as shown above. Now click the Replace Driver button to replace the FTDI driver with the libusb-based driver. After the driver replacement finishes you can close Zadig tool. To check that the driver was successfully replaced, open Device Manager from Control Panel or searching in the Start menu.
Unzip the archive and you should see a series of folders like below: We need to copy some files from libftdi into Python's package directory. Open another Explorer window and navigate to the location you installed Python earlier, typically C:\python27. Inside the Python directory navigate to theLib > site-packages folder. Files you copy into this folder will be available globally as packages that your Python scripts can use. From the libftdi archive folder, copy all the .
That's all you need to do to install libftdi. Let's move on to install the Adafruit Python GPIO library next. Adafruit Python GPIO Library Install Finally let's install the Adafruit Python GPIO library which will allow your Python scripts to access the MPSSE functionality of the FT232H breakout First download an archive of the library by clicking the button below: Adafruit Python GPIO Library http://adafru.
Now let's test if both the libftdi and Adafruit Python GPIO libraries were correctly installed. In the command terminal run Python by executing: python Once the Python interpretor has loaded, type the following at the >>> prompt: import Adafruit_GPIO import ftdi1 You should see no response from the Python interpretor after entering each command like below: No response from the Python interpretor is a good sign because it means Python was able to successfully load the libraries.
In the dialog that appears make sure the 'Delete the driver software for this device.' option is checked as shown below: Click OK and the libusb driver should be completely uninstalled for the device. Now unplug the FT232H breakout board and go back to theSerial UART page (http://adafru.it/jFp) to find the instructions for installing the Windows serial driver. Follow those instructions again and you should be set with the device acting as a USB serial UART again. © Adafruit Industries https://learn.
Mac OSX To access the MPSSE mode on Mac OSX we need to install libftdi and the Adafruit Python GPIO library. Carefully follow the steps below to install these libraries. Note that these steps were tested using OSX Mavericks. The steps should work for later versions like Yosemite, but you might need to search for extra help on installing Xcode command line tools below. First before you get started you will need to make sure you haveXcode (http://adafru.it/eaN) and the Xcode command line tools installed.
© Adafruit Industries https://learn.adafruit.
Linux To access the MPSSE mode on Linux we need to install libftdi and the Adafruit Python GPIO library. Carefully follow the steps below to install these libraries. Note that these steps are made for Ubuntu 12.04/14.04 and should work with any Debian-based distribution. If you're using a different distribution you might need to check its package manager for the appropriate commands to install the mentioned dependencies.
MPSSE Usage The next sections will walk through examples of using the Adafruit Python GPIO library to use MPSSE functions like GPIO, SPI, and I2C. Make sure you've first installed the libftdi library & Adafruit Python GPIO library by following the steps for your platform in the previous section! © Adafruit Industries https://learn.adafruit.
GPIO Using the GPIO pins on the FT232H board is easy with the Python GPIO library that was installed. To demonstrate the usage I'll show a simple example of blinking an LED and reading a digital input. To get started you'll need the following parts: Assembled FT232H breakout board. One LED of any color. A small resistor between ~330-1000 Ohms to limit current through the LED. Jumper wires & breadboard.
# Configure digital inputs and outputs using the setup function. # Note that pin numbers 0 to 15 map to pins D0 to D7 then C0 to C7 on the board. ft232h.setup(7, GPIO.IN) # Make pin D7 a digital input. ft232h.setup(8, GPIO.OUT) # Make pin C0 a digital output. # Loop turning the LED on and off and reading the input state. print 'Press Ctrl-C to quit.' while True: # Set pin C0 to a high level so the LED turns on. ft232h.output(8, GPIO.HIGH) # Sleep for 1 second. time.
# Create an FT232H object that grabs the first available FT232H device found. ft232h = FT232H.FT232H() Now an FT232H object is created and assigned to the ft232h variable. This will detect the first available FT232H device connected to the computer and initialize its MPSSE for use with GPIO. Make sure the use_FT232H() function was previously called or else this function will fail! # Configure digital inputs and outputs using the setup function.
SPI The FT232H's MPSSE is great for generating signals to communicate using the SPI protocol. (http://adafru.it/cEC) The MPSSE can take care of generating a clock signal from about 450hz to 30Mhz, and read & write bytes of data at that frequency. The Python GPIO library that was installed includes a small wrapper around MPSSE functions to simplify the use of reading and writing SPI data. When using SPI with the FT232H the following pins will have a special meaning: D0 - SCK / Clock signal.
The read() function will read the specified number of bytes on theD2 (MISO) line (sending clock pulses out D0 (SCK) as necessary). The transfer() function is like calling write() and read() at the same time. The specified array of bytes will be sent outD1 (MOSI) while at the same time data will be read from D2 (MISO).
Now create a file neopixels.py and fill it with the following code: import time import Adafruit_GPIO as GPIO import Adafruit_GPIO.FT232H as FT232H class NeoPixel_FT232H(object): def __init__(self, n): # Create an FT232H object. self.ft232h = FT232H.FT232H() # Create a SPI interface for the FT232H object. Set the SPI bus to 6mhz. self.spi = FT232H.SPI(self.ft232h, max_speed_hz=6000000) # Create a pixel data buffer and lookup table. self.buffer = bytearray(n*24) self.lookup = self.
# Run this code when the script is called at the command line: if __name__ == '__main__': # Define the number of pixels in the NeoPixel strip. # Only up to ~340 pixels can be written using the FT232H. pixel_count = 16 # Create a NeoPixel_FT232H object. pixels = NeoPixel_FT232H(pixel_count) # Animate each pixel turning red. # Loop through each pixel. for i in range(pixel_count): # Set the pixel color to pure red. pixels.set_pixel_color(i, 255, 0, 0) # Show the pixel buffer by sending it to the LEDs. pixels.
This portion of code has an if statement that checks if the program is being run from the command line before executing. This is just a standard Python idiom for defining the main entry point of a program. Inside the if block you can see the number of pixels is defined and set in the pixel_count variable. Then the NeoPixel_FT232H object is created by telling it that number of pixels as its only parameter. # Animate each pixel turning red. # Loop through each pixel.
I2C The I2C protocol (http://adafru.it/srd) is another popular protocol for communicating with sensors and devices. I2C is more complex and sometimes slower than SPI, but only requires two data lines (and a ground) which is desireable in some situations. Luckily the MPSSE component of the FT232H can implement the I2C protocol so you can speak to these devices with the FT232H breakout. To use I2C with the Adafruit Python GPIO library and the FT232H board you'll need to setup your circuit in a special way.
Note that there are other libraries you might consider using for I2C communication with the FT232H. You can use libmpsse (http://adafru.it/df5) to speak the I2C protocol from C or Python code. See this guide on using a color sensor (http://adafru.it/jFw) for more information and code to use libmpsse and an I2C device. Another alternative is the libMPSSE-I2C library that uses the FTDI D2XX drivers. See this application note for more details on using libMPSSE-I2C (http://adafru.it/eaT).
More Info Phew, there are a lot of features on the FT232H breakout! In fact more features than have been covered in this guide. Check out some of the resources below for information on more things you can do with the FT232H: Official FT232H Datasheet (http://adafru.it/eav) The reference for all information about the FT232H. You should consider at least skimming this document, or even reading it in depth in order to understand all of the chip's capabilities. MPSSE Command Reference (http://adafru.
Downloads Files EagleCAD PCB files on GitHub (http://adafru.it/p4B) Fritzing object in Adafruit Fritzing library (http://adafru.it/aP3) Schematic (Click to embiggen) Fabrication Print Dimensions in inches © Adafruit Industries https://learn.adafruit.
© Adafruit Industries Last Updated: 2017-07-26 01:18:11 AM UTC Page 36 of 36