Future Technology Devices
International Ltd.

AN232R-01 Bit Bang Modes for theFT232R and FT245R

Copyright © 2006 Future Technology Devices International Ltd.

2

AN232R-01 Bit Bang Modes for the FT232R and FT245R

1

Bit Bang Modes for the FT232R and FT245R

1.1

Overview
Bit Bang mode is a special FT232R and FT245R device mode that changes the 8 IO lines into an 8
bit bi-directional data bus. There are three types of Bit Bang mode for the FT232R:· Asynchronous Bit Bang Mode 3 , which is the same as the FTDI BM and C chip-style Bit Bangmode, with the addition of Read and Write strobes in the case of the FT232R.
· Synchronous Bit Bang Mode 5 , where data is only read from the device when the device iswritten to. This is the same as the FT2232 Synchronous Bit Bang mode.
· CBUS Bit Bang Mode 8 , a new 4-bit version of Bit Bang mode is available on the FT232R
CBUS pins.
Asynchronous and Synchronous Bit Bang modes are enabled by driver commands, while CBUS Bit
Bang must be set up in the device EEPROM before it can be enabled with a driver command.

Copyright © 2006 Future Technology Devices International Ltd.

Bit Bang Modes for the FT232R and FT245R

1.2

3

Asynchronous Bit Bang Mode
Asynchronous Bit Bang mode is the same as BM-style Bit Bang mode. Any data written to thedevice in the normal manner will be self-clocked onto the data pins which have been configured asoutputs. Each pin can be independently set as an input or an output. The rate that the data isclocked out at is controlled by the Baud rate generator.
For the data to change there, has to be new data written and the Baud rate clock has to tick. If nonew data is written to the device, the pins will hold the last value written.
When Asynchronous Bit Bang mode is enabled the IO signal lines are configured as follows:

FT232RL/ FT232RQ/
FT245RL FT245RQ Signal
PinPinNumberNumberType

Description

130

D0Input/Output

Bit Bang Data Bus Bit 052

D1

Input/Output

Bit Bang Data Bus Bit 1

332

D2Input/Output

Bit Bang Data Bus Bit 2

118

D3

Input/Output

Bit Bang Data Bus Bit 3231

D4Input/Output

Bit Bang Data Bus Bit 496

D5Input/Output

Bit Bang Data Bus Bit 5107D6Input/Output

Bit Bang Data Bus Bit 663D7Input/Output

Bit Bang Data Bus Bit 7

In the case of the FT232R, any of CBUS0, CBUS1, CBUS2 or CBUS3 can be configured to bringout the internal RD# or WR# strobes when the device is in Asynchronous Bit Bang mode, this is
the same as the Enhanced Asynchronous Bit Bang mode of the FT2232 device. Alternatively, theCBUS pins can be used to provide clock signals by setting the appropriate values in the EEPROM.
The CBUS must be configured in the FT232R EEPROM. This option is not available for theFT245R.

FT232RL
Pin
Number

FT232RQ
Pin
NumberSignal

Type

Description

2322C0

Input/Output

Configurable function

2221

C1

Input/Output

Configurable function

1310C2

Input/Output

Configurable function

1411

C3

Input/Output

Configurable function

A number of D2XX driver commands are needed to use Asynchronous Bit Bang mode. Thecommands of interest are listed below:

Copyright © 2006 Future Technology Devices International Ltd.

4

AN232R-01 Bit Bang Modes for the FT232R and FT245R

D2XX Function

Description

FT_SetBitModeAsynchronous Bit Bang mode is enabled using the FT_SetBitModecommand. A value of 0x01 will enable it and a value of 0x00 will reset thedevice mode.

FT_SetBaudRate

