Home

TN 147 Java D2xx for Android

image

Contents

1. eee eee eee eene nnne nnne 7 Figure 7 Demo Application Screenshot PIDVID ee eere enne 8 Figure 8 Demo Application Screenshot Misc e eere eee eere enne 9 Figure 9 Demo Application Screenshot OpenDevice eren 11 Figure 10 Demo Application Screenshot UART eene eere nnne nnne nnn 13 Figure 11 Demo Application Screenshot FileTransfer esee 14 Figure 12 Demo Application Screenshot EEPROM eren nnn nnne 15 Figure 13 Demo Application Screenshot EEPROM UseraArea ees 16 Copyright 2013Future Technology Devices International Limited 19 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 6 Appendix C Revision History Revision 1 0 1 1 1 2 Changes Initial Release for beta test First Public release Update to section 2 2 2 Copyright 2013Future Technology Devices International Limited Date 2013 01 24 2013 02 05 2013 09 16 20
2. In this demo these APIs are used Class API Name D2xxManager getVIDPID D2xxManager SetVIDPID Copyright 2013Future Technology Devices International Limited 8 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 2 2 4 Misc we FTDI D2xx Demo Information Loopback Test EAE Write Data Read Data PIDVID Test Info OpenDevice Enable Set Event UART Disable DTR FileTransfer Disable RTS EEPROM EEPROM UserArea Figure 8 Demo Application Screenshot Misc This demo application contains 1 Loopback demo There is a Loopback Test button and an input area for Write Data To run this test you must connect an RS232 loop back device which has pairs of pins connected together Rx to Tx RTS to CTS and DSR to DTR Enter some words in the Write Data area and tap Loopback Test Shortly the same data should appear in the Read Data area 1 Event demo Tap Enable Set Event to set event notification which waits RX event and then redo the actions in loopback demo When there is some data sent and received the event would be triggered The test results are displayed in the Test Info area 1 DTR RTS Enable Disable Demo The 2 functions Disable DTR and Disable RTS are for disabling enabling DTR and RTS The test results are displayed in the Test Info area Copyright 2013Future Technology Devices International Limited 9 FTDI
3. OpenDevice FileTransfer EEPROM EEPROM UserArea Test Set Char Test Set Break Figure 6 Demo Application Screenshot Status This demo application contains Start API Test Test Set Char and Test Set Break buttons Tap Start API Test to call several APIs to obtain the related information Test Set Char and Test Set Break buttons will show the test results on the buttons directly appended with Pass or Fail when they are tapped Copyright 2013Future Technology Devices International Limited 7 FTDI 19 Chip In this demo these APIs are used Document Reference No FT 000799 TN 147 Java D2xx for Android Technical Note TN 134Version 1 2 Class API Name FT Device getDeviceInfo FT Device getLatencyTimer FT Device getLineStatus FI Device getModemStatus FT Device setBitMode FT Device setBreakOff FT Device setBreakOn FT Device setChars 2 2 3 PIDVID un a N Mg FTDI D2xx Demo Information Status PIDVID Misc OpenDevice UART FileTransfer EEPROM EEPROM UserArea Set PID VID Get PID VID Figure 7 Demo Application Screenshot PIDVID This demo application contains two buttons Set PID VID and Get PID VID Get PIDVID lists all the devices in terms of Product and Vendor IDs that would be recognised and supported by D2XX To specify an additional device enter the corresponding Product and Vendor ID then tap Set PIDVID
4. API of a pre compiled Linux D2XX library This solution is applicable to all versions of Android but requires special root privilege on USB related device nodes This is for reusing existing Linux designs in Android applications or creating projects for Android OS predating version 3 2 2 A Java class library supporting USB Host is available and applicable to Android v3 2or any later series This library requires no special root access privileges The first solution is described in TN 134 FTDI Android D2XX Driver This document describes the second solution which can be easily adapted by Android application developers i e the Java D2xx API for Android The API is packaged in d2xx jar and is distributed with demo application source code which can be downloaded from FTDI s website 1 2 Prerequisites The following is required to install the FTDI Java D2xx for Android driver e An Android device running v3 2 or later OS with a USB Host or OTG interface e An FTDI based device for testing o FTDI testing was conducted using a Google Nexus 7 and an FT232R based US232R cable To develop an application using the FTDI Java D2XX for Android driver the development machine needs the Eclipse IDE and an up to date Android SDK including the ADB program and the ADT plug in for Eclipse Installation and configuration of these tools is not described in this document but is outlined on the Android developer web site Please see http developer a
5. Devices International Ltd Unit 1 2 Seaward Place Centurion Business Park Glasgow G41 1HH United Kingdom Scotland Registered Company Number SC136640 Copyright 2013Future Technology Devices International Limited 17 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 4 Appendix A References http developer android com http code google com p rowboat wiki JellybeanOnBeagleboard WithSGX http beagleboard org hardware xM http www ubuntu com Acronyms and Abbreviations Bem emm T hee mmemasie C z fot ner saarra enar OOOO Universal Serial Bus Copyright 2013Future Technology Devices International Limited 18 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 5 Appendix B List of Tables amp Figures List of Figures Figure 1 Android Development Configuration eseeeeseese nenne nennen nna annua 2 Figure 2 Select Project Properties ccccsceeesceeeeeeeeeeeeueeeeuaeeeuaeeauaeeauaseouaeeauanenuags 3 Figure 3 Select Java Build Path Libraries Add JARs eeeeeeeeenne nnn 4 Figure 4 Select the library file d2xx jar ssssssss s2 5 5 4 Figure 5 Demo Application Screenshot Information eere 6 Figure 6 Demo Application Screenshot Status
6. Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 In this demo these APIs are used FT Device cirDtr FT Device cirRts FT_Device getEventStatus FT_Device getQueueStatus FT Device read 1 FT_Device setDtr FT_Device setEventNotification FT_Device setRts FT_Device write 2 Note 1 read without length parameter 2 write without length parameter Copyright 2013Future Technology Devices International Limited 10 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 2 2 5 OpenDevice II FTDI D2xx Demo Information Open Device l Open By Index Status Open By Serial Number PIDVID Open By Location Misc Open By Description Open Device with Setting Parameter UART Get Parameter Buf ferNumber FileTransfer BufferSize ao TransferSize EEPROM eer ives ReadTimeout 1 C Open By Index Open By Serial Number Open By Location Open By Description Open By UsbDevice Open By UsbDevice Open By UsbDevice with Parameter Reset Figure 9 Demo Application Screenshot OpenDevice This demo application shows different ways to open the device Select Open Device and Open Device with Setting Parameter to test the open related APIs When BufferNumber BufferSize TransferSize or ReadTimeout is not set the device uses the default v
7. FTDI Chip Future Technology Devices International Ltd Technical Note TN_147 Java D2xx for Android Document Reference No FT_000799 Version 1 2 Issue Date 2013 09 16 This document describes the installation and use of the FTDI Java D2XX for Android driver for FTxxxx devices in an Android environment Future Technology Devices International Limited FTDI Unit 1 2 Seaward Place Glasgow G41 1HH United Kingdom Tel 44 0 141 429 2777 Fax 44 0 141 429 2758 E Mail Support supporti ftdichip com Web http www ftdichip com Copyright 2013Future Technology Devices International Limited Use of FTDI devices in life support and or safety applications is entirely at the user s risk and the user agrees to defend indemnify and hold harmless FTDI from any and all damages claims suits or expense resulting from such use y r m m FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 Table of Contents 1 JInHFOUOUcLiODocscxesxi ux uan E RM MEE ED ROTER QR RCR U RC ROR CORO RU RR Ru n 2 1 1 Android SUDDOLFIT ii isssanssusasnusassussuns sRVEsasAsARERRERIN sxFEEGRSsCE KE EEEREPREA RIR 2 1 2 PEFerequisitB6 ssusasssssssup s qus sA RE PESPAnSMRSANSRREFRESEEESSPSNPARNM SE RR RSEISRKaR 2 2 Using the FTDI Java D2xx for Android Library 3 2 1 Introduction and Usage eese essen enne nnn enn nnne 3 2 2 Applica
8. Site URL http www ftdichip com Please visit the Sales Network page of the FTDI Web site for the contact details of our distributor s and sales representative s in your country System and equipment manufacturers and designers are responsible to ensure that their systems and any Future Technology Devices International Ltd FTDI devices incorporated in their systems meet all applicable safety regulatory and system level performance requirements All application related information in this document including application descriptions suggested FTDI devices and other materials is provided for reference only While FTDI has taken care to assure it is accurate this information is subject to customer confirmation and FTDI disclaims all liability for system designs and for any applications assistance provided by FTDI Use of FTDI devices in life support and or safety applications is entirely at the user s risk and the user agrees to defend indemnify and hold harmless FTDI from any and all damages claims suits or expense resulting from such use This document is subject to change without notice No freedom to use patents or other intellectual property rights is implied by the publication of this document Neither the whole nor any part of the information contained in or the product described in this document may be adapted or reproduced in any material or electronic form without the prior written consent of the copyright holder Future Technology
9. This application receives and sends data from and to the PC or the Android device itself if a loop back device is connected Copyright 2013Future Technology Devices International Limited 13 FTDI Chip In this demo these APIs are used Document Reference No FT 000799 TN 147 Java D2xx for Android Technical Note TN 134Version 1 2 FT Device close FT Device isOpen FT Device purge FT Device read 1 FT Device restartInTask FT Device setBaudRate FT Device setDataCharacteristics FT Device setFlowControl FT Device setLatencyTimer FT Device stopInTask FT Device write 2 Note 1 read with length parameter 2 write with length parameter 2 2 7 FileTransfer EnEOE 5 FTDI D2xx Demo Information Status PIDVID Misc OpenDevice UART EEPROM EEPROM UserArea Status Figure 11 Demo Application Screenshot FileTransfer This demo application displays the functionality of UART but it could receive or send a file It also opens the device of index 0 the UART configuration is the same as UART demo introduced in previous section Copyright 2013Future Technology Devices International Limited 14 FEE EEN FTDI Document Reference No FT_000799 SERRE H TN 147 Java D2xx for Android O Chip Technical Note TN_134Version 1 2 To use this application please follow the steps below Step 1 Setup the connection between device and PC Step 2 Con
10. alue to open the device Get Parameter gets current parameters Copyright 2013Future Technology Devices International Limited 11 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 About Open By USBDevice when Android detects an USB device is plugged in it will send out a broadcast containing a UsbDevice object corresponding to the just attached device to notify interested party when this application receive the notification it will automatically call openByUsbDevice to open the just attached device with the UsbDevice object provided by that notification Use Reset to clear the memory after the demo In this demo these APIs are used D2xxManager getDeviceInfoListDetail D2xxManager isFtDevice D2xxManager openByDescription D2xxManager openByDescription D2xxManager openByIndex D2xxManager openByIndex D2xxManager openByLocation D2xxManager openByLocation D2xxManager openBySerialNumber D2xxManager openBySerialNumber D2xxManager openByUsbDevice D2xxManager openByUsbDevice D2xxManager DriverParameters _ getBufferNumber D2xxManager DriverParameters _ getMaxBufferSize D2xxManager DriverParameters _ getMaxTransferSize D2xxManager DriverParameters getReadTimeout FT_Device resetDevice D2xxManager DriverParameters _ setBufferNumber D2xxManager DriverParameters setMaxBufferSize D2xxManag
11. er DriverParameters _ setMaxTransferSize D2xxManager DriverParameters setReadTimeout Note this function open device with D2xxManager DriverParameters parameter Copyright 2013Future Technology Devices International Limited 12 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 2 2 6 UART MA FTDI D2xx Demo Information Status PIDVID Misc OpenDevice Read Bytes FileTransfer EEPROM Write Bytes EEPROM UserArea ay zal Figure 10 Demo Application Screenshot UART This demo application displays the functionality of UART The first row contains an Open button to open selected Port numbers and a Config button to set UART configuration with several selectable setting items The UART configuration settings allow the baud rate to be set at standard values between 300 and 921600 baud Stop bits may be set for 1 or 2 Data bits may be set for 7 or 8 Parity may be set for ODD EVEN Mark Space None Flow allows for no flow control RTS CTS DTR DSR and XOFF XON flow control The Read Bytes box displays the received data as ASCII values The Read Enabled button is used to test stop restart IN task APIs Read Enabled will switch to Read Disabled when tapped causing the application to stop receiving data Tap it again to enable the receive functionality Write Bytes allows a user to type in plain text and send it by tapping Write
12. figure desired UART parameters Step 3 Tap the Start Getting Data button on the Android then use a PC terminal to emulate sending a text file to the Android in raw mode i e send all text data as it is without extra encoding by X Y Z modem protocol Step 4 After the file is sent tap Start Getting Data again to stop receiving the file Step 5 Now on the PC terminal prepare to receive a text file from Android Step 6 Tap the Send Saved File button on the Android The data stored during Steps 3 4 will now be received by the PC Step 7 Now compare whether the sent and received files are the same The Status area will show some information during the get data and send file process 2 2 8 EEPROM N 3 B FTDI D2xx Demo Information Read EEPROM Write EEPROM Erase EEPROM Status PIDVID Misc OpenDevice UART FileTransfer EEPROM EEPROM UserArea Figure 12 Demo Application Screenshot EEPROM FT Prog FT Prog http www ftdichip com Support Utilities htmzFT Prog This demo application contains Read EEPROM Write EEPROM and Erase EEPROM buttons Tap Read EEPROM to get and parse some data of the connected device Click Write EEPROM to write data back to EEPROM This demo is limited to modifying the content of Product Description Serial Number and Data 3A Data 3D Erase EEPROM erases the entire EEPROM Copyright 2013Future Technology Devices International Limited 15 2 m FTDI YE Chip In this dem
13. l of the demo APIs Copyright 2013Future Technology Devices International Limited 5 mm FTDI Document Reference No FT 000799 PEPER H TN 147 Java D2xx for Android U Chip Technical Note TN_134Version 1 2 2 2 Application Examples 2 2 1 Information N FTDI D2xx Demo Information Shea Number of devices 0 PIDVID Device Name No device 7 Device Serial Number Misc i Device Description OpenDevice Device ID UART Device Location FileTransfer Library Version EEPROM Refresh EEPROM UserArea Figure 5 Demo Application Screenshot Information This demo application contains a Refresh button Tap Refresh to access information about the connected device In this demo these APIs are used Class API Name D2xxManager createDeviceInfoList D2xxManager getDeviceInfoList D2xxManager getLibraryVersion Note In later demo applications duplicated APIs are not listed again Copyright 2013Future Technology Devices International Limited 6 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 2 2 2 Status g FTDI D2xx Demo Information Start API Test ModemStatus LineStatus E LatencyTimer Misc Description Set RESET Bi tMode set ASYNC BITBANG Bi tMode UART Set MPSSE Bi tMode Set SYNC BITBANG Bi tMode Set MCU HOST Bi tMode set FAST SERIAL Bi tMode Set CBUS BITBANG Bi tMode Set SYNC FIFO Bi tMode
14. ndroid com sdk index html Also the Android device should have USB Debugging enabled to allow access using the ADB utility To accomplish this navigate to Settings Applications Development and select the USB debugging option A summary of the required configuration is provided in the diagram below Development Machine Android Device Eclipse IDE with ADT Plugin ADB USB Host Capability Connection Android SDK over USB USB Debugging Enabled Android ADB Utility Wi Fi LAN Enabled Figure 1 Android Development Configuration Copyright 2013Future Technology Devices International Limited 2 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 2 Using the FTDI Java D2xx for Android Library 2 1 Introduction and Usage To support versatile tablet usage scenarios Google has included a USB Host API in Android since version 3 1 Before version 3 1 an Android application could not access USB devices attached to a system naturally without root access rights The Android USB Host API removes this limitation allowing us to utilize the USB gadgets attached to Android Host or OTG port FTDI provides a Java class library that adapts to applications so the developer can focus on the desired input and output data The design goal of the class library is to provide access to all the D2XX functions including EEPROM functions The D2xx library can be included in an Android ap
15. o these APIs are used Document Reference No FT 000799 TN 147 Java D2xx for Android Technical Note TN 134Version 1 2 Class API Name FT Device eepromErase FT Device eepromRead FT Device eepromReadWord FT Device eepromWrite FT Device eepromWriteWord 2 2 9 EEPROM UserArea En s IW FTDI D2xx Demo Information Status PIDVID Misc OpenDevice UART FileTransfer EEPROM EEPROM UserArea Read EEPROM Write EEPROM Erase EEPROM User Area Size Figure 13 Demo Application Screenshot EEPROM UserArea This demo application accesses the EEPROM user area Click Read EEPROM to get User Area Size and list the contents of user area Write EEPROM writes fixed data 0 1 2 3 4 etc to the entire user area Erase EEPROM writes fixed data 0 to the entire user area NOTE Please remember to backup EEPROM data using FT Prog before writing or erasing In this demo these APIs are used Class API Name FT Device eepromGetUserAreaSize FT Device eepromReadUserArea FT Device eepromWriteUserArea Copyright 2013Future Technology Devices International Limited 16 FTDI Chip 3 Contact Information Head Office Glasgow UK Future Technology Devices International Limited Unit 1 2 Seaward Place Centurion Business Park Glasgow G411HH United Kingdom Tel 44 0 141 429 2777 Fax 44 0 141 429 2758 E mail Sales E mail Support
16. plication project in Eclipse easily First copy the library file d2xx jar to the folder of the project and add it in Project Properties Refer to Figure 2 Figure 4 which show how to add the library file from the Mibs sub folder of the project folder ee 55m cam Java Eclipse e File Edit Refactor Run Source Navigate Search rese window Help trae oe Aau digr Open Project P T GOO S Quick Access m Close Project I Package Explorer 22 EX E E Task List 23 3 d Build Al RFE juild All Ctrl B eg Build P g IBSIveIX amp uild Project E FragmentLayout 2 v Fe ESSE Build Working Set Clean Connect Mylyn v Build Automatical Be Outline 3 Generate Javadoc An outline is not available fi Problems 23 m 0 items Description z Resource Path 4 n 4 m FragmentLayout Figure 2 Select Project Properties Copyright 2013Future Technology Devices International Limited 3 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 Properties for agment ayout type filter text Java Build Path p Resource Android Android Lint Preferences Builders gt BA Android 4 1 2 Java Build Path b Java Code Style b Java Compiler gt Java Editor Javadoc Location Project References Refactoring History Run Debug Settings Task Repository Task Tags Valida
17. salesi ftdichip com supporti ftdichip com E mail General Enquiries admini ftdichip com Web Site URL http www ftdichip com Web Shop URL http www ftdichip com Branch Office Taipei Taiwan Future Technology Devices International Limited Taiwan 2F No 516 Sec 1 NeiHu Road Taipei 114 Taiwan R O C Tel 886 0 2 8797 1330 Fax 886 0 2 8751 9737 E mail Sales E mail Support tw sales1 ftdichip com tw support1 ftdichip com E mail General Enquiries tw admini ftdichip com Web Site URL http www ftdichip com Distributor and Sales Representatives Document Reference No FT_000799 TN 147 Java D2xx for Android Technical Note TN_134Version 1 2 Branch Office Tigard Oregon USA Future Technology Devices International Limited USA 7130 SW Fir Loop Tigard OR 97223 8160 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 Branch Office Shanghai China Future Technology Devices International Limited China Room 1103 No 666 West Huaihai Road Shanghai 200052 China Tel 86 2162351596 Fax 86 2162351595 E mail Sales E mail Support cn sales ftdichip com cn support ftdichip com E mail General Enquiries cn admin ftdichip com Web
18. tion Examples 2 5223 sasua uisa aaBa n Cueskuaw wa vue eussauas in saa xR Rv waRE 6 2 2 1 ligera 6 2 2 2 f EET 7 2 2 3 PIDVID ne oenar a n a e a a a a a a aea aia 8 2 2 4 MiS Gaessen nnr ia E OE nied E EE E iaa 9 2 2 5 ODPENDGVICE seirinisisiri din ornin i FUR creatinine cain NFEMEURUNIFEURENFENEURUNF FLUTE 11 2226 VART ee eE E E EE 13 2 2 7 FileTransSfer siringa a a A E A 14 22 8 EEPROM pasne E a A 15 2 2 9 EEPROM U SGFAT6Gd erriaren trinna ANERER 16 3 Contact Information eene eonun nasisnss LZ 4 Appendix A References e eere 18 Acronyms and Abbreviations i a sans sussaREESESERR SR ESSESE EEEMIESEREEENN ERN EE 18 5 Appendix B List of Tables amp Figures LO 6 Appendix C Revision History es 20 Copyright 2013Future Technology Devices International Limited 1 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 1 Introduction FTDI provides a proprietary D2XX interface for easy communication with FTxxxx devices The D2XX API is common across several operating systems supported by FTDI namely Windows Windows CE Linux Mac OS X and Android 1 1 Android Support To support the Google Android OS FTDI has two D2XX solutions for different application scenarios 1 A Java class using the JNI Java Native Interface to access the
19. tion WikiT ext Migrate JAR File Choose the archives to be added to the build path type filter text 4 E FragmentLayout gt E settings gt amp svn gt amp bin gt amp doc gt amp gen 4 amp libs i d2xx jar gt amp res gt src X classpath Figure 4 Select the library file d2xx jar Copyright 2013Future Technology Devices International Limited 4 FTDI Document Reference No FT 000799 TN 147 Java D2xx for Android Chip Technical Note TN 134Version 1 2 The D2xxManager class allows access to driver wide information such as the VID and PID combinations to match with the device information list and provides APIs to open target devices returning corresponding FT Device objects The FT Device object can perform UART EEPROM and Bit mode related operations to control device status or read write data When the device is no longer required the FT Device object can be closed with the close method The D2xx Java library is fully documented using Javadoc For information on the D2xx Android library methods constants and sub classes please consult the corresponding Javadoc entry in the sample project s doc directory A sample application demonstrating how to use various methods in the D2xx Java library is shown in section 2 2 Application Examples Please refer to AN 233 Java D2xx for Android API User Manual for the detai

Download Pdf Manuals

image

Related Search

Related Contents

DSB310-110 Fanless Digital Signage Player User`s Manual  Bedienungsanleitung Operation Manual Notice d'utilisation  OpenStage 60T - Global Concept Telecom  Longshine LCS-C842SC network media converter  ダウンロード - プラネックスコミュニケーションズ  ワンケーブル変換モジュール TESCOM JAPAN CO., LTD  シリーズ - Yokogawa Partner Portal  日本語スタイルガイド  Poutry vaccinator PID-P    

Copyright © All rights reserved.
Failed to retrieve file