AN232R-01 FTDI | Alldatasheet
Document overview
- Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
- PDF pages: 13
Technical content
Copyright © 2006 Future Technology Devices International Ltd. Future Technology DevicesInternational Ltd.AN232R-01 Bit Bang Modes for theFT232R and FT245R
2AN232R-01 Bit Bang Modes for the FT232R and FT245R Copyright © 2006 Future Technology Devices International Ltd. 1Bit 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 , which is the same as the FTDI BM and C chip-style Bit Bang mode, with the addition of Read and Write strobes in the case of the FT232R. Synchronous Bit Bang Mode , where data is only read from the device when the device is written to. This is the same as the FT2232 Synchronous Bit Bang mode. CBUS Bit Bang Mode , 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. 358
3Bit Bang Modes for the FT232R and FT245R Copyright © 2006 Future Technology Devices International Ltd.
1.2 Asynchronous Bit Bang Mode
Asynchronous Bit Bang mode is the same as BM-style Bit Bang mode. Any data written to the device in the normal manner will be self-clocked onto the data pins which have been configured as outputs. Each pin can be independently set as an input or an output. The rate that the data is clocked 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 no new 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/ FT245RL Pin Number FT232RQ/ FT245RQ Pin Number Signal Type
Description
In the case of the FT232R, any of CBUS0, CBUS1, CBUS2 or CBUS3 can be configured to bring out 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, 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 not available for the FT245R. FT232RL Pin Number FT232RQ Pin Number Signal Type A number of D2XX driver commands are needed to use Asynchronous Bit Bang mode. The commands of interest are listed below:
4AN232R-01 Bit Bang Modes for the FT232R and FT245R Copyright © 2006 Future Technology Devices International Ltd. D2XX Function FT_SetBitMode Asynchronous Bit Bang mode is enabled using the FT_SetBitMode command. A value of 0x01 will enable it and a value of 0x00 will reset the device mode. FT_SetBaudRate The rate of data transfer can be controlled by using the FT_SetBaudRate command. The maximum Baud rate is 3MBaud, but to allow time for the data to be setup and held around the WR# strobe the Baud rate should be less than 1MBaud. The clock for the Asynchronous Bit Bang mode is actually 16 times the Baud rate. A value of 9600 Baud would transfer the data at (9600x16) = 153600 bytes per second, or 1 every 6.5 m FT_Write Data can be written to the device in Asynchronous Bit Bang mode using the FT_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 the pins 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 those which 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
5Bit Bang Modes for the FT232R and FT245R Copyright © 2006 Future Technology Devices International Ltd.
1.3 Synchronous Bit Bang Mode
Synchronous Bit Bang mode is the same as the FT2232 Synchronous Bit Bang mode. With Synchronous Bit Bang mode, data will only be sent out if there is space in the device for data to be read 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 to read 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: Time RD# is set inactive RD# is set active again, and any pins that are output will change to the new data. Clock state for data setup WR# goes active WR# goes inactive For the data to change there has to be new data written and the Baud rate clock has to tick. If no new data is written to the device, the pins will hold the last value written.
6AN232R-01 Bit Bang Modes for the FT232R and FT245R Copyright © 2006 Future Technology Devices International Ltd. When Synchronous Bit Bang mode is enabled the IO signal lines are configured as follows: FT232RL/ FT245RL Pin Number FT232RQ/ FT245RQ Pin Number Signal Type In the case of the FT232R, any of CBUS0, CBUS1, CBUS2 or CBUS3 can be configured to bring out 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 not available for the FT245R. FT232RL Pin Number FT232RQ Pin Number Signal Type A number of D2XX driver commands are needed to use Synchronous Bit Bang mode. The commands of interest are listed below:
7Bit Bang Modes for the FT232R and FT245R Copyright © 2006 Future Technology Devices International Ltd. D2XX Function FT_SetBitMode Synchronous Bit Bang mode is enabled using the FT_SetBitMode command. A value of 0x04 will enable it and a value of 0x00 will reset the device mode. FT_SetBaudRate The rate of data transfer can be controlled by using the FT_SetBaudRate command. The maximum Baud rate is 3MBaud, but to allow time for the data to be setup and held around the WR# strobe the Baud rate should be less than 1MBaud. The clock for the Synchronous Bit Bang mode is actually 16 times the Baud rate. A value of 9600 Baud would transfer the data at (9600x16) = 153600 bytes per second, or 1 every 6.5 m FT_Write Data can be written to the device in Synchronous Bit Bang mode using the FT_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 the pins 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 those which 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
8AN232R-01 Bit Bang Modes for the FT232R and FT245R Copyright © 2006 Future Technology Devices International Ltd.
1.4 CBUS Bit Bang Mode
The FT232R supports a new type of Bit Bang mode on the CBUS pins. The CBUS Bit Bang mode must be configured in the FT232R EEPROM and then enabled with a FT_SetBitMode command to function. 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 Number Signal Type 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 version of Bit Bang is much slower than the Asynchronous and Synchronous Bit Bang types when used to transfer 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 FT_SetBitMode CBUS Bit Bang mode is enabled using the FT_SetBitMode command. A value 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 or outputs, 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 the pins, 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: FT_GetBitMode(Handle, Data) where the lower nibble is given by (Data AND 0x0F) 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
9Bit Bang Modes for the FT232R and FT245R Copyright © 2006 Future Technology Devices International Ltd.
1.5 References
D2XX Programmer's Guide Sample Projects
10AN232R-01 Bit Bang Modes for the FT232R and FT245R Copyright © 2006 Future Technology Devices International Ltd. 2History, Disclaimer, Contact 2.1 Document Revision History Version Release Date Comments 1.0 December 2005 Initial release.
11History, Disclaimer, Contact Copyright © 2006 Future Technology Devices International Ltd.
2.2 Disclaimer
Copyright © 2006 Future Technology Devices International Ltd. Neither the whole nor any part of the information contained in, or the product described in this manual, may be adapted or reproduced in any material or electronic form without the prior written consent of the copyright holder. This product and its documentation are supplied on an as-is basis and no warranty as to their suitability 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.
12AN232R-01 Bit Bang Modes for the FT232R and FT245R Copyright © 2006 Future Technology Devices International Ltd.
2.3 Contact Information
Head Office - Glasgow, UK Future Technology Devices International Limited
373 Scotland Street
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 Taiwan ROC Tel: +886 2 8791 3570 Fax: +886 2 8791 3576 E-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
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 our distributor(s) in your country.
Index- A -Asynchronous Bit Bang Mode 3- C -CBUS Bit Bang Mode 8Contact 12- D -Disclaimer 11- E -E-Mail 12- F -FT232R 3, 5, 8FT245R 3, 5- H -History 10- S -Synhcronous Bit Bang Mode 5 Index13 Copyright © 2006 Future Technology Devices International Ltd.