FT232BM /FT245BM BIT BANG MODE



Similar documents
a8251 Features General Description Programmable Communications Interface

RJ45 Shielded (standard) port pinout. CS9000, Jetstream , Lanstream 2000, RTA8/RJX, RRC16, MTA8/RJX & SXDC8/RJX

DLP-USB232M USB SERIAL UART Interface Module

2-Port RS232/422/485 Combo Serial PCI Card

RS-232 COMMUNICATIONS

VSCOM USB PRO Series Industrial I/O Adapters

16-Port RS232 to USB2.0 High Speed Multi Serial Adapter (w/ Metal Case) Installation Guide

Manual Serial PCI Cards

2-Port RS232/422/485 Combo Serial to USB2.0 Adapter (w/ Metal Case and Screw Lock Mechanism) Installation Guide

Objectives. Basics of Serial Communication. Simplex vs Duplex. CMPE328 Microprocessors (Spring ) Serial Interfacing. By Dr.

USB TO SERIAL ADAPTER

The Analyst RS422/RS232 Tester. With. VTR, Monitor, and Data Logging Option (LOG2) User Manual

Serial Communications

WHQL Certification Approval...2 User Interface...3 SUNIX s COMLab..4

PCMCIA 1 Port RS EDITION OCTOBER 1999

BLUETOOTH SERIAL PORT PROFILE. iwrap APPLICATION NOTE

Cable Guide. Click on the subject to view the information. Digi Cables Building Cables General Cable Information

TTL-232R-3V3 USB to TTL Serial Converter Cable

UART IP Core Specification. Author: Jacob Gorban

RS-485 Protocol Manual

ELAN DIGITAL SYSTEMS LTD. SL232 PC- CARD USER S GUIDE

VDIP1. Vinculum VNC1L Module. Datasheet

RS232C < - > RS485 CONVERTER S MANUAL. Model: LD15U. Phone: / 97 / 98 (M)

Using Xbee in Serial Communication

Future Technology Devices International Ltd FT232H Single Channel Hi- Speed USB to Multipurpose UART/FIFO IC

The Answer to the 14 Most Frequently Asked Modbus Questions

ALL-USB-RS422/485. User Manual. USB to Serial Converter RS422/485. ALLNET GmbH Computersysteme Alle Rechte vorbehalten

Experiments: Labview and RS232

UC232R ChiPi Minimum Component FT232RL USB to RS232 Converter Cable

USB to serial chip CH340

Using HyperTerminal with Agilent General Purpose Instruments

Cabling Guide for Console and AUX Ports

1.1 Connection Direct COM port connection. 1. Half duplex RS232 spy cable without handshaking

Part 1. MAX BIT DAC with an Arduino Board. MIDI to Voltage Converter Part1

Industrial Multi-port Serial Cards

User s Manual TCP/IP TO RS-232/422/485 CONVERTER. 1.1 Introduction. 1.2 Main features. Dynamic DNS

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

PART B QUESTIONS AND ANSWERS UNIT I

Single channel data transceiver module WIZ2-434

Elo Interactive Digital Signage (IDS): Remote Management

SyncLink GT2/GT4 Serial Adapter

Introduction: Implementation of the MVI56-MCM module for modbus communications:

Future Technology Devices International Ltd

Why you need to monitor serial communication?

RS-422/485 Multiport Serial PCI Card. RS-422/485 Multiport Serial PCI Card Installation Guide

LS-101 LAN to Serial Device server. User s Manual

EvB 5.1 v5 User s Guide

Elettronica dei Sistemi Digitali Costantino Giaconia SERIAL I/O COMMON PROTOCOLS

8254 PROGRAMMABLE INTERVAL TIMER

USB2.0 <=> I2C V4.4. Konverter Kabel und Box mit Galvanischetrennung

How to setup a serial Bluetooth adapter Master Guide

Application Note 83 Fundamentals of RS 232 Serial Communications

PL-2303 Edition USB to Serial Bridge Controller Product Datasheet

DSX Master Communications

Future Technology Devices International Ltd

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Cable Pinouts. SRP I/O Module

WHQL Certification Approval...2 User Interface K software FIFO 4 Universal PCI Interface...5 Ready for 64-bit System...5

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Technical data. General specifications. Indicators/operating means. 30 Hz Multiplex operation 30 Hz / n, n = number of sensors, n 5

Wireless Security Camera

Application Note AN_208. FT311D and FT312D Demo_APK_User_GuideFT311D and FT312D Demo_APK_User_Guide

