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.
D2 - Serial data input. This is for reading a serial signal, like the MISO line in a SPI connection. D3 - Serial select signal.
The FT2232H is a USB 2.0 Hi-Speed (480Mb/s) to UART/FIFO IC. Single chip USB to dual serial / parallel ports with a variety of configurations. Direct (D2XX) drivers eliminate the requirement for USB driver development in most cases.
This is a chip select or chip enable signal to tell a connected device that the FT232H is ready to talk to it. In addition to the serial protocol pins above, the MPSSE mode allows you to control other pins as general purpose digital inputs or outputs. These are great for controlling chip select, reset, or other lines on chips. You can even use the GPIO to read switches, blink LEDs, and more! The pins which are controllable as GPIO in MPSSE mode are D4 to D7 and C0 to C7, for a total of 12 GPIO pins.
![Spi Spi](http://techmattmillman.s3.amazonaws.com/wp-content/uploads/2014/05/DSC_9582.jpg)
These pins can be configured individually as digital inputs or outputs. Note that pins C8 and C9 are not controllable as GPIO pins. These two pins have a special function that can be set in the EEPROM of the chip-you'll learn more about these later. To use the MPSSE mode of the chip you'll need to use some special software and programming libraries. There are actually a few options for software that can talk to the FT232H and its MPSSE component:.
These drivers and libraries are produced by FTDI and provide low level access to FTDI chip functions. There are binary versions of the library available for Windows, Mac OSX, and Linux. This is a good option to consider if you run into limitations or issues with other drivers.
There's a good and available too. FTDI's and libraries. These libraries build on top of the D2XX driver above and provide a simpler interface to I2C and SPI communication with the FT232H's MPSSE component.
This is an open source library that's similar to the D2XX library and provides a low level interface to FTDI chip functions. There's even a Python interface which makes this library a little easier to use compared to the D2XX library.
Like the libMPSSE-I2C and libMPSSE-SPI libraries, this library builds on the libFTDI library and provides a simpler interface for I2C and SPI protocols using the MPSSE component. One thing to note is that his library is currently only supported on Mac OSX and Linux.
To make using the FT232H simpler, Adafruit's Python GPIO library has been updated to include a simple interface for accessing GPIO, SPI, and I2C on the FT232H with the Python programming language. Using this library you can control the GPIO pins and send or received SPI & I2C commands much like programming those interfaces on a Raspberry Pi or BeagleBone Black.
This library is built on top of the libFTDI library and supports Windows, Mac OSX, and Linux platforms. In this guide I'll show you how to setup and use the to access GPIO, SPI, and I2C devices using the FT232H board's MPSSE component. You can write Python programs to control GPIO pins and send/receive SPI & I2C commands directly from your computer using the FT232H breakout.
One thing to note, when you're using the MPSSE mode of the FT232H the serial UART mode will be disabled. This means you can't use both the serial UART and MPSSE GPIO, SPI, I2C, etc. Modes of the chip at the same time. To learn how to enable MPSSE modes and install the Adafruit Python GPIO library, continue on to the next page that's appropriate for your platform (Windows, Mac OSX, or Linux).
You have been successfully subscribed to the Notification List for this product and will therefore receive an e-mail from us when it is back in stock! For security reasons, an e-mail has been sent to you acknowledging your subscription. Please remember that this subscription will not result in you receiving any e-mail from us about anything other than the restocking of this item. If, for any reason, you would like to unsubscribe from the Notification List for this product you will find details of how to do so in the e-mail that has just been sent to you!
Learn how to make flashing your ARM-based MCU easy by using OpenOCD debugger with an FT2232H adapter. Old MCUs from vendors like ATMEL and MICROCHIP, like the PIC16F and Atmega family, tend to have a special programming interface to program internal flash.
For example, Atmega used SPI pins (MISO, MOSI, SCK) and PIC used two pins (PGC, PGD)— one as a clock and another as a bi-directional data line. New MCUs, especially with an ARM core, use JTAG/SWD as a programming/debugging interface. What is the difference between Joint Test Action Group (JTAG) and Serial Wire Debug (SWD)? The answer is that SWD was created as an alternative to JTAG to save pins in the MCU package: SWD replaces the 5-pin JTAG interface with one that's only 2-pin.
To communicate with our target chip, we need a program on the host and hardware as a bridge between the host and the chip. In this tutorial, we will use OpenOCD as the program on the host to send commands and communicate using SWD. We'll use an FT2232H as the bridge to translate signals from the USB port to the SWD interface. SWD interface signals Overview of OpenOCD Open On-Chip Debugger (OpenOCD) is a free, open-source project that aims to provide debugging, in-system programming, and boundary scan using a debug adapter. The adapter is a hardware module that provides the right signals for the target to understand.
OpenOCD debugger supports a lot of debugging adapters, which can be viewed on the. To make OpenOCD work, you should configure it using commands or by using configuration files.
When configuration is done and a connection with the target is established, OpenOCD will start running as daemon. Daemon is a background process that answers requests for services. OpenOCD will now wait for connections from GDB, Telnet, or whatever other channel and process given commands. OpenOCD block diagram Overview of FT2232H FT2232H is dual high-speed USB to multipurpose UART/FIFO IC.
This means it is a single-chip USB with dual ports. Every port is equipped with an engine called a Multi-Protocol Synchronous Serial Engine (MPSSE) to simplify a synchronous serial protocol (USB to JTAG, I2C, SPI, or bit-bang) design.
This allows users to configure the channel with the desired protocol. MPSSEs are available on channel A and channel B and can be configured to allow any synchronous serial protocol. Be Aware Before Selecting OpenOCD Selecting OpenOCD as your debugging tool with an adapter like FT2232H is a very good choice when you don’t have much budget to work with. In addition to being free and open source, OpenOCD also has a good support community. BUT, as with any other open-source tool, you could face bugs you may need to fix by yourself. It took me some time to understand how to make OpenOCD work and flash my MCU, and I hope this tutorial will be a good and complete reference. Also, I advise anyone searching for to choose wisely.
For example, if you need a simple tool, I think OpenOCD might not be the best choice for you! Other good alternative debugging tools are:.
Default debuggers embedded into evaluation boards (like STM32, EFM32, and other MCU families) by silicon vendors In conclusion, if you don’t have much budget, time, or patience, OpenOCD with FT2232H will be a great choice for you. Requirements Here is what you'll need to complete this tutorial:. FT2232H breakout board. Windows or Linux OS with a working copy of OpenOCD. Target chip to flash Let's go over each piece individually.
FT2232H breakout board: You can get a cheap one from Chinese suppliers like Taobao, Alibaba,. I ordered mine from for about $14. You can also order the official FTDI module, the.
FT2232H breakout boards. Windows or Linux OS with a working copy of OpenOCD: Windows: You can get an executable version of OpenOCD from. Linux: You can get it from the package pool of your Linux distribution, like. Or you can build it from source code, the hard way! This is the route I chose to go, personally.
You can find useful guides on how to do this, like the one from (for Windows), or (for Linux). You can also read compilation instructions from OpenOCD source code ( and ).
Note: Some time ago, the decided not to provide any official binaries anymore. They only offer the source code, expecting the vendor of the JTAG hardware to build the binaries. Ensure the binary you use supports your JTAG hardware.
Target chip to flash: I chose my breakout with EFM32G200F32, an ARM Cortex-M3-based microcontroller (MCU), but any other supported MCU will work. My EFM32G200F32 breakout board EFM32G200F32 pinout How OpenOCD Is Organized To make OpenOCD run, you just need a correct configuration file (.cfg) supplied to OpenOCD. This configuration file has commands which are extensions to Jim-Tcl. Jim-Tcl is a programming language that provides a simple and extensible command interpreter. The OpenOCD directory file has a folder called “scripts”. In this folder, you will see 'interface', 'board', and 'target' folders. And these are pretty much the only folders you need.
Interface: Configuration files for hardware adapters, for example “minimodule.cfg”. Board: Configuration files for common development boards like “atmelsam4sxplainedpro.cfg” - “olimexstm32h107.cfg” - “stm32f4discovery.cfg”. You can see that these files reuse configuration files from interface and target. Target: Configuration files for MCU Chips.
However, you can write your own configuration files, which we're going to do in this tutorial. When we run OpenOCD, we can give it as many configuration files as we want: openocd -f config1.cfg -f config2.cfg -f config3.cfg Understanding the Basics of Adapter Configuration First, we need to tell OpenOCD the type of that it will work with by using an interface command. To see the complete list of interfaces that your version of OpenOCD supports, use this command: openocd -c interfacelist In our tutorial, we will use an adapter with FT2232H chip, so we will use an FTDI interface driver: interface ftdi You must also tell OpenOCD more information about your adapter (interface). For example, you need to specify the VID/PID, serial number, or the number of the channel you will use for FT2232H, since it has two channels. Ftdividpid 0x0403 0x6010 ftdichannel 1 ftdiserial 'FTZ7O8O0' The adapter can support more than one transport protocol, so OpenOCD allows you to select the transport protocol: transport select swd You should also tell OpenOCD the initial values of the FTDI GPIO data and direction registers through the ftdilayoutinit command.
You should first put the initial values of the channel’s 16 pins, and then the directions. Knowing that '1' is for selecting direction as output and '0' is for input, and each channel in ft2232H has 16 pins. Ftdilayoutinit 0x0018 0x05fb This means: Low output data = 0x18 // 0001 1000 Low direction = 0xfb // 1111 1011 High direction = 0x05 // 0000 0101 To see more about adapter configuration, you can refer to.
Connecting Target with Adapter There is a configuration file called “swd-resistor-hack.cfg” that includes a wiring diagram: FT2232H wiring with target The file includes a note: “Connect TDI to SWDIO via a suitable series resistor (220-470 Ohm or so depending on the drive capability of the target and adapter) connect TDO directly to SWDIO.” Without wiring this resistor in this way, a connection will not be established. FT2232H pinout Putting It All Together Let us now try to make a connection between the adapter and target using OpenOCD.
Part 1: Make the Required Wired Connections Connecting FT2232H with target Part 2: Run OpenOCD First, make a special configuration file to our adapter. Create a new txt file (ANYNAME.cfg).