Down and dirty with FT232R on Arduino Diecimila

We’ve been considering the synchronous bit bang mode of the FT232R for an upcoming project. The first steps towards something like this are always to build up a little debug board or test bench that can be used for debug and tweaking while the real boards are in fab.

Luckily for us, the Arduino board contains an FT232R ripe for the hacking. For most users, all their dreams are fufilled by avrdude-jtag, which will allow them to reprogram the bootloader on the Arduino Atmega. This is some totally awesome work by Mr Suz and Kimio Kosaka. Check out Kimio’s page for everything you need to know.

But we will need to implement a new protocol, so while we can start work based on information that we find online, most of the guts are up to us.

Fig 1 – VB Tool Bit-Banging Square Waves on Arduino’s FT232R

As you may know, four of the FT232R’s GPIO pins are brought out to an unpopulated header on the Arduino board. The first (and easiest) job is to solder in a set of header pins for future connections. As they are defined nowhere else, I will define them as pin 1 being closest to the USB connector and pin 4 being closest to the crystal. The pinout is

  • Pin 1 – FT232R p6, GPIO D7
  • Pin 2 – FT232R p10, GPIO D6
  • Pin 3 – FT232R p9, GPIO D5
  • Pin 4 – FT232R p11, GPIO D3

So when writing a byte to the FT232, we control the top 3 bits on the high nibble and the top bit on the low nibble. Another way to explain it is that hex byte $E8 will bring all these pins high.

Writing source code for the FT232 is exceptionally easy due to the thoughtful efforts of FTDI themselves, who have released the marvelous ftd2xx.dll to allow fools like us to toy around with the features of their IC’s. Typically, you’d include ftd2xx.lib in your C++ program in order to interface with the FT232, but since we are lazy and writing in Visual Basic, we will call the dll directly. FTDI has also made that incredibly easy by releasing D2XX_Module.bas with all the VB definitions done for us.

You should spend some time on FTDI’s site and download the necessary application notes and especially the programming examples for the chip you’d like to work with. Assuming you’ve done that and are now an expert on both the FT232 and D2XX, we invite you to continue to the next page and read more about our initial open-source works.

Continued on Next Page


This entry was posted in Hacks. Bookmark the permalink.

0 Responses to "Down and dirty with FT232R on Arduino Diecimila"

Leave a reply