Application Note 2. Using the TCPDIAL & TCPPERM Commands to Connect Two TransPort router Serial Interfaces Over TCP/IP.

Serial Communications

Future Technology Devices International Ltd FT2232H Dual High Speed USB to Multipurpose UART/FIFO IC

isco Connecting Routers Back to Back Through the AUX P

BIT COMMANDER. Serial RS232 / RS485 to Ethernet Converter

USART and Asynchronous Communication

Using a Laptop Computer with a USB or Serial Port Adapter to Communicate With the Eagle System

NB3H5150 I2C Programming Guide. I2C/SMBus Custom Configuration Application Note

Advanced Data Capture and Control Systems

The DB9-USB Family of. UART Converter Modules. Datasheet

IP SERIAL DEVICE SERVER

RS232 Programming and Troubleshooting Guide for Turbo Controls

LOW COST GSM MODEM. Description. Part Number

MasterBlaster Serial/USB Communications Cable User Guide

Work with Arduino Hardware

DS Wire Digital Thermometer and Thermostat

Making a DB to RJ45 adapter.

1-Port R422/485 Serial PCIe Card

XR-500 [Receipt Printer User s Manual ]

Using Altera MAX Series as Microcontroller I/O Expanders

Monitor Program (Windows version) Instruction Manual

The 104 Duke_ACC Machine

Application Note AN_243. FT312D USB Host to UART Cable Application

x10* CP290 HOME CONTROL INTERFACE PROGRAMMING GUIDE FOR ADVANCED PROGRAMMERS

8051 MICROCONTROLLER COURSE

K128. USB PICmicro Programmer. DIY Electronics (HK) Ltd PO Box 88458, Sham Shui Po, Hong Kong. mailto:

MACHINE ARCHITECTURE & LANGUAGE

DB9-USB-RS232 Module. Male & Female. Datasheet

Measurement and Analysis Introduction of ISO7816 (Smart Card)

DeviceMaster UP Modbus Controller to Controller Communication

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

USB to FIFO Parallel Interface Module

USB-COM232-PLUS4. Datasheet

2-port RS-232 High Speed Low Profile Universal PCI Serial Board

Appendix A. This Appendix includes the following supplemental material:

GTS-4E Hardware User Manual. Version: V1.1.0 Date:

Transcription:

Definition FT232BM /FT245BM BIT BANG MODE The FT232BM and FT245BM chips can be set up in a special mode where the normal function of the chips are replaced. This mode changes the 8 data lines on the FT245BM or the RS232 data and control lines of the FT232BM to an 8 bit bi-directional bus. The purpose of this mode was intended to be used to program FPGA devices. It may also be used to talk to serial EEPPROMs or load a data latch. Pin Definitions FT245BM FT232BM Bit-Bang Data bit Data0 TXD Data0 Data1 RXD Data1 Data2 RTS Data2 Data3 CTS Data3 Data4 DTR Data4 Data5 DSR Data5 Data6 DCD Data6 Data7 RI Data7 Mode of Operation Any data written to the device in the normal manner will be self clocked onto the data pins (for the pins that have been programmed as outputs). Each pin can be set as an input or an output independant of the other pins. The rate of clocking out the data is controlled by the baud rate generator. This exists in both the FT245BM as well as the FT232BM. For the data to change, there has to be new data written and the baud clock has to tick. If you do not write any new data to the device then the pins will hold the last value written. The commands of interest are : 1) FT_SetBaudRate(ftHandle : Dword ; BaudRate : Dword) : FT_Result; This controls the rate of transferring bytes that have been written to the device onto the pins. It also sets the sampling of the pins and transferring the result back to the Read path of the chip. The maximum baud rate is 3 MegaBaud. The clock for the Bit Bang mode is actually 16 times the baudrate. A value of 9600 baud would transfer the data at (9600 x 16) = 153600 bytes per second or 1 every 6.5 us. 2) FT_SetBitMode (fthandle : Dword ; ucmask, ucenable : Byte) : FT_Result; This sets up which bits are input and which are output. The ucmask byte sets the direction. A 1 means the corresponding bit is to be an output. A 0 means the corresponding bit is to be an input. When read data is passed back to the PC, the current pin state for both inputs and outputs will used. The ucenable byte will turn the bit bang mode off and on. Setting bit 0 to 1 turns it on. Clearing bit 0 to 0 turns it off. 3) FT_GetBitMode ( fthandle : Dword ; pucdata : pointer ) : FT_Result; This function does an immediate read of the 8 pins and passes back the value. This is useful to see what the pins are doing now. The normal Read pipe will contain the same result but it has also been sampling the pins continuously (up until its buffers become full). Therefor the data in the Read pipe will be old.

