0
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心
发布
  • 发文章

  • 发资料

  • 发帖

  • 提问

  • 发视频

创作活动
DM240415

DM240415

  • 厂商:

    ACTEL(微芯科技)

  • 封装:

    -

  • 描述:

    ACCESSORY DEVELOPMENT START KIT

  • 数据手册
  • 价格&库存
DM240415 数据手册
Microchip's Accessory Framework for Android(tm) Microchip Technology Inc. Copyright (c) 2011. All rights reserved. Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions. Microchip's Accessory Framework for Android(tm) iii Table of Contents Introduction 1 SW License Agreement 2 Release Notes 10 Terms and Definitions 10 Supported Demo Boards 10 Requirements, Limitations, and Potential Issues 11 Getting the Source Code 11 What's Next? 11 Using the Library 12 Library Architecture 12 How the Library Works 12 Configuring the Library 12 Required USB callbacks 12 HardwareProfile.h 14 usb_config.h 14 usb_config.c 15 Initialization 16 Keeping the Stack Running 17 Detecting a Connection/Disconnection to an Android Device 17 Sending Data 18 Receiving Data 19 Firmware API API Functions 21 21 AndroidAppIsReadComplete Function 21 AndroidAppIsWriteComplete Function 22 AndroidAppRead Function 23 AndroidAppStart Function 24 AndroidAppWrite Function 25 AndroidTasks Function 25 Error Codes 26 iii Microchip's Accessory Framework for Android(tm) USB_ERROR_BUFFER_TOO_SMALL Macro Configuration Definitions NUM_ANDROID_DEVICES_SUPPORTED Macro Configuration Functions iv 26 27 27 27 AndroidAppDataEventHandler Function 27 AndroidAppEventHandler Function 28 AndroidAppInitialize Function 29 Events 30 EVENT_ANDROID_ATTACH Macro 30 EVENT_ANDROID_DETACH Macro 30 Type Definitions ANDROID_ACCESSORY_INFORMATION Structure Running the Demos Creating the Setup New to Microchip Getting the Tools 31 31 33 33 33 33 New to Android 33 Updating the Android OS 34 Nexus S 34 Updating the SDK 35 Eclipse IDE 35 Version v2.3.x 35 Version v3.x 36 Basic Accessory Demo Getting the Android Application 37 37 From source 37 From Android Marketplace 37 Preparing the Hardware 38 Running the demo 38 Creating an Android Accessory Application using the Open 40 Accessory Framework Creating the Project 40 Accessing the Accessory From the Application 42 FAQs, Tips, and Troubleshooting My PIC32 project gets a run time exception. What could be wrong? 43 43 iv Microchip's Accessory Framework for Android(tm) v How do I debug without access to ADB? 43 What if I need design assistance creating my accessory? 44 The firmware stops working when I hit a breakpoint. 44 If I hit the "Home" or "Back" buttons while the accessory is attached, the demo no longer works. 44 Why don't all of the features of the demo work? 45 What if I need more support than what is here? 45 Index a v Microchip's Accessory Framework for Android(tm) 1 1 Introduction Microchip's Accessory Framework for Android for Microchip Microcontrollers The Microchip's Accessory Framework for Android for Android provides a mechanism to transfer data to and from an Android application through the USB of the microcontroller. 1 1 Microchip's Accessory Framework for Android(tm) 2 2 SW License Agreement IMPORTANT: MICROCHIP IS WILLING TO LICENSE THE ACCOMPANYING SOFTWARE AND DOCUMENTATION TO YOU ONLY ON THE CONDITION THAT YOU ACCEPT ALL OF THE FOLLOWING TERMS. TO ACCEPT THE TERMS OF THIS LICENSE, CLICK "I ACCEPT" AND PROCEED WITH THE DOWNLOAD OR INSTALL. IF YOU DO NOT ACCEPT THESE LICENSE TERMS, CLICK "I DO NOT ACCEPT," AND DO NOT DOWNLOAD OR INSTALL THIS SOFTWARE. NON-EXCLUSIVE SOFTWARE LICENSE AGREEMENT FOR ACCOMPANYING MICROCHIP SOFTWARE AND DOCUMENTATION INCLUDING, BUT NOT LIMITED TO: GRAPHICS LIBRARY SOFTWARE, IrDA STACK SOFTWARE, MCHPFSUSB STACK SOFTWARE, MEMORY DISK DRIVE FILE SYSTEM SOFTWARE, mTOUCH™ CAPACITIVE LIBRARY SOFTWARE, PC PROGRAMS, SMART CARD LIBRARY SOFTWARE, TCP/IP STACK SOFTWARE, AND/OR MiWi™ DE SOFTWARE IMPORTANT - READ CAREFULLY. This Nonexclusive Software License Agreement (“Agreement”) is a contract between you, your heirs, successors and assigns (“Licensee”) and Microchip Technology Incorporated, a Delaware corporation, with a principal place of business at 2355 W. Chandler Blvd., Chandler, AZ 85224-6199, and its subsidiary, Microchip Technology (Barbados) Incorporated (collectively, “Microchip”) for the accompanying Microchip software including, but not limited to, Graphics Library Software, IrDA Stack Software, MCHPFSUSB Stack Software, Memory Disk Drive File System Software, mTouch™ Capacitive Library Software, PC programs, Smart Card Library Software, TCP/IP Stack Software, MiWi™ DE Software, and any updates thereto (collectively, the “Software”), and accompanying documentation, including images and any other graphic resources provided by Microchip (“Documentation”). The Software and Documentation are licensed under this Agreement and not sold. U.S. copyright laws, international copyright treaties, and other intellectual property laws and treaties protect the Software and Documentation. Microchip reserves all rights not expressly granted to Licensee in this Agreement. 1. License and Sublicense Grant. (a) Definitions. As used in this Agreement, the following capitalized terms will have the meanings defined below: 2 2 Microchip's Accessory Framework for Android(tm) 3 (i) “Microchip Products” means Microchip microcontrollers, Microchip digital signal controllers, or other Microchip products that use or implement the Software. (ii) “Licensee Products” means Licensee products that use or incorporate Microchip Products. (iii) “Object Code” means the Software computer programming code that is in binary form (including related documentation, if any), and error corrections, improvements, modifications, and updates. (iv) “Source Code” means the Software computer programming code that may be printed out or displayed in human readable form (including related programmer comments and documentation, if any), and error corrections, improvements, modifications, and updates. (v) “Third Party” means Licensee’s agents, representatives, consultants, clients, customers, or contract manufacturers. (vi) “Third Party Products” means Third Party products that use or incorporate Microchip Products. (b) Software License Grant. Microchip grants strictly to Licensee a non-exclusive, non-transferable, worldwide license to use the Software, as described below: (i) Graphics Library Software, MCHPFSUSB Stack Software, Memory Disk Drive File System Software, mTouch™ Capacitive Library Software, Smart Card Library, TCP/IP Stack Software, and other accompanying Microchip software not otherwise expressly addressed in Section 1(b)(ii) or Section 1(b)(iii) below: (1) Licensee may use, modify, copy, and distribute the Software identified in the subheading of this Section 1(b)(i) when such Software is embedded in a Microchip Product that is either integrated into Licensee Product or Third Party Product pursuant to Section 1(d) below. (2) Further, with respect to the TCP/IP Stack Software, Licensee may only port the ENC28J60.c, ENC28J60.h, ENCX24J600.c, and ENCX24J600.h driver source files to a non-Microchip device used in conjunction with a Microchip ethernet controller for the sole purpose of interfacing with such ethernet controller. (ii) IrDA Stack Software: (1) Licensee may install the IrDA Stack Software on a single computer and use with Microchip Products; and (2) Use, modify, copy, and distribute the device driver source files of the IrDA Stack Software (“Device Drivers”); provided that (x) such Device Drivers are only used with Microchip Products, and (y) no Open Source Components (defined in Section 2(c) below) are incorporated into such Device Drivers. (iii) PC Programs: (1) Licensee may install, use, modify (if Microchip provides Source Code), copy, and distribute the PC programs on an unlimited number of computers; provided that (x) such PC programs are used with Microchip products, and (y) the following conditions are met when Licensee redistributes any PC programs: “Copyright (c) Microchip Technology Inc. All rights reserved. Microchip PC programs are provided for your use with Microchip products only. Redistributions and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 3 2 Microchip's Accessory Framework for Android(tm) 4 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Microchip nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY MICROCHIP ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.” (iv) MiWi™ DE Software: Licensee may use, modify, copy and distribute the Software only when embedded on a Microchip Product and used with either a Microchip radio frequency transceiver or UBEC UZ2400 radio frequency transceiver, which are integrated into Licensee Products or Third Party Products pursuant to Section 1(d) below. For purposes of clarity, Licensee may NOT embed the Software identified in Section 1(b)(i) (including derivatives or modifications thereof) on a non-Microchip Product, except as described in Section 1(b)(i)(2). Licensee may NOT use, copy, modify or distribute the IrDA Stack Software, except as described in Section 1(b)(ii)(2) above (relating to Device Drivers) and Section 1(d) below (relating to sublicenses). Licensee may NOT distribute Source Code or Object Code of the Software on a standalone basis, except as described in Section 1(b)(iii) above (relating to PC programs) and Section 1(d) below (relating to sublicense rights). For the MiWi™ DE Software, Licensee may NOT embed the Software (including derivatives or modifications thereof) on a non-Microchip Product, use the Software with a radio frequency transceiver other than the Microchip and UBEC transceivers listed in Section 1(b)(iv), or distribute the Software (in Source Code or Object Code) except as described in Section 1(d) below. (c) Documentation License Grant. Microchip grants strictly to Licensee a non-exclusive, non-transferable, worldwide license to use the Documentation in support of Licensee's authorized use of the Software. 2 (d) Sublicense Grants. Licensee may grant a sublicense to a Third Party to use the Software as described in this subparagraph (d) provided that Licensee first obtains such Third Party’s agreement in writing to comply with the terms of this Agreement: (i) Graphics Library Software, MCHPFSUSB Stack Software, Memory Disk Drive File System Software, mTouch™ Capacitive Library Software, Smart Card Library, TCP/IP Stack Software, MiWi™ DE Software, and other accompanying Microchip software not otherwise expressly addressed in Section 1(b)(iii) above or Section 1(d)(ii) below: With respect to Software identified in this Section 1(d)(i), Third Party may: (1) Modify Source Code for Licensee. (2) Program Software into Microchip Products for Licensee. (3) Use the Software to develop and/or manufacture Licensee Products. 4 Microchip's Accessory Framework for Android(tm) 5 (4) Use the Software to develop and/or manufacture Third Party Products where either: (x) the sublicensed Software contains Source Code modified or otherwise optimized by Licensee for integration into Third Party Products; and/or (y) the sublicensed Software is programmed into Microchip Products by Licensee on behalf of such Third Party. (5) Use the Documentation in support of Third Party's authorized use of the Software in conformance with this Section 1(d)(i). (ii) IrDA Stack Software: With respect to IrDA Stack Software, Third Party may: (1) Modify ONLY Device Drivers for Licensee. (2) Program Software into Microchip Products for Licensee. (3) Use the Documentation in support of Third Party's authorized use of the Software in conformance with this Section 1(d)(ii). (e) Audit. Microchip’s authorized representatives will have the right to reasonably inspect, announced or unannounced, and its sole and absolute discretion, Licensee's premises and to audit Licensee's records and inventory of Licensee Products, whether located on Licensee's premises or elsewhere at any time, in order to ensure Licensee's adherence to the terms of this Agreement. 2. Third Party Requirements; Open Source Components. Licensee acknowledges that it is Licensee’s responsibility to comply with any third party license terms or requirements applicable to the use of such third party software, specifications, systems, or tools. Microchip is not responsible and will not be held responsible in any manner for Licensee’s failure to comply with such applicable terms or requirements. (a) IrDA Stack Software. With respect to the IrDA Stack Software, Licensee further acknowledges that it is Licensee's responsibility to obtain a copy of, to familiarize itself fully with, and comply with the requirements of the Infrared Data Association, especially regarding the use of IrDA specifications and development of IrDA-compliant products. At the time of this Software release, it is Microchip's understanding that Licensee may obtain a copy of IrDA specifications from the IrDA website by either paying an access fee or becoming a member of the Infrared Data Association. For more information go to www.irda.org. 2 (b) Memory Disk Drive File System Software. With respect to the Memory Disk Drive File Systems Software, Licensee further acknowledges that it is Licensee's responsibility to obtain a copy of, familiarize itself fully with, and comply with the requirements and licensing obligations applicable to the use of flash-based media and FAT files systems available from Compact Flash Association, SD Card Association, Multi Media Card Association, and Microsoft Corporation. (c) Open Source Components. Notwithstanding the license grant in Section 1 above, Licensee further acknowledges that certain components of the Software may be covered by so-called “open source” software licenses (“Open Source Components”). Open Source Components means any software licenses approved as open source licenses by the Open Source Initiative or any substantially similar licenses, including without limitation any license that, as a condition of distribution of the software licensed under such license, requires that the distributor make the software available in source code format. To the extent required by the licenses covering Open Source Components, the terms of such license will apply in lieu of the terms of this Agreement, and Microchip hereby represents and warrants that the licenses granted to such Open Source 5 Microchip's Accessory Framework for Android(tm) 6 Components will be no less broad than the license granted in Section 1. To the extent the terms of the licenses applicable to Open Source Components prohibit any of the restrictions in this Agreement with respect to such Open Source Components, such restrictions will not apply to such Open Source Component. For purposes of clarity: QT Framework Version 3: The MCHPFSUSB Stack Software is accompanied by a PC program, the “USB Device – LibUSB – Generic Driver Demo – Linux Application” or “LibUSB Linux example,” that is developed by Microchip using the Qt framework version 3. Such Qt framework version 3 is governed by the GNU General Public License version 2 (“GPL”). Accordingly, Microchip offers the LibUSB Linux example, including Source Code for such program, under the terms of GPL version 2 as well. For copies of the GPL version 2, please go to http://www.fsf.org. QT Framework Version 4.7.0: The MCHPFSUSB Stack Software is accompanied by a PC program, the “USB Device – HID – Custom Demos – Generic HID PnP Demo – Cross Platform” or “Custom HID Cross Platform example,” that is developed by Microchip using the Qt framework version 4.7.0. Such Qt framework version 4.7.0 is governed by the GNU Lesser General Public License version 2.1 (“LGPL”). For copies of the LGPL version 2.1, please go to http://www.fsf.org. The Custom HID Cross Platform example is governed by the terms of this Non-Exclusive Software License Agreement. JPEG Software: Independent JPEG Group’s software and accompanying third party files including, but not limited to, GIF compressed format files are governed by the terms described in IJG’s license. This license is posted in the “IJG License.pdf” file located at: \Microchip\Image Decoders. (d) Google Static Maps API: Google Static Maps API and Google server usage are governed by the legal notices, terms and conditions posted on the Google website at www.google.com, including but not limited to the Static Maps API Developer Guide, the Legal Notices for Google Maps/Google Earth and Google Maps/Google Earth API, the Google Maps/Google Earth Terms of Service, and the Google Maps/Google Earth API Terms of Service. 3. Licensee Obligations. (a) Licensee will ensure Third Party compliance with the terms of this Agreement, and will be liable for any breach of this Agreement committed by such Third Party. (b) Licensee will not: (i) engage in unauthorized use, modification, disclosure or distribution of Software or Documentation, or its derivatives; (ii) use all or any portion of the Software, Documentation, or its derivatives except in conjunction with Microchip Products or Third Party Products; or (iii) reverse engineer (by disassembly, decompilation or otherwise) Software or any portion thereof. (c) Licensee may not remove or alter any Microchip copyright or other proprietary rights notice posted in any portion of the Software or Documentation. (d) Licensee will defend, indemnify and hold Microchip and its subsidiaries harmless from and against any and all claims, costs, damages, expenses (including reasonable attorney's fees), liabilities, and losses, including without limitation product liability claims, directly or indirectly arising from or related to: (i) the use, modification, disclosure or distribution of the Software, Documentation, or any intellectual property rights related thereto; (ii) the use, sale and distribution of Licensee Products or Third Party Products; and (iii) breach of of this Agreement. THIS SECTION 3(d) STATES THE SOLE AND 6 2 Microchip's Accessory Framework for Android(tm) 7 EXCLUSIVE LIABILITY OF THE PARTIES FOR INTELLECTUAL PROPERTY INFRINGEMENT. 4. Confidentiality. (a) Licensee agrees that the Software (including but not limited to the Source Code, Object Code and library files) and its derivatives, Documentation and underlying inventions, algorithms, know-how and ideas relating to the Software and the Documentation are proprietary information belonging to Microchip and its licensors (“Proprietary Information”). Except as expressly and unambiguously allowed herein, Licensee will hold in confidence and not use or disclose any Proprietary Information and will similarly bind its employees and Third Party(ies) in writing. Proprietary Information will not include information that: (i) is in or enters the public domain without breach of this Agreement and through no fault of the receiving party; (ii) the receiving party was legally in possession of prior to receiving it; (iii) the receiving party can demonstrate was developed by the receiving party independently and without use of or reference to the disclosing party's Proprietary Information; or (iv) the receiving party receives from a third party without restriction on disclosure. If Licensee is required to disclose Proprietary Information by law, court order, or government agency, such disclosure will not be deemed a breach of this Agreement provided that Licensee: (x) gives Microchip prompt notice of such requirement in order to allow Microchip to object or limit such disclosure; (y) cooperates with Microchip to protect Proprietary Information; and (z) Licensee complies with any protective order in place and discloses only the information required by process of law. (b) Licensee agrees that the provisions of this Agreement regarding unauthorized use and nondisclosure of the Software, Documentation and related Proprietary Rights are necessary to protect the legitimate business interests of Microchip and its licensors and that monetary damages alone cannot adequately compensate Microchip or its licensors if such provisions are violated. Licensee, therefore, agrees that if Microchip alleges that Licensee or Third Party has breached or violated such provision then Microchip will have the right to petition for injunctive relief, without the requirement for the posting of a bond, in addition to all other remedies at law or in equity. 5. Ownership of Proprietary Rights. (a) Microchip and its licensors retain all right, title and interest in and to the Software and Documentation (“Proprietary Rights”) including, but not limited to: (i) patent, copyright, trade secret and other intellectual property rights in the Software, Documentation, and underlying technology; (ii) the Software as implemented in any device or system, including all hardware and software implementations of the Software technology (expressly excluding Licensee and Third Party code developed and used in conformance with this Agreement solely to interface with the Software and Licensee Products and/or Third Party Products); and (iii) all copies and derivative works thereof (by whomever produced). Further, copies and derivative works will be considered works made for hire with ownership vesting in Microchip on creation. To the extent such modifications and derivatives do not qualify as a “work for hire,” Licensee hereby irrevocably transfers, assigns and conveys the exclusive copyright thereof to Microchip, free and clear of any and all liens, claims or other encumbrances, to the fullest extent permitted by law. Licensee and Third Party use of such modifications and derivatives is limited to the license rights described in Sections 1 and 2 above. (b) Licensee will have no right to sell, assign or otherwise transfer all or any portion of the Software, Documentation, or any related intellectual property rights except as expressly set forth in this Agreement. 6. Termination of Agreement. Without prejudice to any other rights, this Agreement terminates immediately, without notice by Microchip, upon a failure by Licensee or Third Party to comply with any provision of this Agreement. Further, Microchip may also terminate this Agreement upon reasonable belief that Licensee or Third Party failed to comply with this Agreement. Upon termination, Licensee and Third Party will immediately stop using the Software, Documentation, and derivatives thereof, and immediately destroy all such copies. 7 2 Microchip's Accessory Framework for Android(tm) 8 7. Warranties and Disclaimers. THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. MICROCHIP AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR THE ACCURACY, RELIABILITY OR APPLICATION OF THE SOFTWARE OR DOCUMENTATION. MICROCHIP AND ITS LICENSORS DO NOT WARRANT THAT THE SOFTWARE WILL MEET REQUIREMENTS OF LICENSEE OR THIRD PARTY, BE UNINTERRUPTED OR ERROR-FREE. MICROCHIP AND ITS LICENSORS HAVE NO OBLIGATION TO CORRECT ANY DEFECTS IN THE SOFTWARE. LICENSEE AND THIRD PARTY ASSUME THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE AND DOCUMENTATION PROVIDED UNDER THIS AGREEMENT. 8. Limited Liability. IN NO EVENT WILL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL OR EQUITABLE THEORY FOR ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. The aggregate and cumulative liability of Microchip and its licensors for damages hereunder will in no event exceed $1000 or the amount Licensee paid Microchip for the Software and Documentation, whichever is greater. Licensee acknowledges that the foregoing limitations are reasonable and an essential part of this Agreement. 9. General. (a) Governing Law, Venue and Waiver of Trial by Jury. THIS AGREEMENT WILL BE GOVERNED BY AND CONSTRUED UNDER THE LAWS OF THE STATE OF ARIZONA AND THE UNITED STATES WITHOUT REGARD TO CONFLICTS OF LAWS PROVISIONS. Licensee agrees that any disputes arising out of or related to this Agreement, Software or Documentation will be brought in the courts of the State of Arizona. The parties agree to waive their rights to a jury trial in actions relating to this Agreement. (b) Attorneys' Fees. If either the Microchip or Licensee employs attorneys to enforce any rights arising out of or relating to this Agreement, the prevailing party will be entitled to recover its reasonable attorneys' fees, costs and other expenses. (c) Entire Agreement. This Agreement will constitute the entire agreement between the parties with respect to the subject matter hereof. It will not be modified except by a written agreement signed by an authorized representative of the Microchip. (d) Severability. If any provision of this Agreement will be held by a court of competent jurisdiction to be illegal, invalid or unenforceable, that provision will be limited or eliminated to the minimum extent necessary so that this Agreement will otherwise remain in full force and effect and enforceable. (e) Waiver. No waiver of any breach of any provision of this Agreement will constitute a waiver of any prior, concurrent or subsequent breach of the same or any other provisions hereof, and no waiver will be effective unless made in writing and signed by an authorized representative of the waiving party. (f) Export Regulation. Licensee agrees to comply with all export laws and restrictions and regulations of the Department of Commerce or other United States or foreign agency or authority. (g) Survival. The indemnities, obligations of confidentiality, and limitations on liability described herein, and any right of action 8 2 Microchip's Accessory Framework for Android(tm) 9 for breach of this Agreement prior to termination, will survive any termination of this Agreement. (h) Assignment. Neither this Agreement nor any rights, licenses or obligations hereunder, may be assigned by Licensee without the prior written approval of Microchip except pursuant to a merger, sale of all assets of Licensee or other corporate reorganization, provided that assignee agrees in writing to be bound by the Agreement. (i) Restricted Rights. Use, duplication or disclosure by the United States Government is subject to restrictions set forth in subparagraphs (a) through (d) of the Commercial Computer-Restricted Rights clause of FAR 52.227-19 when applicable, or in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013, and in similar clauses in the NASA FAR Supplement. Contractor/manufacturer is Microchip Technology Inc., 2355 W. Chandler Blvd., Chandler, AZ 85225-6199. If Licensee has any questions about this Agreement, please write to Microchip Technology Inc., 2355 W. Chandler Blvd., Chandler, AZ 85224-6199 USA. ATTN: Marketing. Copyright © 2010 Microchip Technology Inc. All rights reserved. License Rev. No. 02-020111 2 9 Microchip's Accessory Framework for Android(tm) 10 3 Release Notes Microchip's Accessory Framework for Android Version 1.0.0, May 20, 2011 Peripherals Type/Use Specific/Configurable Polled/Interrupt Limitations ( see page 11) USB module in host mode USB1 module Interrupt None 3.1 Terms and Definitions This section defines some of the terms used in this document. Open Accessory API or Open Accessory Framework - this is the API/framework in the Android development environment that allows the Android applications to transmit data in and out of the available USB port. This is provided by Google through the Android SDK. Microchip's Accessory Framework for Android - This defines the firmware library and Android application examples provided in this package by Microchip. 3.2 Supported Demo Boards The following demo boards are supported in this release: • Accessory Development Starter Kit for Android (PIC24F Version) (DM240415) • Explorer 16 (DM240001) with USB PICtail+ Board (AC164131) with any of the following Processor Modules: 3 • PIC24FJ256GB110 PIM (MA240014) • PIC24FJ64GB004 PIM (MA240019) • PIC24FJ256GB210 PIM (MA240021) • PIC32MX460F512L PIM (MA320002) • PIC32MX795F512L PIM (MA320003) • PIC24F Starter Kit 1 (DM240011) • PIC32 USB Starter Kit I or II (DM320003-2) • PIC32 Ethernet Starter Kit (DM320004) Since each board has different hardware features, there may be limitations on some of the boards for each of the demos. For example, if the board does not have a potentiometer but the demo uses one, that feature of the demo will not work. 10 Microchip's Accessory Framework for Android(tm) 11 3.3 Requirements, Limitations, and Potential Issues This section describes the limitations and requirements for using the Microchip's Accessory Framework for Android. Requirements: The Microchip's Accessory Framework for Android requires Android versions v2.3.4 or v3.1 or later. The Open Accessory API is not available in OS versions earlier than this. If the target device is using an older version than this, the library will not be able to connect to that device. Please see the Creating the Setup ( see page 33) section for details about how to get the correct tool versions. Please refer to the Creating the Android Application ( see page 40) section for more information about how to select the right tool set when creating a new Android application. Limitations and Potential Issues: 1. The read() function in the Android OS will not throw an IOException when the file stream under it is closed on file streams created from the USB Open Accessory API. This creates issues when applications or services close down and try to free resources. If a read is in progress, then this can result in the ParcelFileDescriptor object being locked until the accessory is detached from the Android device. This is present in version v2.3.4 and v3.1 of the Android OS. 2. The available() function in the Open Accessory API in the Android OS always throws an IOException error. This function is not available for use. 3. This release only shows connecting to an Android device with the Android device as the USB device. Most phones and tablets operate in this mode. A few Android devices at the time of this release are capable of being a USB host as well. Examples for using this mode of operation are not provided in this release. Firmware to talk to these host capable Android devices can be found at www.microchip.com/usb or www.microchip.com/mal. Application example to access accessories running in device mode will follow shortly. The Open Accessory API allows connections in either direction. 3.4 Getting the Source Code If you are working from the pre-compiled version and would like to get the source code version of these projects, please visit www.microchip.com/mal. The source code is provided in that download (version 2011-06-xx or later). 3.5 What's Next? This section describes what Microchip is working on or considering next. This section makes no statement that these items will ever actually be released. Projects on this list may be discontinued indefinitely. 1. Example boot loader for Android Accessories. 2. Examples using the Host mode features of the Open Accessory Framework 11 3 Microchip's Accessory Framework for Android(tm) 12 4 Using the Library 4.1 Library Architecture The Android Accessory driver when in host mode is just a client driver on top on top of the Microchip USB host stack as seen in the below diagram. Users interface through the Android driver API described in this document to access the Android device. 4.2 How the Library Works 4.2.1 Configuring the Library There are two distributions of the Microchip's Accessory Framework for Android. One includes pre-compiled library files and the second includes the source code files. The pre-compiled version can be found at www.microchip.com/android. 4 The source code version can be found at www.microchip.com/mal. Please select the instructions in the following sections that correspond to the version that you are using. 4.2.1.1 Required USB callbacks Microchip's Accessory Framework for Android is currently based off of Microchip's USB host stack. The USB host stack uses a couple of call back functions to allow the user to make key decisions about the stack operation at run time. These functions must be implemented for the library to compile correctly. These two functions are 12 Microchip's Accessory Framework for Android(tm) 13 USB_ApplicationDataEventHandler() and USB_ApplicationEventHandler() for the pre-compiled example. For the source example the function names are configurable through the usb_config.h ( see page 14) file (see the usb_config.h ( see page 14) section for more information). For more detailed information about these functions or the USB library, please refer to www.microchip.com/mal. This download includes the USB host library code as well as more detailed documentation about that library. The data events are consumed by the Android client driver. So the user application data event handler doesn't need to do anything. It needs to be present for the library to link successfully but it can just return FALSE. BOOL USB_ApplicationDataEventHandler( BYTE address, USB_EVENT event, void *data, DWORD size ) { return FALSE; } The regular event handler has a little more work that needs to be done. This handler notifies the user of device attach and detach events. For Android devices this is covered in the Detecting a Connection/Disconnection to an Android Device ( see page 17) section. This function also notifies the user about errors that might occur in the USB subsystem. These can be useful for debugging development issues or logging issue once released in the field. The last important duty that this function provides is determining if the power required by the attached device is available. This is done through the EVENT_VBUS_REQUEST_POWER event. Remember in this event that the amount of power requested through the USB bus is the power required/2, not the power required. Below is full implementation of the USB event handler that will work with a single attached Android device. BOOL USB_ApplicationEventHandler( BYTE address, USB_EVENT event, void *data, DWORD size ) { switch( event ) { case EVENT_VBUS_REQUEST_POWER: // The data pointer points to a byte that represents the amount of power // requested in mA, divided by two. If the device wants too much power, // we reject it. if (((USB_VBUS_POWER_EVENT_DATA*)data)->current settings menu option, select the "Freeze on Halt" tab. Uncheck the "USB" or "U1CNFG" setting in the list. If neither of these items are in the list of peripherals, uncheck the "All other peripherals" option at the bottom of the list. MPLAB X Go under "File->Project Properties". In the project configuration window, select the project configuration that you are using. Under that configuration, select the debugger that is in use. In the resulting debugger menu, select the "Freeze Peripherals" option in the drop down box. Uncheck the "USB" or "U1CNFG" options if you see them. If you don't see these options, uncheck the "All other peripherals" option. 8.5 If I hit the "Home" or "Back" buttons while the accessory is attached, the demo no longer works. If you hit the "Home" or "Back" buttons while the accessory is attached and the demo no longer runs, the code likely tried to close the FileInputStream to release control of the accessory. v2.3.4 and v3.1 of the Android OS have an issue where closing the ParcelFileDescriptor or FileInputStream will not cause an IOException in a read() call on the FileInputStream. This results in the ParcelFileDescriptor being locked until either the accessory detaches or until the read function returns for 44 8 Microchip's Accessory Framework for Android(tm) 45 some other reason. Please see the Requirements, Limitations, and Potential Issues ( see page 11) section for other known issues or limitations. 8.6 Why don't all of the features of the demo work? The demo application on the Android device was written with the assumption that there were 8 LEDs, 4 push buttons, and a potentiometer available on the accessory. Not all of these features are available on the supported hardware platforms. Where these features are not available, these functions do not work. The Explorer 16 board is an even more complex situation. Even though the base board does include these features, some processor modules don't have all of these features routed to the processor. Also on some processor modules the features are routed to the same pin as other features so both can't be used easily in the same demo. 8.7 What if I need more support than what is here? There are several options that you can use to get various kinds of help. • You can try our forums at forum.microchip.com. The answers provided here will be by fellow developers and typically not from Microchip employees. The forum often provides a way to get answers very quickly to questions that might take longer for other support routes to answer. • You can contact your local sales office for support. You can find the local office from www.microchip.com/sales. The local sales team should be able to direct you to a local support team that can help address some issues. • You can submit support requests to our support system at support.microchip.com or search through the existing hot topics. • You can also contact androidsupport@microchip.com for support. 8 45 Microchip's Accessory Framework for Android(tm) Index a Firmware API 21 From Android Marketplace 37 From source 37 A Accessing the Accessory From the Application 42 G ANDROID_ACCESSORY_INFORMATION structure 31 Getting the Android Application 37 AndroidAppDataEventHandler function 27 Getting the Source Code 11 AndroidAppEventHandler function 28 Getting the Tools 33 AndroidAppInitialize function 29 AndroidAppIsReadComplete function 21 AndroidAppIsWriteComplete function 22 AndroidAppRead function 23 AndroidAppStart function 24 H HardwareProfile.h 14 How do I debug without access to ADB? 43 How the Library Works 12 AndroidAppWrite function 25 AndroidTasks function 25 API Functions 21 I If I hit the "Home" or "Back" buttons while the accessory is attached, the demo no longer works. 44 B Initialization 16 Basic Accessory Demo 37 Introduction 1 C K Configuration Definitions 27 Keeping the Stack Running 17 Configuration Functions 27 Configuring the Library 12 L Creating an Android Accessory Application using the Open Accessory Framework 40 Library Architecture 12 Creating the Project 40 Creating the Setup 33 D Detecting a Connection/Disconnection to an Android Device 17 M My PIC32 project gets a run time exception. What could be wrong? 43 N New to Android 33 E Eclipse IDE 35 Error Codes 26 EVENT_ANDROID_ATTACH macro 30 New to Microchip 33 Nexus S 34 NUM_ANDROID_DEVICES_SUPPORTED macro 27 EVENT_ANDROID_DETACH macro 30 P Events 30 Preparing the Hardware 38 F R FAQs, Tips, and Troubleshooting 43 Receiving Data 19 a Microchip's Accessory Framework for Android(tm) b Release Notes 10 Required USB callbacks 12 Requirements, Limitations, and Potential Issues 11 Running the demo 38 Running the Demos 33 S Sending Data 18 Supported Demo Boards 10 SW License Agreement 2 T Terms and Definitions 10 The firmware stops working when I hit a breakpoint. 44 Type Definitions 31 U Updating the Android OS 34 Updating the SDK 35 usb_config.c 15 usb_config.h 14 USB_ERROR_BUFFER_TOO_SMALL macro 26 Using the Library 12 V Version v2.3.x 35 Version v3.x 36 W What if I need design assistance creating my accessory? 44 What if I need more support than what is here? 45 What's Next? 11 Why don't all of the features of the demo work? 45 b
DM240415 价格&库存

很抱歉,暂时无法提供与“DM240415”相匹配的价格&库存,您可以联系我们找货

免费人工找货