vest dcdk quick start guide - d3ciwvs59ifrt8.cloudfront.net · overview ... an android studio or...
TRANSCRIPT
VEST-DCDK-QSG-001, REV A
Page 1 APC Proprietary Information June 30, 2016
VEST DcDK Quick Start Guide
VEST-DCDK-QSG-001
Copyright © 2016 Advanced Products Corporation Pte Ltd. All rights reserved. No part of this document may be photocopied, reproduced, or translated to another language without the prior written permission of Advanced Products Corporation Pte Ltd. When printed or downloaded from APC managed server/web site this document is considered uncontrolled.
DcDK
VEST-DCDK-QSG-001, REV A
Page 2 APC Proprietary Information June 30, 2016
TABLE OF CONTENTS 1.0 General Information .....................................................................................................................6
Overview ............................................................................................................................................. 6 List Of Acronyms ................................................................................................................................. 6 Reference Documents ........................................................................................................................ 6
2.0 Set up Environment ......................................................................................................................7
Scope .................................................................................................................................................. 7 Set up DcDK in Android Development Environment .......................................................................... 7
Android Studio .......................................................................................................................... 10 Eclipse ....................................................................................................................................... 10
DcDK IO Demo Application ............................................................................................................... 12 Overview ................................................................................................................................... 12 Building DcDK IO Demo Application ......................................................................................... 13 I2C Interface.............................................................................................................................. 13 GPIO Interface .......................................................................................................................... 15 RS232 Interface ......................................................................................................................... 16 SPI Interface .............................................................................................................................. 16 PWM Interface .......................................................................................................................... 17
3.0 Revision History ......................................................................................................................... 18
4.0 Legal Notices .............................................................................................................................. 19
VEST-DCDK-QSG-001, REV A
Page 3 APC Proprietary Information June 30, 2016
LIST OF TABLES
Table 2-1: List of Click Boards supported by DcDK Library ................................................................................. 9 Table 2-2: I2C Click Boards installed on mikroBUS™ Interface Board .............................................................. 14 Table 2-3: GPIO Interface Board installed on mikroBUS™ Interface Board ..................................................... 15 Table 2-4: RS232 Serial Port used in mikroBUS™ Interface Board ................................................................... 16 Table 2-5: SPI Click Boards installed on mikroBUS™ Interface Board .............................................................. 16 Table 2-6: GPIO Interface Board installed on mikroBUS™ Interface Board ..................................................... 17
VEST-DCDK-QSG-001, REV A
Page 4 APC Proprietary Information June 30, 2016
LIST OF FIGURES/DIAGRAMS Figure 2-1: Hardware Setup ............................................................................................................................... 8 Figure 2-2: Add DcDK libraries to Android Studio ............................................................................................ 10 Figure 2-3: Add DcDK libraries to Eclipse 1/3 ................................................................................................... 11 Figure 2-4: Add DcDK libraries to Eclipse 2/3 ................................................................................................... 11 Figure 2-5: Add DcDK libraries to Eclipse 3/3 ................................................................................................... 11 Figure 2-6: DcDK IO Demo Application on bigger LCD screen .......................................................................... 12 Figure 2-7: DcDK IO Demo Application on smaller LCD screen ........................................................................ 12 Figure 2-8: Build and Execute Application in Eclipse ........................................................................................ 13 Figure 2-9: Build and Execute Application in Android Studio .......................................................................... 13 Figure 2-10: IR Thermo ..................................................................................................................................... 15 Figure 2-11: Proximity ...................................................................................................................................... 15 Figure 2-12: Temperature Humidity ................................................................................................................. 15 Figure 2-13: Color ............................................................................................................................................. 15 Figure 2-14: Input ............................................................................................................................................. 16 Figure 2-15: Output .......................................................................................................................................... 16 Figure 2-16: RS232 Serial .................................................................................................................................. 16 Figure 2-17: Set Number .................................................................................................................................. 17 Figure 2-18: PWM ............................................................................................................................................. 17
VEST-DCDK-QSG-001, REV A
Page 6 APC Proprietary Information June 30, 2016
1.0 GENERAL INFORMATION
OVERVIEW For normal Android Java application, it’s hard to directly control hardware peripheral devices such GPIO, I2C, SPI, PWM, etc. VEST DcDK is a software package applied on popular Android operating system that provides an easy and convenient solution for Android Application developer to directly control these hardware devices in Java level. In addition to bus level access, DcDK also provides a Java class allowing convenient device level control of peripherals like ADC, DAC, various sensors, etc.
This document describes steps to quickly set up software application development environment using DcDK Java libraries and use DcDK functions to access hardware on development board.
LIST OF ACRONYMS Acronym Abbreviation
VEST Venture Embedded Solutions Technology
APC Advanced Products Corporation Private Limited
AOSP Android open Source Project
DcDK Device Control Development Kit
ADB Android Debug Bridge
APK Application Package
JNI Java Native Interface
JAR Java Archive
REFERENCE DOCUMENTS VEST-DCDK-USG-001 DcDK Installation Guide Android Application User Guide
VEST-DCDK-USG-002 DcDK Device Driver Development User Guide
VEST-MIB-USG-001 MikroBUS Interface Board Hardware Reference Manual
VEST-DCDK-QSG-001, REV A
Page 7 APC Proprietary Information June 30, 2016
2.0 SET UP ENVIRONMENT
SCOPE This document provides information on how to set up software development environment using DcDK Java libraries for Android Studio and Eclipse. DcDK can be used to control any type of hardware as long as interface is supported. This guide assumes a development environment featuring VEST MikroBUS Interface Board. The board helps demonstrate DcDK features and works well with Demo application provided in software package. To purchase MikroBUS Interface Board, please contact VEST representative ([email protected]) or find more information on www.apc-vest.com.
SET UP DCDK IN ANDROID DEVELOPMENT ENVIRONMENT Before starting development using DcDK, please make sure you have following items
1. Hardware
a. VEST VK series development platform pre-loaded with Android Image and DcDK software components installed. Please contact VEST customer service if you would like to purchase VEST VK series development system.
b. MikroBUS Interface Board equipped with MikroElektronika click boards (http://www.mikroe.com/click/). Please refer to VEST-MIB-USG-001 MikroBUS Interface Board HW Reference Manual for further details.
c. Peripheral device (such as ADC click board) hardware, schematic and data sheet based on your design and hardware selection.
HARDWARE SETUP:
Populate MikroBUS Interface board with necessary click boards and GPIO interface board. Please refer to section ‘2.3 DcDK IO Demo Application’ to identify which boards are required for the demo and their respective slots on the MikroBUS Interface Board.
Connect VK Development Platform with MikroBUS Interface board using 50 pin flex cable.
Connect VK Development Platform to power.
After the setup is complete it should look as shown in ‘Figure 2-1: Hardware Setup’
VEST-DCDK-QSG-001, REV A
Page 8 APC Proprietary Information June 30, 2016
Figure 2-1: Hardware Setup
2. Software Package
a. An Android Studio or Eclipse system for Android Applications and library development. Before setting up the DcDK, please make sure you have installed Android development system/environment such as Android Studio or Eclipse on your host PC. Please refer to Android Developers website from Google (https://developer.android.com/index.html) if you need more information on setting up and installing Android development system/environment.
b. DcDK Bus library jar file and so file, which are needed to setup software development environment using DcDK Java libraries for Android Studio and Eclipse. Please contact VEST customer service if you would like to acquire DcDK license key. In order to use DcDK functions, following library files need to be linked into user’s application development environment:
i. androidjiolib.jar. It is DcDK bus Java library file which provides interfaces and classes to directly access and control Android I/O buses and devices such as I2C, SPI, GPIO, PWM, RS232, etc.
ii. libAndroidJioLib.so. It is JNI library file for androidjiolib.jar.
iii. androidjiodevlib.jar. It is DcDK device library file which provides interfaces and classes to directly access and control Android I/O devices such as ADC, DAC, various sensors, etc. Below is the list of MikroElektronika click board supported by DcDK device library.
No. Part Number Board Name
1 MIKROE-1824 Rotary B Click
2 MIKROE-1864 AlphaNum R click
3 MIKROE-1851 AlphaNum G click
4 MIKROE-1838 EXPAND 2 click
5 MIKROE-1797 HDC1000 click
6 MIKROE-1822 Rotary G Click
7 MIKROE-1687 HTU21D click
8 MIKROE-1677 UV click
GPIO Interface Board
VK Series Development Platform
MikroBUS Interface Board MikroElektronika Click boards
50 pin flex cable
VEST-DCDK-QSG-001, REV A
Page 9 APC Proprietary Information June 30, 2016
9 MIKROE-1589 MOTION click
10 MIKROE-1627 Thumbstick click
11 MIKROE-1578 Hall current click
12 MIKROE-1528 STEPPER click
13 MIKROE-1526 DC MOTOR click
14 MIKROE-1446 CapSense click
15 MIKROE-1506 Joystick click
16 MIKROE-1438 Color click
17 MIKROE-1445 Proximity click
18 MIKROE-1434 RFid click
19 MIKROE-1423 BarGraph click
20 MIKROE-1396 Current click
21 MIKROE-1307 8x8 B click
22 MIKROE-1370 RELAY click
23 MIKROE-1361 IrThermo click 3.3V
24 MIKROE-1294 8x8 Y click
25 MIKROE-1306 8x8 G click
26 MIKROE-1295 8x8 R click
27 MIKROE-1201 7seg click
28 MIKROE-1197 THERMO click
29 MIKROE-951 EXPAND click
30 MIKROE-949 SHT11 click
31 MIKROE-950 DAC Click
32 MIKROE-945 Buzz Click
33 MIKROE-923 DIGI POT click
34 MIKROE-922 ADC click
35 MIKROE-1818 Proximity 2 click
36 MIKROE-1722 Fingerprint click
Table 2-1: List of Click Boards supported by DcDK Library
c. DcDKIODemo.zip contains DcDK IO Demo Application sample source code, which source code of the DcDK IO Demo Applications is provided together with the DcDK libraries and Javadoc package. Please use it as a reference when developing Device Driver and application if needed. DcDKIODemo.apk is also provided together with source code. If you would like to try out running the demo application before building it, you can install a pre-built APK to development platform. The APK is included in the demo package.
3. Documentation
a. Together with DcDK Bus library jar file and so file, Javadoc for both bus and device libraries are provided. To understand the details of API commands, please refer to Javadoc. Please contact VEST customer service if you would like to acquire DcDK license key.
b. DcDKInstallation Guide Android Application user guide to install DcDK license key and setting up VEST VK series development platform. Please refer to VEST-DCDK-USG-001 for details.
c. DcDK Device Driver Development User Guide to develop DcDK Device Driver with DcDK bus library. Please refer to VEST-DCDK-USG-002 for details.
VEST-DCDK-QSG-001, REV A
Page 10 APC Proprietary Information June 30, 2016
Android Studio Please follow steps below to link DcDK library files to Android Studio project.
1. Copy both androidjiolib.jar and androidjiodevlib.jar files into user application’s project folder app/libs/
2. Copy libAndroidJioLib.so file into user application’s project folder app/src/main/jniLibs/armeabi/
Figure 2-2: Add DcDK libraries to Android Studio
Eclipse Please follow below steps to link DcDK library files to Eclipse.
1. Right click project -> Properties -> click left pane “Java Build Path” -> click right pane’s “Libraries” tab -> click “Add External JARs” button -> select both androidjiolib.jar and androidjiodevlib.jar files -> click Open button -> click right pane’s “Order and Export” tab -> check both androidjiolib.jar and androidjiodevlib.jar -> click OK
VEST-DCDK-QSG-001, REV A
Page 11 APC Proprietary Information June 30, 2016
Figure 2-3: Add DcDK libraries to Eclipse 1/3
Figure 2-4: Add DcDK libraries to Eclipse 2/3
2. Copy libAndroidJioLib.so file into user application’s project folder libs/armeabi
Figure 2-5: Add DcDK libraries to Eclipse 3/3
VEST-DCDK-QSG-001, REV A
Page 12 APC Proprietary Information June 30, 2016
DCDK IO DEMO APPLICATION The DcDK IO Demo Application builds upon the successes of the DcDK Android-based operating system, by demonstrating the ease in working with low-level peripherals with the beauty of Android. The DcDK IO Demo Application is designed to function as-is, however here is a guide to get up and running with the DcDK IO Demo Application.
Overview
Figure 2-6: DcDK IO Demo Application on bigger LCD screen
Figure 2-7: DcDK IO Demo Application on smaller LCD screen
VEST-DCDK-QSG-001, REV A
Page 13 APC Proprietary Information June 30, 2016
The application is integrated into one page with the demo function of I2C, GPIO, RS232, SPI and PWM devices. Depending on screen size of development platform, the Demo IO Application might look same or similar to the one shown in Figure 2-7. Smaller screens might require scrolling to find all the features.
The application works in full screen and with a button to exit.
The devices are grouped by interfaces.
Multiple devices can be exercised at the same time.
Building DcDK IO Demo Application After unzipping the DcDKIODemo.zip file and loading the DcDK IO Demo Application source code, please
follow instructions below to build it. Please use the DcDK Demo Application source code as a reference when
developing Device Driver or application.
In Eclipse development environment, click menu: Run -> Run As -> 1 Android Application to build and execute a demo application.
Figure 2-8: Build and Execute Application in Eclipse
In Android Studio, click menu: Run -> Run (Alt+Shift+F10) to build and execute a demo application.
Figure 2-9: Build and Execute Application in Android Studio
As the result of clicking the menu,
1. The project will be built into APK.
2. The APK will be installed to the target through ADB.
3. The APK will be executed.
Before running the Demo IO Application, please make sure the MikroElektronika Click Boards are installed in the MikroBUS Interface Board. Next section lists different Click Boards that should be installed and corresponding interfaces each one exercises.
I2C Interface The following table details the I2C peripherals required.
VEST-DCDK-QSG-001, REV A
Page 14 APC Proprietary Information June 30, 2016
Device In Application
Peripheral Peripheral Pictures MikroBUS Interface Board Slot
IR Thermo 3.3V click board
I2C slots listed below 4:I2C_1 5:I2C_2 6:I2C_3 7:I2C_4 8:I2C_5
Proximity click board
I2C slots listed below 4:I2C_1 5:I2C_2 6:I2C_3 7:I2C_4 8:I2C_5
HTU21D click board
I2C slots listed below 4:I2C_1 5:I2C_2 6:I2C_3 7:I2C_4 8:I2C_5
Color click board
I2C slots listed below 4:I2C_1 5:I2C_2 6:I2C_3 7:I2C_4 8:I2C_5
Table 2-2: I2C Click Boards installed on mikroBUS™ Interface Board
Click “Start Demo” to start the demonstration. If the demonstration is started with no error the “Start Demo” button is changed to text “Stop Demo”. During the demonstration, the data of each device is reported every 500ms. Click “Stop Demo” to stop the demonstration.
VEST-DCDK-QSG-001, REV A
Page 15 APC Proprietary Information June 30, 2016
Figure 2-10: IR Thermo
IR Thermo reports the temperature value in degree C.
Figure 2-11: Proximity
Proximity reports the Ambient Light ADC value and the Proximity ADC value. The proximity’s maximum value is 65535, and use a slider bar to graphically show the progress change.
Figure 2-12: Temperature Humidity
Temperature Humidity reports the temperature in degree C and the Humidity in RH.
Figure 2-13: Color
The color reports the clear, red, green and blue ADC value.
GPIO Interface The following table details the GPIO peripherals required.
Device In Application
Peripheral Peripheral Pictures MikroBUS Interface Board Slot
GPIO Interface Board
10:GPIO
Table 2-3: GPIO Interface Board installed on mikroBUS™ Interface Board
When the demo application starts, the GPIOs are initialized as input. Press the switch “SW500” and “SW501”
on GPIO interface board to toggle the input state, you can observe correct switch status in the application.
VEST-DCDK-QSG-001, REV A
Page 16 APC Proprietary Information June 30, 2016
Figure 2-14: Input
Switching the radio box to ‘Output’ will change GPIO to out. In output mode, LED506/LED507 can be toggled
with ‘On’/’Off’ switch.
Figure 2-15: Output
RS232 Interface The following table details the serial peripherals required.
Device In Application
Peripheral Peripheral Pictures MikroBUS Interface Board Slot
NA NA J400
Table 2-4: RS232 Serial Port used in mikroBUS™ Interface Board
Connect one RS232 serial cable between PC host and J400, make sure Switch SW200 in “RS232” position.
Open one serial terminal window (Putty, etc.), configuration: 115.2k baud, 8 data bits, 1 stop bit, and no parity.
When “Send” button is pressed the sample message will be transmitted over RS232 to PC. Any data sent from
PC should appear in the “Receive” frame.
Figure 2-16: RS232 Serial
SPI Interface The following table details the SPI peripherals required.
Device In Application
Peripheral Peripheral Pictures MikroBUS Interface Board Slot
7 seg click board
2:SPI-1
Table 2-5: SPI Click Boards installed on mikroBUS™ Interface Board
Click “Start Demo” to start the demonstration. If the demonstration is started with no error the “Start Demo”
button is changed to text “Stop Demo”. During the demonstration, the segment display will count up from 0
to 99 with frequency of one every 500ms. Click “Stop Demo” to stop the demonstration.
Click “Set Number” to manually set a number. If count up demo is ongoing, setting a number will stop it.
VEST-DCDK-QSG-001, REV A
Page 17 APC Proprietary Information June 30, 2016
Figure 2-17: Set Number
PWM Interface The following table details the PWM peripherals required.
Device In Application
Peripheral Peripheral Pictures MikroBUS Interface Board Slot
GPIO Interface
Board
10:GPIO
Table 2-6: GPIO Interface Board installed on mikroBUS™ Interface Board
When modifying PWM0 and PWM1 sliders, brightness of corresponding LED column on the GPIO board
should change accordingly.
PWM0
PWM1
Figure 2-18: PWM
VEST-DCDK-QSG-001, REV A
Page 18 APC Proprietary Information June 30, 2016
3.0 REVISION HISTORY
Version Date Released Changes
A 28 JUNE 2016 Initial Release
VEST-DCDK-QSG-001, REV A
Page 19 APC Proprietary Information June 30, 2016
4.0 LEGAL NOTICES
The signed agreement between Purchaser and APC will govern the sale and purchase of APC’s Venture Embedded Solutions Technology (“VEST”) products (“Products”). In the event that no agreement has been concluded, APC’s terms and conditions of supply will apply.
Testing and other quality control techniques are used to the extent that APC deems necessary to support its warranty.
Except where required by law, specific testing of all parameters of each Product is not necessarily performed.
Purchaser must provide adequate design and operating safeguards to minimize inherent or procedural and technical risks associated with Purchaser products and applications. Purchaser is solely responsible for its selection and use of APC Products. APC assumes no liability for applications assistance, Purchaser product design or any incompatibility of the Product with Purchaser product.
Products supplied by APC are not designed, intended or authorized for use in life support, life sustaining, medical systems or devices, aircraft navigation, nuclear, or other applications, including, but not limited to, public transportation operating systems, in which the failure of such Products could reasonably be expected to result in personal injury, loss of life or severe property or environmental damage. Purchaser acknowledges that use of APC’s Products in such product applications is understood to be fully at the risk of Purchaser and that Purchaser is responsible for verification and validation of the suitability of APC’s Products in such applications. Purchaser agrees that APC is not and shall not be liable, in whole or in part, for any claim or damage arising from use in such applications. Purchaser agrees to indemnify, defend and hold APC harmless from and against any and all claims, damages, losses, costs, expenses and liabilities arising out of or in connection with any such use or application.
APC retains all rights to all proprietary intellectual property in the Products and associated manufacturing processes and has the right to file for and obtain intellectual property protection for same.