Example : Programing an Altera FLEX10K FPGA This example interfaces to an Altera FLEX10K FPGA. A cable was made up in the following manner : Bit Bang bit Mode ALTERA Pin 0 OUT CLK 1 OUT nconfig 2 OUT DATA0 3 IN nstatus 4 IN CONF_DONE 5 IN not used 6 IN not used 7 IN not used This code was written in Delphi Pascal. function CheckStatus : boolean; //------------------------------------------------ // returns true unless there is an error. // // This is reading the nstatus line from the FPGA //------------------------------------------------ var res : FT_Result; NStat : byte; i,j : integer; CheckStatus := True; res := Get_USB_Device_BitMode(NStat); NStat := NStat AND $08; if NStat = 0 then CheckStatus := False; procedure SendBitByte2(ByteToSnd : byte; Offset : integer); //----------------------------------------------------------------- // This takes a byte to send serialy to the FPGA and converts // it into 16 bytes to be transmitted down USB. Each bit of the // byte is put onto data bit 2 of the device and clocked using data // bit 0. //----------------------------------------------------------------- var SendingByte : byte; // bit 0 if (ByteToSnd AND $01) <> 0 then SendingByte := SendingByte + $04; FT_Out_Buffer[Offset + 0]:= SendingByte;

FT_Out_Buffer[Offset + 1]:= SendingByte + $01; // clock high // bit 1 if (ByteToSnd AND $02) <> 0 then SendingByte := SendingByte + $04; FT_Out_Buffer[Offset + 2]:= SendingByte; FT_Out_Buffer[Offset + 3]:= SendingByte + $01; // clock high // bit 2 if (ByteToSnd AND $04) <> 0 then SendingByte := SendingByte + $04; FT_Out_Buffer[Offset + 4]:= SendingByte; FT_Out_Buffer[Offset + 5]:= SendingByte + $01; // clock high // bit 3 if (ByteToSnd AND $08) <> 0 then SendingByte := SendingByte + $04; FT_Out_Buffer[Offset + 6]:= SendingByte; FT_Out_Buffer[Offset + 7]:= SendingByte + $01; // clock high // bit 4 if (ByteToSnd AND $10) <> 0 then SendingByte := SendingByte + $04; FT_Out_Buffer[Offset + 8]:= SendingByte; FT_Out_Buffer[Offset + 9]:= SendingByte + $01; // clock high // bit 5 if (ByteToSnd AND $20) <> 0 then SendingByte := SendingByte + $04; FT_Out_Buffer[Offset + 10]:= SendingByte; FT_Out_Buffer[Offset + 11]:= SendingByte + $01; // clock high // bit 6 if (ByteToSnd AND $40) <> 0 then SendingByte := SendingByte + $04; FT_Out_Buffer[Offset + 12]:= SendingByte; FT_Out_Buffer[Offset + 13]:= SendingByte + $01; // clock high // bit 7 if (ByteToSnd AND $80) <> 0 then SendingByte := SendingByte + $04; FT_Out_Buffer[Offset + 14]:= SendingByte; FT_Out_Buffer[Offset + 15]:= SendingByte + $01; // clock high procedure SendBitByte(ByteToSnd : byte; SendNow : Boolean ); //------------------------------------------------------------- // This routine calls the routine to serialise the byte and // then decides if it should send the packet down to USB. It does // this to maximise band width on the USB bus. //------------------------------------------------------------- var SendingByte : byte; SendBitByte2(ByteToSnd,Offset); OffSet := OffSet + 16; if (SendNow OR (OffSet = 4096)) then Application Note AN232BM-01

SendBytes(OffSet); OffSet := 0; procedure CompleteProg; //---------------------------------------------------- // Clock the FPGA 10 times to complete its programming //---------------------------------------------------- var SendingByte : byte; FT_Out_Buffer[0]:= SendingByte; FT_Out_Buffer[1]:= SendingByte OR $03; // clock high FT_Out_Buffer[2]:= SendingByte; FT_Out_Buffer[3]:= SendingByte OR $03; // clock high FT_Out_Buffer[4]:= SendingByte; FT_Out_Buffer[5]:= SendingByte OR $03; // clock high FT_Out_Buffer[6]:= SendingByte; FT_Out_Buffer[7]:= SendingByte OR $03; // clock high FT_Out_Buffer[8]:= SendingByte; FT_Out_Buffer[9]:= SendingByte OR $03; // clock high FT_Out_Buffer[10]:= SendingByte; FT_Out_Buffer[11]:= SendingByte OR $03; // clock high FT_Out_Buffer[12]:= SendingByte; FT_Out_Buffer[13]:= SendingByte OR $03; // clock high FT_Out_Buffer[14]:= SendingByte; FT_Out_Buffer[15]:= SendingByte OR $03; // clock high FT_Out_Buffer[16]:= SendingByte; FT_Out_Buffer[17]:= SendingByte OR $03; // clock high FT_Out_Buffer[18]:= SendingByte; FT_Out_Buffer[19]:= SendingByte OR $03; // clock high SendBytes(20); function CheckDone : boolean; //-------------------------------------------------- // Returns false unless it is finished.