The rate of data transfer can be controlled by using the FT_SetBaudRatecommand. The maximum Baud rate is 3MBaud, but to allow time for thedata to be setup and held around the WR# strobe the Baud rate should beless than 1MBaud.
The clock for the Asynchronous Bit Bang mode is actually 16 times theBaud rate. A value of 9600 Baud would transfer the data at (9600x16) =153600 bytes per second, or 1 every 6.5 mS.

FT_Write

Data can be written to the device in Asynchronous Bit Bang mode using theFT_Write command. If multiple bytes are written to the device the values
on the pins will change at the rate set by FT_SetBaudRate.

FT_GetBitMode

FT_GetBitMode returns the instantaneous value of the pins. A single byte
will be returned containing the current values of the pins, both those which
are inputs and those which are outputs.

FT_Read

FT_Read will return a buffer of values which have been sampled from thepins at the rate set by FT_SetBaudRate. If the read buffers have filled, data
willl be lost. Each byte returned contains the values of the pins, both thosewhich are inputs and those which are outputs.

Full descriptions of these functions are available in the D2XX Programmer's Guide.
Code examples can be downloaded from http://www.ftdichip.com/Projects/CodeExamples.htm.

Copyright © 2006 Future Technology Devices International Ltd.

Bit Bang Modes for the FT232R and FT245R

1.3

5

Synchronous Bit Bang Mode
Synchronous Bit Bang mode is the same as the FT2232 Synchronous Bit Bang mode. WithSynchronous Bit Bang mode, data will only be sent out if there is space in the device for data to beread from the pins. This Synchronous Bit Bang mode will read the data bus pins first, before it
sends out the byte that has just been transmitted. It is therefore 1 byte behind the output and so toread the inputs for the byte that you have just sent, another byte must be sent. For example:· Pins start at 0xFF
· Send 0x55, 0xAA
· Pins go to 0x55 and then to 0xAA· Data read = 0xFF, 0x55
· Pins start at 0xFF
· Send 0x55, 0xAA, 0xAA (repeat the last byte sent)· Pins go to 0x55 and then to 0xAA
· Data read = 0xFF, 0x55, 0xAA
The timing for Synchronous Bit bang is described in this diagram and the table below:

TimeDescription

t1

Current pin state is readt2

RD# is set inactivet3
t4

RD# is set active again, and any pins that are
output will change to the new data.
Clock state for data setup

t5

WR# goes activet6

WR# goes inactive

For the data to change there has to be new data written and the Baud rate clock has to tick. If nonew data is written to the device, the pins will hold the last value written.

Copyright © 2006 Future Technology Devices International Ltd.

6AN232R-01 Bit Bang Modes for the FT232R and FT245R
When Synchronous Bit Bang mode is enabled the IO signal lines are configured as follows:

FT232RL/ FT232RQ/
FT245RL FT245RQ Signal
Pin
Pin
NumberNumberType

Description

130

D0

Input/Output

Bit Bang Data Bus Bit 052

D1

Input/Output

Bit Bang Data Bus Bit 1332

D2Input/Output

Bit Bang Data Bus Bit 2

118

D3Input/Output

Bit Bang Data Bus Bit 3

231

D4Input/Output

Bit Bang Data Bus Bit 4

96D5Input/Output

Bit Bang Data Bus Bit 5

107

D6Input/Output

Bit Bang Data Bus Bit 663

D7Input/Output

Bit Bang Data Bus Bit 7

In the case of the FT232R, any of CBUS0, CBUS1, CBUS2 or CBUS3 can be configured to bringout the internal RD# or WR# strobes when the device is in Synchronous Bit Bang mode.
Alternatively, the CBUS pins can be used to provide clock signals by setting the appropriate values
in the EEPROM. The CBUS must be configured in the FT232R EEPROM. This option is notavailable for the FT245R.

FT232RL
Pin
Number

FT232RQ
Pin
NumberSignal

Type

Description

23

22

C0

Input/Output

Configurable function

22

21

C1

Input/Output

Configurable function

1310

C2

Input/Output

Configurable function

1411

C3

Input/Output

