Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... ·...

19
1197 Borre Tel: +1 (40 W CONFIDENTIAL & PROPRIETARY InvenSense Conte A p NO unless “R This information furnished by InvenSense is beli use, or for any infringements or patents or oth without notice. Certain intellectual property ow by Implication or otherwise under any patent or InvenSense Inc. egas Ave., Sunnyvale, CA 94089 U.S.A. 08) 988-7339 Fax: +1 (408) 988-8104 Website: www.invensense.com Document Number: A Revision: 1.0 Release Date: 04/01 extual Awareness-SDK™ 5 Guide Release 1.0 printed copy of this document is OT UNDER REVISION CONTROL it is dated and stamped in red ink as, REVISION CONTROLLED COPY.” ieved to be accurate and reliable. However, no responsibility is assu her rights of third parties that may result from its use. Specificati wned by InvenSense and described in this document is patent protec r patent rights of InvenSense. This is an unpublished work protecte AN-MPU-9150IMF-03 1/2013 5.1.1 User umed by InvenSense for its ons are subject to change cted. No license is granted ed under the United States

Transcript of Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... ·...

Page 1: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

1197 Borregas Ave.Tel: +1 (408) 9

Website:

CONFIDENTIAL & PROPRIETARY

InvenSense Contextual Awareness

A printed copy of this document is

NOT UNDER REVISION CONTROL

unless it is dated and stamped in red ink as,

“REVISION CONTROLLED COPY.”

This information furnished by InvenSense is believed to be accurate and reliable. However, no responsibility is assumed by In

use, or for any infringements or patents or other rights of third parties that ma

without notice. Certain intellectual property owned by InvenSense and described in this document is patent protected. No lice

by Implication or otherwise under any patent or patent r

InvenSense Inc. Borregas Ave., Sunnyvale, CA 94089 U.S.A.

Tel: +1 (408) 988-7339 Fax: +1 (408) 988-8104 Website: www.invensense.com

Document Number: ANRevision: 1.0 Release Date: 04/01/2013

Contextual Awareness-SDK™ 5.1.1

Guide

Release 1.0

A printed copy of this document is

NOT UNDER REVISION CONTROL

unless it is dated and stamped in red ink as,

“REVISION CONTROLLED COPY.”

This information furnished by InvenSense is believed to be accurate and reliable. However, no responsibility is assumed by In

use, or for any infringements or patents or other rights of third parties that may result from its use. Specifications are subject to change

without notice. Certain intellectual property owned by InvenSense and described in this document is patent protected. No lice

by Implication or otherwise under any patent or patent rights of InvenSense. This is an unpublished work protected under the United States

Document Number: AN-MPU-9150IMF-03

Release Date: 04/01/2013

5.1.1 User

This information furnished by InvenSense is believed to be accurate and reliable. However, no responsibility is assumed by InvenSense for its

y result from its use. Specifications are subject to change

without notice. Certain intellectual property owned by InvenSense and described in this document is patent protected. No license is granted

ights of InvenSense. This is an unpublished work protected under the United States

Page 2: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

copyright laws. This work contains proprietary and confidential information of InvenSense Inc. Use, disclosure or reproductio

express written authorization of InvenSense Inc. is prohibited. Trademarks that are registered trademarks are the property of their

respective companies.

This publication supersedes and replaces all information previously supplied. InvenSense sensors should not be used or sold f

development, storing, production and utilization of any conventional or mass

applications, as well as to be used in any other life critical applications such as medical, transportation, aerospace, n

disaster and crime prevention equipment.

Table of Contents

1 PURPOSE AND SCOPE ................................

2 REVISION HISTORY ................................

3 REFERENCE DOCUMENTS AND SOFTWARE

4 CA-SDK™ SDK ................................

4.1 HARDWARE ................................

4.2 SOFTWARE COMPONENTS NEEDED TO

4.3 SOFTWARE ................................

4.4 INVENSENSE SENSOR ................................

4.5 EXTERNAL SENSORS.............................................................................................................................

5 HARDWARE AND SOFTWARE SETUP

5.1 HARDWARE SETUP ................................

5.2 SOFTWARE SETUP TO RUN THE D

5.3 USER INPUT ................................

6 PROGRAMMING THE SDK ................................

6.1 FIRMWARE. ................................

6.2 HOW TO USE EMA 5.1.1 FEATURES AND

6.3 EMBEDDED MOTIONAPPS™ PLATFORM

6.4 CALIBRATION AND SELF-TEST ................................

6.5 ULTRA-LOW POWER FEATURES

6.6 COMPILATION SETUP................................

6.7 STEPS TO BRING UP THE PROJECT IN

6.8 REVIEW OF THE MLLITE_TEST.C

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

2 of 19

copyright laws. This work contains proprietary and confidential information of InvenSense Inc. Use, disclosure or reproductio

InvenSense Inc. is prohibited. Trademarks that are registered trademarks are the property of their

