Home
AN_357 Android Java D2xx Demo Application for FT4222
Contents
1. Copyright 2015Future Technology Devices International Limited 3 type filter text Resource Android Android Lint Preferences Builders Jawa Compiler Jawa Editor Javadoc Location Project References Refactoring History Run Debug Settings Task Repository Task Tags Validation Wiki T ext Figure 3 Select Java Build Path Libraries Choose the archives to be added to the build path Android Java D2xx Demo Application for FT4222 Version 1 0 Document Reference No FT_001142 Clearance No FTDI 437 JARs and class folders on the build path t Android 4 1 2 Add External Class Folder Edit Remove Migrate JAR File type filter text a W FragmentLayout t E settings b E wn b bin b doc t gen 4 libs E d2xx jar b E res b E src Figure 4 Select the library file d2xx jar x classpath Copyright 2015Future Technology Devices International Limited 7 FTDI Android Java D2xx Demo Application for FT4222 Version 1 0 Chip Document Reference No FT_001142 Clearance No FTDI 437 A 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 th
2. 7 FTDI Chip Future Technology Devices International Ltd AN_357 Android Java D2xx Demo Application for FT4222 Document Reference No FT_001142 Version 1 0 Issue Date 2015 01 21 This document provides the application programming interface API for the Java D2xx for Android library 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 support1 ftdichip com Web http www ftdichip com Copyright 2015 Future 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 D gt aa E FTDI Android Java D2xx Demo Application for FT4222 1 Version 1 0 SN Chip Document Reference No FT_001142 Clearance No FTDI 437 Table of Contents DUPER OCC COIN soes 2 Lit ANGEOIG SUD DOPE viscrccecccsccceccccsessversnssececonessenvcurssnccecerssevencrmrserent 2 12 PROCS QUIS eS i ccietercceen tres Eoria 2 2 Using the FTDI Java D2xx for Android Library sssss00 3 2 1 Introduction and USAGES siidiiivticieritiiniitieietrrrnin 3 3 Demo Application sssss s 6 Sik INIOrMaU N suaccivcssscscentusesinusestedsanietsesseueariautenssinise
3. 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 users to utilize the USB gadgets attached to an Android Host or OTG port FTDI provides a Java class library that adapts to applications so that 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 application project in Eclipse 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 libs sub folder of the project folder Java Eclipse E E Lc 5 File Edit Refactor Run Source Navigate Search Window Help ry 1 i fe TA id Open Project p v Ee E x Quick Access Fy a Java Close Project l Package Explorer 53 E B E Task List 5 _ Build All Ctrl B l aS f BE S x E Build Project Build Working Set gt LS FragmentLayout Connect Mylyn Clean Y Build Automatically 5 Outline 52 AA l Generate Javadoc An outline is not available M 3 Problems 3 z ain 0 items Description Resource Path 4 m 4 m b FragmentLayout Figure 2 Select Project Properties
4. 1 Acronyms and Abbreviations D2xx FTDI s proprietary direct user space driver interface running on top of Android USB Host API OS Operating System USB Universal Serial Bus Board Supporting Package Application Programming Interface On The Go Software Development Kit Android Development Tools Integrated Development Environment Android Debug Bridge SPI Serial Peripheral Interface I C Inter Integrated Circuit GPIO General Purpose Input Output Copyright 2015Future Technology Devices International Limited 13 FTDI Android Java D2xx Demo Application for FT4222 Version 1 0 Chip Document Reference No FT_001142 Clearance No FTDI 437 5 Appendix B List of figures Figure 1 Android Development Configuration sssssss2 2 Figure 2 Select Project Properties s s2ss22222225220252202220220200200002u00u2uununnnnnnnnnnnnn 3 Figure 3 Select Java Build Path Libraries Add JARS ssssssssnnsns2u2222 2 xnm 4 Figure 4 Select the library file d2XX jar ssssnnnnnnunnnnunnnnunnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn 4 Figure 2 Demo Application Screenshot Information ssss2ss222 2 s 2 5 6 FIGUrFE 3 SPI Block Diagrami esrara E ANAA 7 Figure 4 Demo Application Screenshot FT4222 SPI sssssssss 2 7 Foure SIC Block Deh SUN oie aoe cts ede eres ee
5. eects ages ere de erences 9 Figure 6 Demo Application Screenshot FT4222 I7C cccccsceceeeecececueueeueececueueaneneeeeaeaes 9 Figure 7 GPIO Block Diagram ssss2 2 22s222u22200u20u2uuuunuunnnnnnnnnnnnn 11 Figure 8 Demo Application Screenshot FT4222 GPIO sssssss2 11 Copyright 2015Future Technology Devices International Limited 14 v4 FTDI Android Java D2xx Demo Application for FT4222 IN A Version 1 0 Chip Document Reference No FT_001142 Clearance No FTDI 437 gt Appendix C Revision History Document Title Android D2xx API User Manual Document Reference No FT 001142 Clearance No FTDI Drivers Page http www ftdichip com Drivers D2XX htm Document Feedback Send Feedback Revision Changes Date 1 0 Initial Release 2015 01 21 Copyright 2015Future Technology Devices International Limited 15 SN FTDI Android Java D2xx Demo Application for FT4222 Version 1 0 Chip Document Reference No FT_001142 Clearance No FTDI 437 A 7 Contact Information Branch Office Tigard Oregon USA Head Office Glasgow UK 7130 SW Fir Loop Tigard OR 97223 8160 USA Tel 1 503 547 0988 Fax 1 503 547 0987 Future Technology Devices International Limited Unit 1 2 Seaward Place Centurion Business Park Glasgow G411HH United Kingdom Tel 44 0 141 429 2777 E Mail Sales us sales ftdichip com o e E Mail Suppo
6. 1142 Clearance No FTDI 437 IN A gt This demo application contains Config Master Read Master Write Slave Read and Slave Write buttons The first row contains a Config button to set the I C configuration with several selectable setting items The I C configuration settings allow the Frequency to be set for 60K 100K 400K 1M or 3 4MHz Device Address HEX allow the user to input the I C address between 0x00 Ox7F The Config button has to be pressed before sending data From the second row to the last row are the control fields for transmitting and receiving data data exchanging functions are divided into Master Write Master Read Slave Write and Slave Read fields The Master Write field The Write Data is an editable text widget which allows any text data to be entered for transmitting to the I C slave The Transmit Bytes widget is a message box which shows the total number of bytes that the master has successfully transmitted The Master Write is a button widget for triggering the write operation The Slave Write field The Write Data is an editable text widget which allows any text data to be entered for transmitting to the I7C master The Transmit Bytes widget is a message box which shows the total number of bytes that the slave has successfully transmitted The Slave Write is a button widget for triggering the write operation The Master Read field The Number of Bytes widget is an editable text field which s
7. 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 Devices International Ltd Unit 1 2 Seaward Place Centurion Business Park Glasgow G41 1HH United Kingdom Scotland Registered Company Number SC136640 Copyright 2015Future Technology Devices International Limited 16
8. dget is a message box which shows the total number of bytes that the SPI slave actually receive from the SPI master The Slave Read is a button widget for triggering a read operation and data must be transmitted from the Master Write prior to the read operation Copyright 2015Future Technology Devices International Limited 8 aR ON FTDI Android Java D2xx Demo Application for FT4222 Version 1 0 Chip Document Reference No FT_001142 Clearance No FTDI 437 7 4 3 3 I 7C 3 3 1 I7C Hardware The diagram below shows how the FT4222H can be connected to be used with this demo Two FIT4222H devices are set to CNFMODEO and have hardwired I7C master slave pins Then a USB Hub is used for connecting both chips to an Android device More detailed information can be found in USB USB FT4222H 1 C Slave TT Android Device SB OTG Figure 8 I7C Demo System Diagram 3 2 2 I7C Application 2c il amp FTDI J2xx Demo FT4222 Information Frequency Device Address HEX F T4222 SPI Write Data Transmit Bytes Master Write FT4222 GPIO Number of Bytes Read Data Receive Bytes Master Read Write Data Transmit Bytes Slave Write Number of Bytes Read Data Receive Bytes Slave Read D Figure 9 Demo Application Screenshot FT4222 I7C Copyright 2015Future Technology Devices International Limited 9 y FTDI Android Java D2xx Demo Application for FT4222 Version 1 0 Chip Document Reference No FT_00
9. e D2xx Java library is shown in section 3 Demo Application Copyright 2015Future Technology Devices International Limited 5 FTDI Android Java D2xx Demo Application for FT4222 q Version 1 0 TA Chip Document Reference No FT_001142 Clearance No FTDI 437 3 Demo Application 3 1 Information il I FTDI J2xx Demo FT4222 FT4222 SPI Number of devices 0 FT4222 12C Device Name No device Device Serial Number FT4222 GPIO Device Description Device ID Device Location Library Version Refresh Figure 5 Demo Application Screenshot Information This demo application contains a Refresh button Tap Refresh to access information about the connected device Copyright 2015Future Technology Devices International Limited 6 aR ON FTDI Android Java D2xx Demo Application for FT4222 Version 1 0 Chip Document Reference No FT_001142 Clearance No FTDI 437 7 7 3 2 SPI 3 2 1 SPI Hardware The diagram below shows how the FT4222H can be connected for use with this demo Two FT4222H are set to CNFMODEO and have hardwired SPI master slave pins Then a USB Hub is used for connecting both chips to an Android device Please also refer to the for more information vVCCcIO ss USB sk f sck USB eo AdO FT4222H bu d1 SPI Slave Android Device USB OTG Figure 6 SPI Demo System Diagram 3 2 2 SPI Application Il ae FTDI J2xx Demo FT4222 Information Pola
10. er Read Slave Write and Slave Read fields The Master Write field The Write Data is an editable text widget which allows any text data to be transmitted to the SPI slave The Transmit Bytes widget is a message box which shows the total number of bytes that the master has successfully transmitted The Master Write is a button widget for triggering write operation The Slave Write field The Write Data is an editable text widget which allows any text data to be transmitted to the SPI master The Transmit Bytes widget is a message box shows the total number of bytes that the slave has successfully transmitted The Slave Write is a button widget for triggering a write operation The Master Read field The Number of Bytes widget is an editable text field which specifies the total number of bytes that the SPI master is expected to receive The Read Data widget is a message box which shows the content of receiving data The Receive Bytes widget is a message box shows the total number of bytes that the SPI master actually received from the SPI slave The Master Read is a button widget for triggering a read operation and data must transmit from the Slave Write in order to obtain the data The Slave Read field The Number of Bytes widget is an editable text field which specifies the total number of bytes that the SPI slave is expected to receive The Read Data widget is a message box which shows the content of received data The Receive Bytes wi
11. ig Input Figure 11 Demo Application Screenshot FT4222 GPIO Copyright 2015Future Technology Devices International Limited 11 ay FTDI Android Java D2xx Demo Application for FT4222 A Version 1 0 Chip Document Reference No FT_001142 Clearance No FTDI 437 The GPIO demo application provides four configurable GPIO pins and they are listed in four columns Each column has Input Output High and Low fields to control the GPIO s direction and signal level From figure 8 the demo is hardwired with GPIOO to GPIO1 and GPIO2 to GPIO3 Based on the hardware setting GPIOO GPIO1 GPIO2 GPIO3 directions are mutually exclusive In other words changing the GPIOO to the output direction will automatically set GPIO1 to the input direction and vice versa In addition by changing the output port signal level the input port will automatically respond to the signal level change With this functional demonstration GPIOs can be proven to work correctly on triggering bi directional signals Copyright 2015Future Technology Devices International Limited 12 N 7 FTDI Android Java D2xx Demo Application for FT4222 Version 1 0 Chip Document Reference No FT_001142 Clearance No FTDI 437 A 4 Appendix A References http developer Android com index html http www ftdichip com Support Documents DataSheets ICs DS FT4222H pdf http www ftdichip com Support Documents TechnicalNotes TN 147 Java D2xx for Android pdf 4
12. later OS with a USB Host or OTG interface FTDI testing was conducted using a Google Nexus 7 An FTDI chip FT4222H based module to test the FTDI D2xx driver NOTE To develop an application using the FTDI D2xx driver for Android the development machine must have the Eclipse IDE and an up to date version of the Android SDK including the ADB program and Android ADT Plugin installed The installation and configuration of these tools is not included in this document For more information please see http developer Android com sdk index html The Android device should also have USB Debugging enabled to allow access using the ADB utility To accomplish this navigate to Settings gt Applications gt Development and check 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 2015Future Technology Devices International Limited 2 E FTDI Android Java D2xx Demo Application for FT4222 q Version 1 0 A Chip Document Reference No FT_001142 Clearance No FTDI 437 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
13. nteisasentrensiusens 6 32 GPI 7 cic Me lag Cee eee EE 9 34 GPIO 11 4 Appendix A ReferenCeS sssss 13 4 1 Acronyms and AbbreviationS sss s 22222 222 2 2222u222020 2 20 13 5 Appendix B List of figures sssss 14 6 Appendix C Revision HiIStOFY 2 2 15 7 CONntaCE INTOFMAUION wisecenccccesesaeccescctsscnisescenaccaccssacvaswsnan 16 Copyright 2015Future Technology Devices International Limited 1 7 FTDI Android Java D2xx Demo Application for FT4222 Version 1 0 Chip Document Reference No FT_001142 Clearance No FTDI 437 A 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 This document explains how to operate the FT4222H demo APK and the functions of all available UI in the FT4222H demo APK 1 1 Android Support A Java class library supporting a USB Host is available and applicable to Android v3 2 or any later series This library requires no special root access privileges 1 2 Prerequisites The following is required to install the FTDI D2xx driver e An Android device recommended o A BSP supporting the Android USB Host API corresponding to AOSP 3 2 or later o Acontemporary Android device running v3 2 or a
14. pecifies the total number of bytes that the I C master expects to receive The Read Data widget is a message box which shows the content of received data The Receive Bytes widget is a message box which shows the total number of bytes that the IC master actually receives from I7C slave The Master Read is a button widget for triggering a read operation and data must transmit from the Slave Write at the same time in order to obtain the data The Slave Read field The Number of Bytes widget is an editable text field which specifies the total number of bytes that the I C slave expect to receive The Read Data widget is a message box which shows the content of receiving data The Receive Bytes widget is a message box which shows the total number of bytes that the I C slave actually received from the I C master The Slave Read is a button widget for triggering a read operation and data must transmit from the Master Write prior to the read operation Copyright 2015Future Technology Devices International Limited 10 raf FTDI Android Java D2xx Demo Application for FT4222 Version 1 0 LSS Chip Document Reference No FT_001142 Clearance No FTDI 437 3 4 GPIO 3 4 1 GPIO Hardware The diagram below shows how the FT4222H GIPOs can be connected to be used with this demo Figure 10 GPIO Block Diagram 3 4 2 GPIO Application il ae FTDI J2xx Demo FT4222 Information Port Number F T4222 SPI FT4222 2C Output Port Conf
15. rity Phase System Clock Divider Solali eS EPOL 0 CPHA 0 24MHz 1 2 FT4222 120 Write Data Transmit Bytes Master Write FT4222 GPIO Number of Bytes Read Data Receive Bytes UERGER Ge Write Data Transmit Bytes Slave Write Number of Bytes Read Data Receive Bytes Slave Read Figure 7 Demo Application Screenshot FT4222 SPI Copyright 2015Future Technology Devices International Limited 7 y FTDI Android Java D2xx Demo Application for FT4222 Version 1 0 Chip Document Reference No FT_001142 Clearance No FTDI 437 IN A gt This demo application contains Config Master Read Master Write Slave Read and Slave Write buttons The first row contains a Config button to set the SPI configuration with several selectable setting items The SPI configuration settings allow the Polarity Phase to be set for CPOL 0 or 1 CPHA O or 1 System clock may be set to 24 48 60 or 80 Mhz Divider may be set to a value between 1 2 and 1 512 These parameters are used to generate the SPI clock and to sample data for SPI read write functions For instance with an 80 MHz system clock and 1 2 divider the SPI clock will be 40 MHz The polarity and phase are the sampling trigger to read data from the input pin The Config button has to be pressed before sending data From the second row to the last row are the control fields for transmitting and receiving data data exchanging functions are divided into Master Write Mast
16. rt us support ftdichip com E mail Sales ssa Rdichis com E Mail General Enquiries us admin ftdichip com E mail Support ea ee Web Site URL http www ftdichip com E mail General admini ftdichip com Enquiries Branch Office Shanghai China Web Site URL http www ftdichip com Web Shop URL http www ftdichip com No 666 West Huaihai Road Shanghai 200052 China Branch Office Taipei Taiwan Tel 86 2162351596 2F No 516 Sec 1 NeiHu Road PEO EERE One Taipei 114 Taiwan R O C E mail Sales cn sales ftdichip com 1 a n j j j Tel 886 0 2 87913570 E mail Support cn support ftdichip com E mail General o cn admin ftdichip com Enquiries Web Site URL http www ftdichip com Fax 886 0 2 8791 3576 E mail Sales tw sales1 ftdichip com E mail Support tw support1 ftdichip com E mail General tw admin1 ftdichip com Enquiries Web Site URL http www ftdichip com Distributor and Sales Representatives 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
Download Pdf Manuals
Related Search
Related Contents
XBee® Wi-Fi RF Modules ホットカーラー "取扱説明書" EXHIBITOR MANUAL - Exhibitor Online Services manual de usuario detector magnético fjcd621 Copyright © All rights reserved.
Failed to retrieve file