Configurable function

A number of D2XX driver commands are needed to use Synchronous Bit Bang mode. The
commands of interest are listed below:

Copyright © 2006 Future Technology Devices International Ltd.

Bit Bang Modes for the FT232R and FT245R

D2XX Function

7Description

FT_SetBitMode

Synchronous Bit Bang mode is enabled using the FT_SetBitModecommand. A value of 0x04 will enable it and a value of 0x00 will reset thedevice mode.

FT_SetBaudRate

The rate of data transfer can be controlled by using the FT_SetBaudRatecommand. The maximum Baud rate is 3MBaud, but to allow time for thedata to be setup and held around the WR# strobe the Baud rate should beless than 1MBaud.
The clock for the Synchronous Bit Bang mode is actually 16 times the Baudrate. A value of 9600 Baud would transfer the data at (9600x16) = 153600
bytes per second, or 1 every 6.5 mS.

FT_Write

Data can be written to the device in Synchronous Bit Bang mode using theFT_Write command. If multiple bytes are written to the device the values
on the pins will change at the rate set by FT_SetBaudRate.

FT_GetBitMode

FT_GetBitMode returns the instantaneous value of the pins. A single byte
will be returned containing the current values of the pins, both those whichare inputs and those which are outputs.

FT_Read

FT_Read will return a buffer of values which have been sampled from thepins at the rate set by FT_SetBaudRate. If the read buffers have filled, data
willl be lost. Each byte returned contains the values of the pins, both thosewhich are inputs and those which are outputs.

Full descriptions of these functions are available in the D2XX Programmer's Guide.
Code examples can be downloaded from http://www.ftdichip.com/Projects/CodeExamples.htm.

Copyright © 2006 Future Technology Devices International Ltd.

81.4

AN232R-01 Bit Bang Modes for the FT232R and FT245R

CBUS Bit Bang Mode
The FT232R supports a new type of Bit Bang mode on the CBUS pins. The CBUS Bit Bang modemust be configured in the FT232R EEPROM and then enabled with a FT_SetBitMode command tofunction. It is not available on the FT245R.
When CBUS Bit Bang mode is enabled the CBUS pins are configured as follows:

FT232RL
Pin
Number

FT232RQ
Pin
NumberSignalType

Description

2322

C0

Input/Output

CBUS Bit Bang Bit 02221C1

Input/Output

CBUS Bit Bang Bit 1

1310C2Input/Output

CBUS Bit Bang Bit 2

1411C3

Input/Output

CBUS Bit Bang Bit 3

The FT_SetBitMode and FT_GetBitMode D2XX commands are required to communicate with
CBUS Bit Bang. Since these functions allow only a single byte to be sent or received, this versionof Bit Bang is much slower than the Asynchronous and Synchronous Bit Bang types when used totransfer large buffers of data with FT_Write and FT_Read, but it does provide an additional 4 IO
pins for the FT232R. The data transfer rate is limited by USB frames.
The D2XX commands required to use CBUS Bit Bang mode are listed below:

D2XX Function

Description

FT_SetBitMode

CBUS Bit Bang mode is enabled using the FT_SetBitMode command. Avalue of 0x20 will enable it and a value of 0x00 will reset the device mode.
Note that the CBUS pins must also be configured for CBUS Bit Bang in the
FT232R EEPROM.
FT_SetBitMode also provides the means to write data to the CBUS pins.
The upper nibble of the Mask parameter controls which pins are inputs oroutputs, while the lower nibble controls which of the outputs are high or low.

FT_GetBitMode

FT_GetBitMode returns the instantaneous value of the pins. A single byte
will be returned where the lower nibble contains the current values of thepins, both those which are inputs and those which are outputs.

For example:
Set all pins to output with bit 0 high:

FT_SetBitMode(Handle, 0xF1, 0x20)