This publication supersedes and replaces all information previously supplied. InvenSense sensors should not be used or sold f

elopment, storing, production and utilization of any conventional or mass-destructive weapons or any other weapons or life threatening

applications, as well as to be used in any other life critical applications such as medical, transportation, aerospace, n

Copyright ©2011 InvenSense Corporation.

................................................................................................................................

................................................................................................................................

CUMENTS AND SOFTWARE PACKAGES ................................................................

................................................................................................................................

................................................................................................................................

EEDED TO PROGRAM THE SDK ................................................................

................................................................................................................................

................................................................................................

............................................................................................................................................

E SETUP................................................................................................

...............................................................................................................................

DEMO APPLICATION ................................................................

................................................................................................................................

................................................................................................

................................................................................................................................

EATURES AND INTEGRATE WITH AN APPLICATION ................................

LATFORM OVERVIEW ................................................................

................................................................................................

EATURES ................................................................................................

.............................................................................................................................

ROJECT IN CODE COMPOSER STUDIO ................................................................

C FILE TO BUILD A SAMPLE APPLICATION WITH EMBEDDED MOTION

Release Date: 04/01/2013

copyright laws. This work contains proprietary and confidential information of InvenSense Inc. Use, disclosure or reproduction without the

InvenSense Inc. is prohibited. Trademarks that are registered trademarks are the property of their

This publication supersedes and replaces all information previously supplied. InvenSense sensors should not be used or sold for the

destructive weapons or any other weapons or life threatening

applications, as well as to be used in any other life critical applications such as medical, transportation, aerospace, nuclear, undersea, power,

.................................. 3

..................................... 3

............................................. 4

............................................... 5

........................................... 5

............................................. 6

............................................ 7

.............................................................. 7

...............................................7

........................................ 11

............................... 11

.................................................... 12

........................................ 13

.......................................................... 15

......................................... 15

.................................................... 15

..................................................... 15

................................................. 15

.............................................. 16

............................. 16

...................................... 16

OTIONAPPS 5.1.1 ....... 19

Page 3: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

1 Purpose and Scope

This document describes the InvenSense

user to run the CA-SDK™ with the PC

2 Revision History

Revision Date Revision

04/01/2013 1.0

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

3 of 19

enSense CA-SDK™ 5.1.1 User Guide. It is intended as a

PC or Android application.

Description

InvenSense CA-SDK™ 5.1.1 User Guide

Release Date: 04/01/2013

is intended as a guide for the

Page 4: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

3 Reference Documents and Software Packages

1. MPU-9250™ CA-SDK™ Reference Board Userboard

2. Embedded Motion Apps (eMA)

3. CA-SDK application: A sample application running on CAconfigure eMA v5.1.1

4. Python eMA client: A PC application to interface and configure CA

5. Android CA-SDK client: A android application to interface and configure CA

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

4 of 19

Reference Documents and Software Packages

SDK™ Reference Board User Guide : General hardware guidelines for CA

Embedded Motion Apps (eMA) v5.1.1 APIs Specification: Document describes eMA v5.1.

SDK application: A sample application running on CA-SDK board showing how to use

application to interface and configure CA-SDK application

: A android application to interface and configure CA-SDK application

Release Date: 04/01/2013

guidelines for CA-SDK

eMA v5.1.1 APIs

SDK board showing how to use and

SDK application

SDK application

Page 5: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

4 CA-SDK™ SDK

4.1 Hardware

Hardware Needed for Programming Using JTAG

