Technical Note. TN_134 FTDI Android D2XX Driver



Similar documents
Application Note AN_385. FTDI D3XX Driver Installation Guide

Technical Note. TN_132 Adding FTDI Devices VCP Driver Support to Android

Technical Note. TN_147 Java D2xx for Android

Future Technology Devices International Ltd. FTDI Drivers Installation guide for. Windows 7

Technical Note TN_152. USB 3.0 Compatibility Issues Explained

Application Note. AN_136_Hi-Speed Mini Module EEPROM Disaster Recovery

Application Note AN_243. FT312D USB Host to UART Cable Application

Determining USB Peripheral Device Class

White Paper WP_001. Connecting Peripherals to an Android Platform

Future Technology Devices International Ltd. Application Note AN_234. FTDI Drivers Installation guide for. Windows 8

Technical Note TN_146. Creating Android Images for Application Development

Application Note AN_242

Application Note AN_101. Submitting Modified FTDI Drivers for Windows Hardware Certification

Application Note AN_149. Upgrading a passive DB9 RS232 Interface to an active USB Interface using an FTDI DB9-USB-RS232 Module

Future Technology Devices International Ltd. FTDI Drivers Installation guide for Windows XP

Future Technology Devices International Ltd. USB-Key. Datasheet

Application Note AN_241. FTDI_AOA_HyperTerm_User_Manual

Future Technology Devices International Ltd

Future Technology Devices International Ltd

Future Technology Devices International Ltd. USB NMC-2.5m. USB to USB Null Modem Cable. Datasheet

Future Technology Devices International Ltd. AN232R-02 FTDIChip-ID for the FT232R and FT245R

Future Technology Devices International Ltd. Windows XP Installation Guide

UMFT4222PROG FT4222 Programmer Module

Command Processor for MPSSE and MCU Host Bus Emulation Modes

Future Technology Devices International Ltd. FTDI Drivers Installation guide for. Windows VISTA

Application Note AN_185. Vinculum-II UART to USB HID Class Host Bridge

Simplified Description of USB Device Enumeration

Application Note AN_276. FT800 Audio File Conversion

TTL-232R-PCB. TTL to USB Serial Converter PCB. Datasheet

Application Note AN_299. FT800_FT801_Internal_Clock _Trimming

Future Technology Devices International Ltd. FTDI Drivers Installation guide for Windows XP

Application Note AN_209. AN_209 PDIUSBD12 to FT120 Migration Guide

Future Technology Devices International Ltd. Technical Note TN_101

Technical Note TN_158. What is the Camera Parallel Interface?

FT2232H Mini Module. USB Hi-Speed FT2232H Evaluation Module. Datasheet

Future Technology Devices International Ltd. USB to RS232 UART Serial Converter PCB. Datasheet

FT4232H Mini Module. USB Hi-Speed FT4232H Evaluation Module. Datasheet

Future Technology Devices International Ltd. Windows 2000 Installation Guide

Future Technology Devices International Ltd USB TO RS422 UART SERIAL CONVERTER PCB. Datasheet. Document Reference No.: FT_000119

White Paper WP_003. Android Peripheral Options

FTDI Chip. VM800P Datasheet Embedded Video Engine Plus Module. VM800P Embedded Video Engine Plus Module Datasheet Version 1.0

TTL-232R. TTL to USB Serial Converter Range of Cables. Datasheet

USB Hi-Speed Serial/Hub Module. Datasheet

Future Technology Devices International Ltd

C232HD. USB 2.0 Hi-Speed to UART Cable. Datasheet

VF2F. USB Flash Disk File-to-file Transfer Vinculum Evaluation Kit. Future Technology Devices International Ltd. Preliminary - Subject to Change

Future Technology Devices International Ltd. USB to RS232 Serial Converter Range of Cables. Datasheet

C232HM. USB 2.0 Hi-Speed to MPSSE Cable. Datasheet

Application Note AN_250. Configuring FT313H Driver for Embedded Linux

VDIP1. Vinculum VNC1L Module. Datasheet

Application Note AN_208. FT311D and FT312D Demo_APK_User_GuideFT311D and FT312D Demo_APK_User_Guide

