libftdi Archives

Subject: Problems with FT232R in bitbang mode

From: Helge Lenz <h.lenz@xxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 14 May 2010 22:48:07 +0200
I am new to this list and I hope somebody here can help me. Here is my problem (sorry for this long first post, but I really don't now what to try next):

I have a small IR controlled helicopter (like this: and I managed to decode the IR protocol. I wrote a small application that reads the input from a USB joystick and builds the bit sequence to control the helicopter. Inspired by Albert Huitsings homepage ( I bought a USB2Serial cable with a FT232RL where I soldered the necessary pins directly to some free pins of the serial socket. The IR transmitter diodes are directly driven by the RTS line of the FTDI chip. The transmitter logic is based on the "test3.c" on his homepage ( which generates and modulates the IR carrier. Unfortunately the helicopter does not react because there are too many disturbances in the signal that the checksum of the IR protocol never matches.

To track the problem down I directly used the test3.c program to generate a 38kHz carrier modulated with 500Hz. On my scope I can see the carrier and the signal with many disturbances. I used a serial IR receiver and the "mode2" program from the lirc package to sample the signal. mode2 just writes the pulse (carrier) and space (no carrier) length in µs to the console and from the plot I can see that the disturbances in the signal is not sporadic, but periodic! I uploaded a picture that shows the pulse/space recording for the following parameter: BAUDRATE=65536, TXBUFSZ=262144. The data is written continuously in a while-loop with "ftdi_write_data(&ftdic,txbuf,TXBUFSZ)":

In the last days I tried many things to track this problem down but I could not find any solution:
- different baudrate settings
- different chunksize
- different buffer sizes
Sometimes it seems that the carrier (high,low,high,low...) is followed by the same length of high state only so I thought that there has to be a 0 at the end of the buffer to ensure that the signal gets low again (as written somewhere in the documents). Nothing seemed to have an impact. BTW: the document "Bit Bang Modes for the FT232R and FT245R" ( is not correct: if you set the baudrate to 9600 a single bit is only ~3.2µs long and not 6.5! Oh, and using different versions of the libftdi library (0.13, 0.17 and 1.0) does not help either...

So is there any way to make it work with this type of chip or should I stop trying and use something else? The one thing that I have not tried so far is to put the signal to one of the CBUS lines and use the CBUS bitbang mode. So could this be an option to make it work? Or should I use the D2XX library for linux instead of libftdi?

I would really appreciate some hints.


libftdi - see for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
Current Thread