// // This checks the CONF_DONE line from the FPGA. //-------------------------------------------------- var res : FT_Result; NStat : byte; CheckDone := False; res := Get_USB_Device_BitMode(NStat); NStat := NStat AND $10; if NStat <> 0 then CheckDone := True; function StartConfig : boolean; //---------------------------------------------------------- // returns true if confdone is low after pulsing nconfig // // It sets up a pulse on nconfig by keeping the nconfig line // low over several bytes. //---------------------------------------------------------- var started : boolean; FT_Out_Buffer[0]:= $02; FT_Out_Buffer[1]:= $00; // pulse config FT_Out_Buffer[2]:= $00; // pulse config FT_Out_Buffer[3]:= $00; // pulse config FT_Out_Buffer[4]:= $00; // pulse config FT_Out_Buffer[5]:= $00; // pulse config FT_Out_Buffer[6]:= $00; // pulse config FT_Out_Buffer[7]:= $00; // pulse config FT_Out_Buffer[8]:= $00; // pulse config FT_Out_Buffer[9]:= $00; // pulse config FT_Out_Buffer[10]:= $00; // pulse config FT_Out_Buffer[11]:= $00; // pulse config FT_Out_Buffer[12]:= $00; // pulse config FT_Out_Buffer[13]:= $00; // pulse config FT_Out_Buffer[14]:= $02; SendBytes(15); started := CheckDone; if started then StartConfig := False else StartConfig := True; procedure ProgramFPGA; //--------------------------------------------------------- // This is the main entry point for programming the device. // It sets up the device and opens the file to use. It then // reads the file and sends the data to the FPGA checking for // errors on the way. //--------------------------------------------------------- var RBFFile : file;

ibytesread,byteswritten : integer; PageData : Array[0..511] of Byte; i : integer; Complete,Passed,ImmSend : Boolean; res : FT_Result; // Bit Mode On OpenComPort; SetupComPort; res := Set_USB_Device_BitMode($07,$01); AssignFile(RBFFile, form1.edit2.text); // Open input file Reset(RBFFile,1); // Record size = 1 Complete := false; OffSet := 0; res := Reset_USB_Device; FT_Current_Baud := 57600; // = 16 * 57600 = 1.08 us period res := Set_USB_Device_BaudRate; BytesWritten := 0; DisplayClr; if not( EOF(RBFFile)) then Complete := StartConfig; // start sequence - will return success if Complete then Complete := False else Complete := True; repeat BlockRead(RBFFile, PageData, 256, ibytesread); if (ibytesread > 0) then for i := 0 to (ibytesread - 1) do // for i := 0 to ibytesread do ImmSend := False; if (i = (ibytesread - 1)) then if ibytesread < 256 then ImmSend := True else ImmSend := False; SendBitByte(PageData[i],ImmSend); BytesWritten := BytesWritten + 1; Complete := CheckDone; Passed := CheckStatus; until (ibytesread = 0) OR Complete OR NOT Passed; if (ibytesread = 0) then if complete then

CompleteProg; // for last 10 clocks DisplayMsg( Programming Passed ); end else if NOT Passed then DisplayMsg( Programming Failed - nstatus ); DisplayMsg( Bytes Written = + inttostr(byteswritten)); end else DisplayMsg( Programming Failed - ran out of file ); DisplayMsg( Bytes Written = + inttostr(byteswritten)); CompleteProg; // for last 10 clocks CloseFile(RBFFile); res := Set_USB_Device_BitMode($07,$00); // turn bit bang mode off CloseComPort; Application Note AN232BM-01

Waveform diagram for the FPGA example CLK nconfig DATA0 nstatus CONFIG_DONE DATA VALUE WRITTEN TO DEVICE HEX 02 00 00 00 00 02 06 07 02 03 06 07 02 03 02 03 06 07 02 03 06