• CA-SDK™ SDK (http://www.invensense.com/developers

Please refer to the MPU-9250™ CA

sensors and hardware schematics.

Bluetooth Module

MSP430 MCU

Pressure sensor

UV sensor

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

5 of 19

Hardware Needed for Programming Using JTAG

http://www.invensense.com/developers)

Figure 4.1.0 MPU 9250 CA-SDK™ Board

CA-SDK™ Reference Board User Guide for details on each of these

MPU

Micro USB

Release Date: 04/01/2013

for details on each of these

MPU-9250

Micro USB

Humidity and Temperature sensor

Light and proximity sensor

Page 6: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

• MSP-FET430UIF flash tool (

Figure 4.1.1: Flash tool required for programming

4.2 Software Components Needed to Program the SDK

Loading Software on MCU

Option 1 – PC Program to load the software (that loads firmware on the MCU): Please install

software (http://www.ti.com/tool/flash

usage of this program please contact TI.

Option 2 - Code Composer Studio: The Code Comp

development on the SDK. Information on CCS can be obtained from

or http://processors.wiki.ti.com/index.php/Download_CCS

Option 3- Boot Strap Loading via USB

BSL will comply with the standards from TI’s application note as below.

http://www.ti.com/lit/an/slaa452b/slaa452b.pdf

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

6 of 19

FET430UIF flash tool (http://www.ti.com/tool/msp-fet430uif)

Figure 4.1.1: Flash tool required for programming

Software Components Needed to Program the SDK

PC Program to load the software (that loads firmware on the MCU): Please install

http://www.ti.com/tool/flash-programmer) on your PC. For questions on installation or

usage of this program please contact TI.

Code Composer Studio: The Code Composer Studio from TI can be used for application

development on the SDK. Information on CCS can be obtained from http://www.ti.com/tool/ccstudio

http://processors.wiki.ti.com/index.php/Download_CCS.

via USB

will comply with the standards from TI’s application note as below.

http://www.ti.com/lit/an/slaa452b/slaa452b.pdf

Release Date: 04/01/2013

)

Figure 4.1.1: Flash tool required for programming

PC Program to load the software (that loads firmware on the MCU): Please install the

) on your PC. For questions on installation or

oser Studio from TI can be used for application

http://www.ti.com/tool/ccstudio

Page 7: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

The option to load the program through BSL requires the existing software on the CA

have a BSL jump with a user interface. The software that is pre flashed on all CA

shipped does come with the option of pressing the button to put the CA

update their software using USB interface. A similar interface is recommended fo

updates from the developer to make this feature available.

For the software shipped with CA-SDK, holding the button for two seconds with USB connected allows

for BSL jump. To be able to allow it in

((void (*)())0x1000)();

For more details refer to checkClick() function

4.3 Software

Firmware Embedded MotionApps

1. The CA-SDK™ board comes with preloaded

outputs quaternion via

Studio from TI. The link below provides the

http://processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5

2. The default software settings

eMA ™v5.1.1 API Specification

application release package

Feature

Quaternion Update Rate

Quaternion Resolution

Quaternion Range

CA-SDK™ Software

To integrate eMA 5.1.1 you will need to locate the *.Hex file which is included in the

package. Refer to the eMA™ v5.1.1 API Specification for supported API calls needed to build your

application. Except for the MPL library

showcase on how to interface the APIs. eMA

gyroscope, accelerometer, and magnetometer.

4.4 InvenSense Sensor

• InvenSense MPU-

magnetometer integrated

integration and calibration

4.5 External Sensors. Datasheets can be found inside the CA

the Developers Corner. http://www.invensense.com/developers/index.php?_r=default

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

7 of 19

The option to load the program through BSL requires the existing software on the CA

interface. The software that is pre flashed on all CA-SDK boards that are

shipped does come with the option of pressing the button to put the CA-SDK in BSL where the user can

update their software using USB interface. A similar interface is recommended fo

updates from the developer to make this feature available.

SDK, holding the button for two seconds with USB connected allows

for BSL jump. To be able to allow it in your program; use this line of code:

checkClick() function in the source code and refer to this document:

Embedded MotionApps-5.1.1

board comes with preloaded software which interfaces with eMA and

outputs quaternion via a Bluetooth link. The code is implemented using Code Composer

The link below provides the documentation for Code Composer.

processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5

default software settings for the CA-SDK application can be changed according to the

API Specification document. Please check the mllite_test

release package for details of the implementation.

Settings

Quaternion Update Rate 20Hz

Quaternion Resolution 32 Bits

Quaternion Range Full 360º

5.1.1 you will need to locate the *.Hex file which is included in the

™ v5.1.1 API Specification for supported API calls needed to build your

Except for the MPL library the entire software is available in source code for developer

showcase on how to interface the APIs. eMA™ v5.1.1 covers the MPU-9250 sensors which are

and magnetometer.

-9250: A 3-axis gyroscope, 3-axis accelerometer

integrated into a single package. The eMA™ v5.1.1 API cover

integration and calibrations for the MPU-9250.

Datasheets can be found inside the CA-SDK zip file available for download in

ttp://www.invensense.com/developers/index.php?_r=default

Release Date: 04/01/2013

The option to load the program through BSL requires the existing software on the CA-SDK board to

SDK boards that are

SDK in BSL where the user can

update their software using USB interface. A similar interface is recommended for any software

SDK, holding the button for two seconds with USB connected allows

in the source code and refer to this document:

software which interfaces with eMA and

The code is implemented using Code Composer

omposer.

processors.wiki.ti.com/index.php/Category:Code_Composer_Studio_v5 .

e changed according to the

mllite_test.c file in the

5.1.1 you will need to locate the *.Hex file which is included in the CA-SDK software

™ v5.1.1 API Specification for supported API calls needed to build your

code for developers to

9250 sensors which are the

accelerometer, and 3-axis

v5.1.1 API covers the

SDK zip file available for download in

ttp://www.invensense.com/developers/index.php?_r=default

Page 8: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

• Sensirion SHT21: Temper

driver for retrieving the r

• Capella CM36682:

for retrieving the raw sensor data from the sensors

interface example and

• Capella CM3512: UVI

for retrieving the UV index from the sensor

• ALSP HSPPA032A

retrieving the pressure values.

The sensor_probe.c file in the CA-SDK software provides the needed APIs

data from the external sensors. In the main function, probe_setup_all_external_sensor () will

and if any setup is needed will setup the sensors. The functions get_<sensor>_data (data) retrieves the

sensor data. Function make_protocol () packages these sensors to be sent out using USB or UART. For

further information or other configuration please refer to the datas

Macronix Serial Flash Driver for MX25L25635E

For information on the serial flash, please refer to

Also, an example is given in test_flash() function .

Demos

Android client

1. This android application provides a way to evaluate the CA

can be downloaded from the play store. Please click the following link. The applicat

Bluetooth connectivity.

Figure 4.3.0 is the startup menu in the

android application.

It gives an overview of present sensors.

The sensor values are collected from

the CA-SDK board, the methods for

calculating these values will be given

shortly.

Euler angles are updated using

quaternion packets received from eMA

5.1.1.

For more information on external

sensors and how to calculate them,

please check BluethoothDataReader.java

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

8 of 19

: Temperature and humidity sensors. CA-SDK software provides the

driver for retrieving the raw sensor data from the sensor.

Capella CM36682: Light and proximity sensors. CA-SDK software provides the driver

for retrieving the raw sensor data from the sensors. The light sensor is provided as

interface example and the proximity sensor is disabled by default for power concerns.

: UVI (ultra violet index) sensor. CA-SDK software provides the driver

for retrieving the UV index from the sensor.

2A: Pressure sensor. CA-SDK software provides the driver for

retrieving the pressure values.

SDK software provides the needed APIs to retrieve the raw sensor

. In the main function, probe_setup_all_external_sensor () will

and if any setup is needed will setup the sensors. The functions get_<sensor>_data (data) retrieves the

ke_protocol () packages these sensors to be sent out using USB or UART. For

further information or other configuration please refer to the datasheet for the external sensors

Macronix Serial Flash Driver for MX25L25635E

ash, please refer to MX25L25635E, LLD, v0.3.zip on the Macronix website.

Also, an example is given in test_flash() function .

provides a way to evaluate the CA-SDK board. The example application

can be downloaded from the play store. Please click the following link. The applicat

the

It gives an overview of present sensors.

collected from

SDK board, the methods for

calculating these values will be given

received from eMA

sensors and how to calculate them,

check BluethoothDataReader.java class.

Figure 4.3.0

Release Date: 04/01/2013

SDK software provides the

software provides the driver

. The light sensor is provided as an

is disabled by default for power concerns.

SDK software provides the driver

SDK software provides the driver for

to retrieve the raw sensor

. In the main function, probe_setup_all_external_sensor () will probe,

and if any setup is needed will setup the sensors. The functions get_<sensor>_data (data) retrieves the

ke_protocol () packages these sensors to be sent out using USB or UART. For

heet for the external sensors.

on the Macronix website.

SDK board. The example application

can be downloaded from the play store. Please click the following link. The application works with

Page 9: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

Temperature Sensor

Temperature = temperature [0] *256 + temperature [1

Temperature= (float) (-46.85 + 175.72 * (Temp

Humidity Sensor Humidity = humidity[0] *256 + humidity[1

1- First remove the last three bits

For Android: float hex = Integer.parseInt(

Humidity = Float.intBitsToFloat(Float.floatToRawIntBits(Humidity)&

Float.floatToRawIntBits(hex));

2- Humidity = (float) (-6 + 125 * (Humidity /(2 ^ 16)))

Light Sensor currLight = light[0] *256 + light[1

currLight = currLight * 0.06103f;

Light = (currLight * .8f) + (Light * .2f

UV sensor

UV = uv[0] *256 + uv[1]

UV = (UV * 0.022f) * 10

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

9 of 19

temperature [0] *256 + temperature [1]

46.85 + 175.72 * (Temperature / (2.0^16.0)))

Humidity = humidity[0] *256 + humidity[1]

First remove the last three bits

hex = Integer.parseInt("FFF8", 16);

Humidity = Float.intBitsToFloat(Float.floatToRawIntBits(Humidity)&

Float.floatToRawIntBits(hex));

6 + 125 * (Humidity /(2 ^ 16)))

currLight = light[0] *256 + light[1]

currLight = currLight * 0.06103f;

Light = (currLight * .8f) + (Light * .2f)

Release Date: 04/01/2013

Humidity = Float.intBitsToFloat(Float.floatToRawIntBits(Humidity)&

Page 10: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

Figure 4.3.1 section consists of

all commands the user can send

to the CA-SDK board.

On the right, the cube uses

quaternion data to rotate. In the

middle debugging information

will be shown.

1- Enable some Display options, and then click on Options

2- When logging, the Display commands will be disabled.

SDKClient.

Three log files will be created, one for external sensors (Pressure, Humidity

which is named sensors_TIME_external

The third file debug_TIME.txt contains debugging

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

10 of 19

ns, and then click on Options-> start Logging.

hen logging, the Display commands will be disabled. The files will be saved

log files will be created, one for external sensors (Pressure, Humidity, Light, UV, Temperature)

external.csv and another for other sensors, named sensors

debug_TIME.txt contains debugging Messages.

Figure 4.3.1

Release Date: 04/01/2013

d in sdcard/CA-

, UV, Temperature)

sensors_TIME.csv.

Page 11: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

Python cube debug console app

2. The cube demo is written in python script and needs python instal

demo lets users do more than just

please look at Software Setup to Run the Demo Application

python eMA-client.py script

5 Hardware and Software Setup

5.1 Hardware Setup

Charge the unit via USB connector for

1. Configure the Bluetooth interface on the PC. Go to “

Items\Devices and Printers\

(figure 4.1.0)

2. If the computer asks for the password, enter

3. The PC will add the required driver to succes

4. Go to the Control Panel\All Control Panel Items

the port number of the Bluetooth serial port

66, but we will call it just COM#

SDK™ once by flipping the DIP

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

11 of 19

The cube demo is written in python script and needs python installed on the computer. This cube

more than just observe the orientation. For a complete set

Software Setup to Run the Demo Application in section 5.2 of this document,

Hardware and Software Setup

unit via USB connector for 2 hours. Turn on the SDK using the DIP switch on the board.

Configure the Bluetooth interface on the PC. Go to “control Panel\

\” then choose “Add a device” and choose blue “BlueRadios” device

the computer asks for the password, enter “default”. (Zeros in numerical)

The PC will add the required driver to successfully add the device to the PC.

All Control Panel Items\Devices and Printers\ to properties and

port number of the Bluetooth serial port (figure 5.1.1.1). In this example the port number is

COM# from now on. After successfully pairing, power cycle the

once by flipping the DIP switch OFF and ON.

Release Date: 04/01/2013

on the computer. This cube

complete set of functionality

of this document, or the

2 hours. Turn on the SDK using the DIP switch on the board.

\All Control Panel

and choose blue “BlueRadios” device.

(Zeros in numerical)

to properties and check

.1). In this example the port number is

After successfully pairing, power cycle the CA-

Page 12: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

Figure 5.1.1.0 Adding BlueRadios t

Figure 5.1.1.1 Right click the added device to go to properties

(Step 4)

5.2 Software Setup to Run the Demo Application

Debug Console App (Optional demo to run if needed)

(eMA-client.py)

A debugging console application is provided to aid developers using the

application is provided as Python source code. It has the following functionality:

1. Provides a console for MPL

2. Provides a simple cube demo for visualizing sensor fusion output.

Because the debug console is provided as Python source code, the user will need to install the

following components to have a working Python environment

1. Python 2.7: The debug console was tested with Python 2.

Download it from http://www.python.org/download/releases/2.7.4/

2. Pyserial 2.6: The debug console requires pyserial to c

Download the Python 2.6

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

12 of 19

.0 Adding BlueRadios to the PC (Steps 1, 2, 3)

click the added device to go to properties and check the port number

un the Demo Application

(Optional demo to run if needed)

A debugging console application is provided to aid developers using the

application is provided as Python source code. It has the following functionality:

Provides a console for MPL_LOG messages.

Provides a simple cube demo for visualizing sensor fusion output.

Because the debug console is provided as Python source code, the user will need to install the

following components to have a working Python environment.

The debug console was tested with Python 2.7 on Windows 7 and Windows

http://www.python.org/download/releases/2.7.4/

: The debug console requires pyserial to communicate on the seri

Download the Python 2.6 source code from https://pypi.python.org/pypi/pyserial

Release Date: 04/01/2013

and check the port number

A debugging console application is provided to aid developers using the CA-SDK™. This

application is provided as Python source code. It has the following functionality:

Because the debug console is provided as Python source code, the user will need to install the

and Windows 8.

ommunicate on the serial port.

https://pypi.python.org/pypi/pyserial

Page 13: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

3. Pygame 1.9.1: The debug console uses the pygame library to render the cube demo.

for 86x: http://pygame.org/ftp/pygame

for 64x release from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

4. You must install Python before installing the pyserial and pygame libraries. After installing

python use the command prompt to i

location of pyserial), “python install pyserial.py”.

5. You will want to add Python to your PATH for convenience. In Windows, right click on My

Computer, select Properties, then in the advanced tab,

the user variables (top section), select Path, click Edit, and add the directory C:

the end of the list.

6. Once you have a working Python environment, you can run the debug console application

from the command line with

location of the python cube relative to the release folder as below

7. CA-SDK_With_eMA511_Release.zip

Client

8. python eMA-client.py <comport>

Where <comport> is the COM# as described in

Figure 5.2.2

5.3 User Input

To enable or disable certain functionalities, f

case '8': Toggles Accel sensor

case '9': Toggles Gyro sensor

case '0': Toggles Compass sensor

case 'a': Prints Accel sensor

case 'g': Prints Gyro sensor

case 'c': Prints Compass sensor

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

13 of 19

Pygame 1.9.1: The debug console uses the pygame library to render the cube demo.

http://pygame.org/ftp/pygame-1.9.1.win32-py2.7.msi / Pygame 1.9.2.

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

You must install Python before installing the pyserial and pygame libraries. After installing

python use the command prompt to install pyserial (command prompt needs

“python install pyserial.py”.

You will want to add Python to your PATH for convenience. In Windows, right click on My

Computer, select Properties, then in the advanced tab, and select Environment Variables. In

the user variables (top section), select Path, click Edit, and add the directory C:

Once you have a working Python environment, you can run the debug console application

from the command line with the command. To accept data one has to give the python

location of the python cube relative to the release folder as below.

511_Release.zip\CA-SDK_With_eMPA511_Release\core

.py <comport>

COM# as described in figure 5.1.1.1

Figure 5.2.2: Cube Demo Application running on console

To enable or disable certain functionalities, first enter “inv” followed by following case:

case '8': Toggles Accel sensor

'9': Toggles Gyro sensor

case '0': Toggles Compass sensor

case 'a': Prints Accel sensor

case 'c': Prints Compass sensor

Release Date: 04/01/2013

Pygame 1.9.1: The debug console uses the pygame library to render the cube demo. Release

. windows binaries

You must install Python before installing the pyserial and pygame libraries. After installing

prompt needs to point to

You will want to add Python to your PATH for convenience. In Windows, right click on My

Environment Variables. In

the user variables (top section), select Path, click Edit, and add the directory C:\Python27 to

Once you have a working Python environment, you can run the debug console application

the command. To accept data one has to give the python

core\eMA-hal\eMA-

” followed by following case:

Page 14: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

case 'e': Prints Eular data in radius

case 'r': Prints Rotational Matrix data

case 'q': Prints Quaternion

case 'h': Prints Heading in degrees

case 'k': Prints Pressure, Temperature, UV, Light, Humidity

case 'm': Start/Stop Magnetic disturbance algorithm

case 'n': Get eMA version

case 'w': Get Compass status and Accuracy

case 't' Run Calibration

case '1' to case '4' : Slow down or speed up the rate of sensors

case 'x': reset msp430

case 'v': Toggle LP quaternion

For more cases refer to eMA 5.1.1. Source

CTLR + S: Start logging

CTLR + T: Stop logging

The files will be saved in Logs folder created

To Note:

1- For logging, to start user needs to have at least one sensor display enabled

2- In case a sensor is running on startup of eMA

is needed for logging data.

3- Sensors need to be enabled on start of python script and if they are running already,

program is not in default setting, and their data will not be save

4- When logging has started, user cannot disable/enable any sensor

a. Cases: 8, 9, 0, a, g, c, e, q, r, h, k will not be recognized

5- Two log files will be created, one for external sensors (Pressure, Humidity, Light, UV,

Temperature) which is named External_TIME.csv and another named all_TIME

There are three packages that python script accepts,

1- debug_packet: used to show any debugging messages

2- quat_packet: used for rotating cube

3- data_packet: contains sensors

a. All conversion formulas which reads data from eMA

numbers can be found in __init__() function of data_packet class.

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

14 of 19

in radius

Prints Rotational Matrix data

Prints Heading in degrees

Pressure, Temperature, UV, Light, Humidity

p Magnetic disturbance algorithm

case 'w': Get Compass status and Accuracy

'1' to case '4' : Slow down or speed up the rate of sensors

case 'v': Toggle LP quaternion

Source code in handle_user() function

e saved in Logs folder created in your python script location.

to start user needs to have at least one sensor display enabled.

In case a sensor is running on startup of eMA-Client.py, first use ‘invx’ to go to

Sensors need to be enabled on start of python script and if they are running already,

not in default setting, and their data will not be saved in logs.

When logging has started, user cannot disable/enable any sensor display or toggle any sensors.

Cases: 8, 9, 0, a, g, c, e, q, r, h, k will not be recognized

created, one for external sensors (Pressure, Humidity, Light, UV,

Temperature) which is named External_TIME.csv and another named all_TIME

that python script accepts,

: used to show any debugging messages

quat_packet: used for rotating cube

data_packet: contains sensors information

conversion formulas which reads data from eMA 5.1.1 and translate it to meaningful

und in __init__() function of data_packet class.

Release Date: 04/01/2013

Client.py, first use ‘invx’ to go to default setting. It

Sensors need to be enabled on start of python script and if they are running already, the

display or toggle any sensors.

created, one for external sensors (Pressure, Humidity, Light, UV,

Temperature) which is named External_TIME.csv and another named all_TIME.csv

translate it to meaningful

Page 15: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

6 Programming the SDK

6.1 The CA-SDK™ comes pre-flashed with software needed to g

remainder of this section is needed only if the user would need to modify the embedded

firmware.

6.2 How to use eMA 5.1.1 Features and Integrate

The CA-SDK™ package comes with an example application

transmit sensor fusion data via serial UART. The next sections cover details about the

architecture and example application code

6.3 Embedded MotionApps™ Platform Overview

Embedded MotionApps 5.1.1 has been designed with a new architecture as explain

architecture provides customers with a much more modular MotionTracki

much less application processor resources, improving the overall power consumption.

There are three basic components in this architecture:

• Embedded Hardware Abstraction

a. This is the central point of communication between

applications.

b. HAL provides function calls to initialize, enable, start, stop, and control all features

in eMA. Please refer to [2

• Embedded MotionProcessing Library (

a. eMA provides a plug

calibration, 9-axis MotionFusion, etc.)

b. eMA provides a w

and generate features. Please refer to [2

• Embedded Motion Driver:

a. Device drivers for all supported InvenS

6.4 Calibration and Self-test

Embedded MotionApps consists of the following key calibration and self

Calibration:

• Calibration for gyro bias

� Fast no motion (<1 second convergence time)

� Standard no motion (8 second convergence time)

� SW temperature compensation

• InvenSense proprietary compass calibration

� Standard fit

� Vector

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

15 of 19

flashed with software needed to generate calibrated quaternion. The

section is needed only if the user would need to modify the embedded

Features and Integrate with an Application

™ package comes with an example application (that instantiates eMA v5.1.1

transmit sensor fusion data via serial UART. The next sections cover details about the

application code.

Embedded MotionApps™ Platform Overview

has been designed with a new architecture as explained below. The new

architecture provides customers with a much more modular MotionTracking solution that

processor resources, improving the overall power consumption.

There are three basic components in this architecture:

Hardware Abstraction Layer (HAL):

This is the central point of communication between eMA, device drivers

HAL provides function calls to initialize, enable, start, stop, and control all features

Please refer to [2] for further details.

MotionProcessing Library (eMPL):

provides a plug-in framework for single function features (e.g. gyro bias

axis MotionFusion, etc.).

provides a well-defined flow to register/unregister, initialization,

ate features. Please refer to [2] for further details.

river:

Device drivers for all supported InvenSense sensors.

Embedded MotionApps consists of the following key calibration and self-test features:

Fast no motion (<1 second convergence time)

Standard no motion (8 second convergence time)

SW temperature compensation

InvenSense proprietary compass calibration

Release Date: 04/01/2013

ed quaternion. The

section is needed only if the user would need to modify the embedded

5.1.1 API calls) to

transmit sensor fusion data via serial UART. The next sections cover details about the eMA

ed below. The new

ng solution that consumes

processor resources, improving the overall power consumption.

, device drivers, and the

HAL provides function calls to initialize, enable, start, stop, and control all features

in framework for single function features (e.g. gyro bias

defined flow to register/unregister, initialization, start, stop,

t features:

Page 16: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

� Small Motion using

Self-test:

• Integrated MotionTracking device based self

for further details).

• Integrated MotionTracking device

[2] for further details).

• Integrated MotionTracking device

for further details).

• Self-test is integrated into the respective device drivers

Please refer to [2] for a brief description of i

6.5 Ultra-Low Power Features

The ultra-low power features introduced in this release and listed below support fully autonomous

operation, completely independent from the application

• DMP-based pedometer

• DMP-based gestures

� Directional Tap

� Orientation (including Flip)

� Screen Orientation

• Low Power Quaternion

• Low Power 6-Axis Sensor Fusion

In general, please refer to [2] on the description, usage

6.6 Compilation Setup

The Embedded MotionApps™ Platform requires Code Composer St

chip selected is MSP430F5528 which is the one

6.7 Steps to Bring Up the Project

• Download and install the Code Composer S

(http://www.ti.com/tool/ccstudio

restrictions on code size that makes it unusable with

full featured version. TI offers a trial version of the software which can be used for configuring

your CA-SDK application.

• Download the release package from the D

extract the Embedded MotionApps

• Open the Code Composer, go to File

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

16 of 19

Small Motion using gyro

Integrated MotionTracking device based self-test for gyroscope in the MPU-9250

Integrated MotionTracking device-based self-test for accelerometer in the MPU

Integrated MotionTracking device-based self-test for compass in the MPU-9250

integrated into the respective device drivers.

] for a brief description of individual calibration functions and recommended settings.

low power features introduced in this release and listed below support fully autonomous

ndependent from the application processor:

Orientation (including Flip)

Axis Sensor Fusion

] on the description, usage, and integration of each of the above features

MotionApps™ Platform requires Code Composer Studio v4.0 or later and the default

chip selected is MSP430F5528 which is the one on the CA-SDK board.

to Bring Up the Project in Code Composer Studio

Download and install the Code Composer Studio from the TI website

http://www.ti.com/tool/ccstudio). Please note that TI offers a free version of CCS which has

restrictions on code size that makes it unusable with the CA-SDK™ hence you would need the

TI offers a trial version of the software which can be used for configuring

nload the release package from the Developers Corner and unzip (or 7zip) the folder to

Embedded MotionApps eMA-5.1.1 software.

omposer, go to File -> Imports as in figure below.

Release Date: 04/01/2013

9250 (Refer to [2]

MPU-9250 (Refer to

9250 (Refer to [2]

d recommended settings.

low power features introduced in this release and listed below support fully autonomous

and integration of each of the above features.

udio v4.0 or later and the default

). Please note that TI offers a free version of CCS which has

hence you would need the

TI offers a trial version of the software which can be used for configuring

orner and unzip (or 7zip) the folder to

Page 17: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

• Open Existing CCS/CCE Eclipse Projects

• Browse the folder where the

• Now the project opens up and it is ready to compile, look for

example project is being integrated into

Figure 6.

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

17 of 19

Open Existing CCS/CCE Eclipse Projects.

e the folder where the eMA is located and open the project.

Now the project opens up and it is ready to compile, look for the main.c file to see how the

roject is being integrated into eMA.

6.9.0: Select import to import the project

Release Date: 04/01/2013

to see how the

Page 18: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

Figure 6.9.1: Open the existing project and put it in the project

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

18 of 19

Open the existing project and put it in the project

Release Date: 04/01/2013

Page 19: Invensense Contextual Awareness-SDK 5.1.1 User Guide Export/Supplier Content/invensense... · 2014-10-09 · InvenSense CONFIDENTIAL & PROPRIETARY 1 Purpose and Scope This document

InvenSense

CONFIDENTIAL & PROPRIETARY

6.8 Review of the mllite_test.c

5.1.1

The file is self-explanatory in terms

important steps only. This example application

quaternion data at 50Hz update rate. The value of the quaternion is

then transferred via Bluetooth module. The previous section shows how to use the program with PC

applications.

• msp430_clock_init(12000000L, 2); msp430_i2c_enable(); msp430_int_e

msp430_uart_init(); is needed to setup the system layer functions. This will enable the I2C,

clocks, and UART functionality in the project

• It is very important to initialize

• Starting eMA using inv_start_mpl()

are initialized. There are other defaults sets

o 20 Hz fifo output rate (This is the default and can be changed)

o Range for accelerometer

o Gyro range can be set using gyro_set_gyro_fsr()

• In this example application

on the application one can change the use case of the app

• inv_execute_on_data() will process the data it has received and update all the internal states

and features that have been turned on. This function should be called after at least one of

inv_build_gyro(), inv_build_accel(), or inv_build_compass()

• eMA_send_quat(data); this

module at 115200 baud rate.

7. Known Issues

7.1 For MSP430 security Fuse

http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/166038.aspx

http://e2e.ti.com/su

7.1 Default Frequency is 2

cause interruptions. Future versions will address this issue.

InvenSense CA-SDK™ 5.1.1 User Guide

Release 1.0

Document Number: Revision: 1.0 Release Date: 04/01/2013

19 of 19

File to Build a Sample Application with Embedded MotionApps

s of inline documentation and therefore we will go through the

example application program is designed to continuously transfer

z update rate. The value of the quaternion is transmitted to the UART

transferred via Bluetooth module. The previous section shows how to use the program with PC

msp430_clock_init(12000000L, 2); msp430_i2c_enable(); msp430_int_enable();

is needed to setup the system layer functions. This will enable the I2C,

unctionality in the project. Initial_Spi(); to enable flash read/write.

It is very important to initialize using inv_init_mpl(). It should be called first and once.

inv_start_mpl() will enable eMA. Here are the major default valu

are other defaults sets as well.

0 Hz fifo output rate (This is the default and can be changed)

accelerometer can be set using gyro_set_accel_fsr();

can be set using gyro_set_gyro_fsr()

application the MCU continuously transmits the data and is set in a

on the application one can change the use case of the application.

inv_execute_on_data() will process the data it has received and update all the internal states

and features that have been turned on. This function should be called after at least one of

inv_build_gyro(), inv_build_accel(), or inv_build_compass() has been called.

this function packages the quaternion and sends it out using the UART

module at 115200 baud rate.

security Fuse blown:

http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/166038.aspx

http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/121347.aspx

Default Frequency is 20 Hz; frequencies above this with compass enable

. Future versions will address this issue.

Release Date: 04/01/2013

pplication with Embedded MotionApps

will go through the

program is designed to continuously transfer

the UART port and

transferred via Bluetooth module. The previous section shows how to use the program with PC

nable();

is needed to setup the system layer functions. This will enable the I2C,

to enable flash read/write.

should be called first and once.

. Here are the major default values which

s the data and is set in a loop. Based

inv_execute_on_data() will process the data it has received and update all the internal states

and features that have been turned on. This function should be called after at least one of

ds it out using the UART

http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/166038.aspx

pport/microcontrollers/msp430/f/166/t/121347.aspx

frequencies above this with compass enabled will