Set bits 0 and 1 to input, bits 2 and 3 to output and make bits 2 and 3
high: FT_SetBitMode(Handle, 0xCC, 0x20)
Read pins:0x0F)

FT_GetBitMode(Handle, Data) where the lower nibble is given by (Data AND

Full descriptions of these functions are available in the D2XX Programmer's Guide.
Code examples can be downloaded from http://www.ftdichip.com/Projects/CodeExamples.htm.

Copyright © 2006 Future Technology Devices International Ltd.

Bit Bang Modes for the FT232R and FT245R

1.5

References
FT232R Datasheet
FT245R Datasheet
D2XX Programmer's Guide
Sample Projects

Copyright © 2006 Future Technology Devices International Ltd.

9

10AN232R-01 Bit Bang Modes for the FT232R and FT245R

2History, Disclaimer, Contact

2.1

Document Revision History
VersionRelease Date

Comments1.0December 2005

Initial release.

Copyright © 2006 Future Technology Devices International Ltd.

History, Disclaimer, Contact

2.2

11Disclaimer
Copyright © 2006 Future Technology Devices International Ltd.
Neither the whole nor any part of the information contained in, or the product described in thismanual, may be adapted or reproduced in any material or electronic form without the prior writtenconsent of the copyright holder.
This product and its documentation are supplied on an as-is basis and no warranty as to theirsuitability for any particular purpose is either made or implied.
Future Technology Devices International Ltd. will not accept any claim for damages howsoever
arising as a result of use or failure of this product. Your statutory rights are not affected.
This product or any variant of it is not intended for use in any medical appliance, device or system
in which the failure of the product might reasonably be expected to result in personal injury.
This document provides preliminary information that may be subject to change without notice.

Copyright © 2006 Future Technology Devices International Ltd.

122.3

AN232R-01 Bit Bang Modes for the FT232R and FT245R

Contact Information
Head Office - Glasgow, UKFuture Technology Devices International Limited
373 Scotland Street
Glasgow
G5 8QB
United Kingdom
Tel: +44 (0) 141 429 2777
Fax: +44 (0) 141 429 2758
E-Mail (Sales): sales1@ftdichip.com
E-Mail (Support): support2@ftdichip.com
E-Mail (General Enquiries): admin1@ftdichip.com
Web Site URL: http://www.ftdichip.com
Web Shop URL: http://apple.clickandbuild.com/cnb/shop/ftdichip

Branch Office - Taiwan
Future Technology Devices International Limited (Taiwan)
4F, No 16-1, Sec. 6 Mincyuan East Road
Neihu District
Taipei 114
TaiwanROC
Tel: +886 2 8791 3570
Fax: +886 2 8791 3576E-Mail (Sales): tw.sales1@ftdichip.com
E-Mail (Support): tw.support1@ftdichip.com
E-Mail (General Enquiries): tw.admin1@ftdichip.com
Web Site URL: http://www.ftdichip.com

Branch Office - Hillsboro, Oregon, USA
Future Technology Devices International Limited (USA)5285 NE Elam Young Parkway
Suite B800
Hillsboro, OR 97124-6499
USA
Tel: +1 (503) 547-0988
Fax: +1 (503) 547-0987
E-Mail (Sales): us.sales@ftdichip.com
E-Mail (Support): us.support@ftdichip.com
E-Mail (General Enquiries): us.admin@ftdichip.com
Web Site URL: http://www.ftdichip.com

Agents and Sales Representatives
Please visit the Sales Network page of the FTDI Web site for the contact details of ourdistributor(s) in your country.

Copyright © 2006 Future Technology Devices International Ltd.

IndexIndex-AAsynchronous Bit Bang Mode

3-CCBUS Bit Bang Mode
Contact 128-DDisclaimer

11-EE-Mail

12-FFT232R
FT245R3, 5, 83, 5-HHistory

10-SSynhcronous Bit Bang Mode

5Copyright © 2006 Future Technology Devices International Ltd.

13