Future Technology Devices International Ltd. AN232B-09 Using the Modem Emulation Mode in FTDI's VCP Driver Copyright © 2005 Future Technology Devices International Ltd. I AN232B-09 Modem Emulation Mode Table of Contents Part I Introduction 2 Part II Modem Emulation 3 1 Method ................................................................................................................................... 3 2 XOn-XOff ................................................................................................................................... Software Handshaking 5 3 Enabling Modem ................................................................................................................................... Emulation Mode 6 Part III Document Revision History 7 Part IV Disclaimer 8 Part V Contact Information 9 0 Index Copyright © 2005 Future Technology Devices International Ltd. Introduction 1 2 Introduction Modem Emulation Mode is a special feature of FTDI's Virtual COM Port (VCP) driver that allows binary data to be transmitted over a two (or more) wire interface with full handshaking and modem control signalling, thus allowing PPP connections to be made. Possible applications include mobile phone data cables and radio links. Modem Emulation Mode can be setup in the driver INF file (FTDIPORT.INF) or can be enabled in the registry. Its purpose is to allow modem emulation to be done by the driver when the device attached is not a standard modem. The reason for this is that many standard applications require the DCD line to know that they are on the internet (e.g. for Dial Up Networking). Copyright © 2005 Future Technology Devices International Ltd. 3 AN232B-09 Modem Emulation Mode 2 Modem Emulation 2.1 Method This method can use XOn/XOff or hardware RTS/CTS handshaking. Both the XOn/XOff characters and the escape character are definable. The standard ones will be: XOn - 0x11 XOff - 0x13 EscChar - 0x10 Transmitter Receiver Data In Data Transmitted Data Received Data Out XOn EscChar + 0x01 EscChar + 0x01 XOn XOff EscChar + 0x02 EscChar + 0x02 XOff EscChar EscChar + EscChar EscChar + EscChar EscChar 0x01 0x01 0x01 0x01 0x02 0x02 0x02 0x02 Flow Control XOn XOn None Flow Control XOff XOff None FTDI Driver Application Hardware Command In Data Transmitted Data Received Status Out SetDTR EscChar + 0x03 EscChar + 0x03 DTR Active ClrDTR EscChar + 0x04 EscChar + 0x04 DTR Inactive 0x01 0x01 0x01 0x01 0x02 0x01 0x01 0x01 0x03 0x03 0x03 0x03 0x04 0x04 0x04 0x04 0x05 0x05 0x05 0x05 0x06 0x06 0x06 0x06 0x07 0x07 0x07 0x07 0x08 0x08 0x08 0x08 0x09 0x09 0x09 0x09 0x0A 0x0A 0x0A 0x0A 0x0B 0x0B 0x0B 0x0B 0x0C 0x0C 0x0C 0x0C 0x0D 0x0D 0x0D 0x0D 0x0E 0x0E 0x0E 0x0E 0x0F 0x0F 0x0F 0x0F Copyright © 2005 Future Technology Devices International Ltd. Modem Emulation The following ones are not applicable if RTS/CTS hardware handshaking is used: FTDI Driver Application Hardware Command In Data Transmitted Data Received Status Out SetRTS EscChar + 0x05 EscChar + 0x05 RTS Active ClrRTS EscChar + 0x06 EscChar + 0x06 RTS Inactive Application Hardware FTDI Driver Command In Data Transmitted Data Received Status Out SetDSR EscChar + 0x07 EscChar + 0x07 DSR Active ClrDSR EscChar + 0x08 EscChar + 0x08 DSR Inactive SetDCD EscChar + 0x09 EscChar + 0x09 DCD Active ClrDCD EscChar + 0x0A EscChar + 0x0A DCD Inactive SetRI EscChar + 0x0B EscChar + 0x0B RI Active ClrRI EscChar + 0x0C EscChar + 0x0C RI Inactive 0x01 0x01 0x01 0x01 0x02 0x02 0x02 0x02 0x03 0x03 0x03 0x03 0x04 0x04 0x04 0x04 0x05 0x05 0x05 0x05 0x06 0x06 0x06 0x06 0x07 0x07 0x07 0x07 0x08 0x08 0x08 0x08 0x09 0x09 0x09 0x09 0x0A 0x0A 0x0A 0x0A 0x0B 0x0B 0x0B 0x0B 0x0C 0x0C 0x0C 0x0C 0x0D 0x0D 0x0D 0x0D 0x0E 0x0E 0x0E 0x0E The following ones are not applicable if RTS/CTS hardware handshaking is used: Application Hardware FTDI Driver Command In Data Transmitted Data Received Status Out SetCTS EscChar + 0x0D EscChar + 0x0D CTS Active ClrCTS EscChar + 0x0E EscChar + 0x0E CTS INactive Copyright © 2005 Future Technology Devices International Ltd. 4 5 2.2 AN232B-09 Modem Emulation Mode XOn-XOff Software Handshaking If the XOn and XOff characters are substituted in this way, then raw binary may be sent without affecting the flow control. If the transmitter receives the XOff character it should stop transmission and start it on XOn being received. If the receiver wants to stop transmission it should send the XOff etc. Copyright © 2005 Future Technology Devices International Ltd. Modem Emulation 2.3 6 Enabling Modem Emulation Mode Modem Emulation mode substitution bits can be enabled by setting the following bits in the VCP driver INF file FTDIPORT.INF : HKR,,"EmulationMode",0x00010001,0x0000nnnn {HEX format} Force XOn/XOff handshaking if any flow control is active - bit 0 For the following substitutions the following convention will be used : 0,0 = off 0,1 = on 1,0 = don't set 1,1 = don't set Substitute XOn/XOff and Control Char - bit 2,1 Substitute DSR and Control Char - bit 4,3 Substitute RI and Control Char - bit 6,5 Substitute DCD and Control Char - bit 8,7 Substitute CTS and Control Char - bit 10,9 Substitute RTS and Control Char - bit 12,11 Substitute DTR and Control Char - bit 14,13 If the appropriate bit is not set, then the driver will assume the normal method for receiving/setting the line. Copyright © 2005 Future Technology Devices International Ltd. 7 3 AN232B-09 Modem Emulation Mode Document Revision History Version Release Date Comments 1.0 March 2004 Initial release 2.0 May 2005 "Data Out" or "Status Out" column added to each table. Copyright © 2005 Future Technology Devices International Ltd. Disclaimer 4 8 Disclaimer Copyright © 2005 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. Copyright © 2005 Future Technology Devices International Ltd. 9 5 AN232B-09 Modem Emulation Mode Contact Information Head Office - Glasgow, UK Future 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): [email protected] E-Mail (Support): [email protected] E-Mail (General Enquiries): [email protected] 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): [email protected] E-Mail (Support): [email protected] E-Mail (General Enquiries): [email protected] 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): [email protected] E-Mail (Support): [email protected] E-Mail (General Enquiries): [email protected] 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. Copyright © 2005 Future Technology Devices International Ltd.