USB-COM422-PLUS1. Datasheet

Application Note AN_254. FT800 Designs With Visual TFT

Technical Note TN_105

USB-COM232-PLUS4. Datasheet

USB-COM422-PLUS2. Datasheet

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

FTDI Ltd DS_US232R-10(R-100/500) USB to RS232 Adapter cable. Data Sheet

Vinco Development Module. Datasheet

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

Future Technology Devices International Ltd. VF2F2. USB Flash Disk File-to-file Transfer Vinculum Evaluation Kit.

Application Note AN_100. Using the FT232R/FT245R with an External Crystal or Oscillator

Intel Integrated Native Developer Experience (INDE): IDE Integration for Android*

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

The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.

Application Note AN_146. USB Hardware Design Guidelines for FTDI ICs

TTL-232R. TTL to USB Serial Converter Range of Cables. Datasheet

Board also Supports MicroBridge

CP2110-EK CP2110 EVALUATION KIT USER S GUIDE. 1. Kit Contents. 2. Relevant Documentation. 3. Software Setup

Fahim Uddin 1. Java SDK

Future Technology Devices International Ltd. Mac OS X Installation Guide

AN220 USB DRIVER CUSTOMIZATION

Example Connection between USB Host and Android

AllJoyn Android Environment Setup Guide

SIM900 Eclipse environment install Application Note_V1.00

Application Note AN_252. FT800 Audio Primer

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

Oracle FLEXCUBE Direct Banking Android Tab Client Installation Guide Release

Qualcomm IR-I 2 C Bridge Demo

Future Technology Devices International Ltd. Windows 98 Installation Guide

NVIDIA Tegra Android Platform Support Pack Getting Started Guide

Hello World. by Elliot Khazon

Software Application Development. D2XX Programmer's Guide

IDE Integration for Android* Part of the Intel Integrated Native Developer Experience (Intel INDE) 1.5.7

AN4156 Application note

IBM TRIRIGA Anywhere Version 10 Release 4. Installing a development environment

What else can you do with Android? Inside Android. Chris Simmonds. Embedded Linux Conference Europe Copyright 2010, 2net Limited.

Running a Program on an AVD

Python for Series 60 Platform

AN220 USB DRIVER CUSTOMIZATION

Getting Started with Android Development

Download and Installation Instructions. Android SDK and Android Development Tools (ADT)

Application Note AN_113. Interfacing FT2232H Hi-Speed Devices To I2C Bus

Android Setup Phase 2

Download and Installation Instructions. Android SDK and Android Development Tools (ADT) Microsoft Windows

How To Develop Android On Your Computer Or Tablet Or Phone

Intel Media SDK Library Distribution and Dispatching Process

Installing the Android SDK

Operating Instructions. Pioneer USB Audio Device Driver

l What is Android? l Getting Started l The Emulator l Hello World l ADB l Text to Speech l Other APIs (camera, bitmap, etc)

Transcription:

Future Technology Devices International Ltd. Technical Note Document Reference No.: FT_000522 Version 1.1 Issue Date: 2012-08-16 This document describes the installation and use of the FTDI D2XX 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): support1@ftdichip.com Web: http://www.ftdichip.com Copyright 2012 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.

Table of Contents 1 Introduction... 2 1.1 Prerequisites... 2 2 Installing the FTDI D2XX JNI Library... 3 3 Using the FTDI D2XX JNI Library... 4 4 Limitations and Restrictions... 6 4.1 Non-Default VID and PID Combinations... 6 4.2 USB Device Permissions... 6 5 Contact Information... 7 6 Appendix A References... 10 Document References... 10 Acronyms and Abbreviations... 10 7 Appendix B List of Tables & Figures... 11 8 Appendix C Revision History... 12 Copyright 2012 Future Technology Devices International Limited 1

