The ever-popular FT232R can do much more than just enable USB in your project.
Favorited Favorite 0We all know the popular FT232R from FTDI Chip is a very common solution for embedding USB in your project. The royalty free drivers, built in EEPROM and oscillator already create enough value in the FT232R chip to be used alone for USB to UART communication. But...
Did you know the FT232R offers bit bang modes on its IO pins? What this means is that the FT232R can convert some of its IO pins into 8-bit bi-directional data lines. These lines can be used to simulate a serial bit stream, essentially turning the FT232R into an IO expander with a USB interface.
Our friend, Michael from chinwah-engineering.com, has written detailed explanations on how to bit bang SPI and parallel interfaces on an FT232R.
There's more! Michael has created quite a few tutorials on how to use the FT232R with a range of sensors. Here are a couple that use SparkFun parts.
How is the data presented from the sensors? Michael has written some C# applications (available on his tutorial pages) and combined them with public code (from FTDI and shareware) to create a nice graphical interface to configure the devices and view the data.
Bit banging on an FT232R the way Michael has done can be beneficial for a very good reason. If you are looking for a relatively easy to use, low bill of materials (BOM) cost for a USB to SPI or parallel bridge, this is a very good option. Also since the FTDI interface works cross-platform, your system can be very versatile.
If you are interested in how to write C code to control an FT232R, Hack-a-Day wrote a great post a while back on how to write C code to blink an LED with an FT232, check it out here.
How exactly does enabling some I/O lines on a USB chip turn it into "a rudimentary microcontroller" ? Can you program the chip to run standalone programs out of memory?
No?
Then it's not a microcontroller. It's a USB based I/O expander.
Thanks Fred for the correction.
agreed
Whoops.. didn't realize they were in C# too. Oh well.
Great post. I've been fiddling with these chips for a couple of years. If anyone is interested you can do this in C# too! I posted a bit of sample code how to do it.
http://www.flakelabs.com/index.php/2010/07/control-ft232-with-c/
The FT232 has user configurable pins, FTDI offers utilities for configuration. Used this products for some time now, also the FT245R is a parallel/FIFO to USB interface. Here is the link to the utilities:
http://www.ftdichip.com/Resources/Utilities.htm
Hi Chinwah,
Given your explanation, I am a bit confused. As your explanation makes it sound like in the "FT232R" can't perform parallel transfers in Bitbang mode; but the article write-up above mentions tutorials and USB Parallel Interface. Should the article above remove Parallel Interface and keep SPI Interface? If not, can you give a use case where the FT232R can use its Parallel interface to perform some task?
Thanks and sorry if my lack of knowledge on this topic seems puzzling, as I am a n???
Moe
"So, does that mean that the "FT232R" can emulate a "FT245RL"? Or is USB to parallel different from USB to FIFO?"
No the FT232R and FT245R are different in their default modes. In the bitbang mode the FT232R does have RD and WR signals but does not have the RXF# and TXE# handshake signals like FT245R. I tried emmulating them but if you set the data on the D0-7 signals and then switch over to the Cbus it resets the data signals.
The discussion in the USB parallel interface discusses this issue.
So, does that mean that the "FT232R" can emulate a "FT245RL"? Or is USB to parallel different from USB to FIFO?
Any input would be greatly appreciated.
-Moe
That's also how you can program the Arduino bootloader in an bare Atmega chip (if/when you can find one !). Here is a video and a page that explains how to do it with Avrdude and any Arduino board :
http://www.youtube.com/watch?v=iwRA8XwLIQI
http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html
Wow, talk about pulling yourself up by your bootstraps... That's the coolest thing I've seen all day, thanks for posting!
I was about to post this if no one else did, but don't limit it to just the Arduino bootloader, it's a full blown bit-banged AVR programmer. You can flash full programs to regular AVRs with it.
FTDI makes another USB host/device chip, the Vinculum VNC1L. Like the FT232R, it has additional I/O lines which are available to the user - but how to access these is poorly documented.
Wonder if the same bit-bang techniques could be used?
The advantage of the Vinculum is built in FAT support and USB host ability (in one firmware configuration, one of the two USB controllers can be a device (slave) while the other is host). This could become an extremely small datalogger if set up properly.
Unfortunately, the FTDI webstore lists the Vinculum at GBP 8.25, or about USD 14.35 for the bare chip, which dorsn't make it much less expensive than a LPC2148 or LPC2388, which can handle much more and are well supported with IDE's and RTOS's.
I agree. FTDI dropped the ball on the VNC1 chip. I have tried to use them for several projects and have found it to be difficult to use. The RD signal is inverted from the WE signal which is odd. Same on the FT232/245. I have used their canned software for USB master/slave projects. The little VDrive2 module is kind of interesting but doesnt have any IO other than serial/SPI.
There is a VNC2 chip coming out and they have software tools already but no hardware. "?"
Sooooo...wait...you don't need a programmer of any kind to do this? It's all computer software based?
Wow, how cool is that! The FTDI chip, as you said, was already extremely useful as is, but now a whole world of options are opened up to designs that incorporate it! Thanks, Sparkfun, for letting the genie out of the bottle!