1 Introduction FTDI provides the proprietary D2XX interface for communicating with its FTxxxx devices. The D2XX API is common across several operating systems supported by FTDI, namely Windows, Windows CE, Linux and Mac OS X. FTDI has now developed a port of the D2XX driver for the Android OS. This includes the native D2XX library, but in the case of Android also includes Java native interface code and a Java class to allow the driver to be easily accessed from an Android application. The library provided is called libftd2xx-jni.so. This includes the Java native interface code and is statically linked to the D2XX native driver library. At the time of writing, the Android D2XX driver is available as a beta release. Customers are encouraged to provide feedback on the release to FTDI support. The package provided by FTDI includes a compiled native library (libftd2xx-jni.so), a D2XX Java class file (D2xx.java) and a sample application project for Eclipse (D2XX_Sample). The source to the JNI portion of the native library is also available and is statically linked with the native libftd2xx.a library to produce the Java compatible libftd2xx-jni.so file. The driver and associated files can be downloaded from the FTDI website at http://www.ftdichip.com/drivers/d2xx/d2xxsample/d2xxsample.zip 1.1 Prerequisites In order to install the FTDI D2XX driver and use it successfully, the following are required: A hardware platform including a USB host device supported by the Android/Linux kernel. o FTDI testing was conducted using a BeagleBoard-xM Rev C. An FTDI based device for testing with o FTDI testing was conducted with an FT232R based US232R cable. In addition, to develop an application using the FTDI D2XX driver for Android a development machine must have the Eclipse IDE, Android SDK including the ADB program and Android ADT Plugin installed. The installation and configuration of these tools is not within the scope of this document and is outlined on the Android developer web site (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 > Applications > Development and check the USB debugging option. A summary of the required configuration is provided in the diagram below. Development Machine Eclipse IDE with ADT Plugin Android SDK Android ADB Utility ADB Connection over USB Android Device USB Host Capability USB Debugging Enabled Figure 1: Development Configuration Copyright 2012 Future Technology Devices International Limited 2

2 Installing the FTDI D2XX JNI Library The driver library can be installed on the Android device via the Android debugger. Connect the device to the development machine and open a command terminal. If the Android development tools are correctly installed, typing adb devices should result in the Android device being found and its serial number being displayed in a manner similar to this: List of devices attached 20100720 device Accessing the ADB interface may fail for a number of reasons, including device permissions on Linux systems. Troubleshooting the ADB connection is not within the scope of this document. The following ADB command assumes that the library is located in a local directory called D2XX and it is to be installed in the /data/data/com.ftdi.d2xx directory on the Android device: adb push D2XX/libftd2xx-jni.so /data/data/com.ftdi.d2xx/libftd2xx-jni.so Permissions may pose problems when installing the library; libraries are normally located in /system/lib but if root access is not available then this location will not be accessible. The D2XX Java class allows loading of the library from any specified location, so any location on the device is permitted provided that the D2XX Java class is modified to load the library from the correct place. Copyright 2012 Future Technology Devices International Limited 3

3 Using the FTDI D2XX JNI Library To accompany the JNI library, FTDI have provided a Java class which can be easily included in an application. The class provides access to all of the classic D2XX functions including EEPROM functions. The D2xx Java class can readily be included in an Android application project in Eclipse. The D2xx class (not to be confused with the D2XX native API) provides some static methods that allow access to driver-wide information such as the VID and PID combinations to match with and the device information list. All other methods require a D2xx object to be created and subsequently opened using one of the four open methods (openbyindex, openbyserialnumber, openbydescription or openbylocation). Executing an open method will, if successful, cause the instance of the D2xx class to internally maintain a native handle value; this is used for all subsequent communication with the device. When the device is no longer required, the native handle can be closed with the close method. Since the JNI calls ultimately call native D2XX functions, exception generation is included in the JNI layer. An exception of type D2xxException (extended from IOException) is thrown in the case of a native D2XX call returning an FT_STATUS code other than FT_OK. The exception also generates a message indicating the native status code and the native function that the exception occurred in. The D2xx class is fully documented using the Javadoc standard. For information on the D2xx class methods, constants and sub-classes, please consult the Javadoc entry for the item of interest. A sample application demonstrating how to use several of the methods in the D2xx class is also provided to assist with customer application development. The sample application is shown below: Figure 2: D2XXSample Application Copyright 2012 Future Technology Devices International Limited 4

Clicking the Info button in the sample application displays the number of devices available and the chip type of the first device in the device list. Clicking the Data button writes the text from the edit box to the device, waits for 1 second then reads any available data back for displaying below the Data button. In the above screen shot, a loopback connector was fitted so the data received is the same as the data sent. Copyright 2012 Future Technology Devices International Limited 5

4 Limitations and Restrictions 4.1 Non-Default VID and PID Combinations At the time of writing, the Android D2XX driver will support all default FTDI VID and PID combinations and can also support a single custom VID and PID combination via the setvidpid Java method (FT_SetVIDPID function). However, it is currently not possible to match several non-default VID and PID combinations simultaneously. This is due to the Android OS hanging on a call to dlopen which precludes the use of an external libtable library at this time. 4.2 USB Device Permissions Many Android systems with USB host capability enumerate devices with application incompatible permissions (0660). These permissions are specified in the ueventd.rc file as follows: /dev/bus/usb/* 0660 root usb In order to modify the default permissions for USB devices in the ueventd.rc file a user must have root access. This may render the D2XX library unusable on devices that have default permissions of 0660 and do not allow root access. To make the device accessible, the ueventd.rc entry listed above should be changed to make the device world readable and world writeable as follows: /dev/bus/usb/* 0666 root usb NOTE: FTDI does not accept any responsibility for customers who choose to enable root access on their Android platform and subsequently damage the unit or void the warranty. Enabling root access on such devices is entirely at the user s own risk. Copyright 2012 Future Technology Devices International Limited 6

5 Contact Information Head Office Glasgow, UK Future Technology Devices International Limited Unit 1, 2 Seaward Place, Centurion Business Park Glasgow G41 1HH United Kingdom Tel: +44 (0) 141 429 2777 Fax: +44 (0) 141 429 2758 E-mail (Sales) E-mail (Support) E-mail (General Enquiries) Web Site URL Web Shop URL sales1@ftdichip.com support1@ftdichip.com admin1@ftdichip.com http://www.ftdichip.com 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 8791 3570 Fax: +886 (0) 2 8791 3576 E-mail (Sales) E-mail (Support) E-mail (General Enquiries) Web Site URL tw.sales1@ftdichip.com tw.support1@ftdichip.com tw.admin1@ftdichip.com http://www.ftdichip.com Branch Office Hillsboro, Oregon, USA Future Technology Devices International Limited (USA) 7235 NW Evergreen Parkway, Suite 600 Hillsboro, OR 97123-5803 USA Tel: +1 (503) 547 0988 Fax: +1 (503) 547 0987 E-Mail (Sales) E-Mail (Support) E-Mail (General Enquiries) Web Site URL us.sales@ftdichip.com us.support@ftdichip.com us.admin@ftdichip.com http://www.ftdichip.com Branch Office Shanghai, China Future Technology Devices International Limited (China) Room 408, 317 Xianxia Road, Shanghai, 200051 China Tel: +86 21 62351596 Fax: +86 21 62351595 E-mail (Sales) E-mail (Support) E-mail (General Enquiries) Web Site URL cn.sales@ftdichip.com cn.support@ftdichip.com cn.admin@ftdichip.com http://www.ftdichip.com Copyright 2012 Future Technology Devices International Limited 7

Copyright 2012 Future Technology Devices International Limited 8

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 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 2012 Future Technology Devices International Limited 9

6 Appendix A References Document References http://developer.android.com http://beagleboard.org/hardware-xm http://processors.wiki.ti.com/index.php/ti-android-gingerbread-2.3-devkit-1.0_releasenotes http://www.ubuntu.com/ Acronyms and Abbreviations Terms OS USB JNI SDK ADB NDK Description Operating System Universal Serial Bus Java Native Interface Software Development Kit Android Debug Bridge Native Development Kit Copyright 2012 Future Technology Devices International Limited 10

7 Appendix B List of Tables & Figures List of Figures Figure 1: Development Configuration... 2 Figure 2: D2XXSample Application... 4 Copyright 2012 Future Technology Devices International Limited 11

8 Appendix C Revision History Revision Changes Date 1.0 Initial Release for beta test 2011-09-29 1.1 Modifications file path of adb psuh in section 2 2012-08-16 Copyright 2012 Future Technology Devices International Limited 12