1、 InvenSense Inc. 1745 Technology Dr., San Jose, CA 95110 U.S.A. Tel: +1 (408) 988-7339 Fax: +1 (408) 988-8104 Website: Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY PRELIMINARY Motion Driver 6.1 Getting Started Guide Motion Driver 6.0 Getting Sta
2、rted Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 2 of 16 PRELIMINARY Table of Contents 1 REVISION HISTORY . 3 2 PURPOSE 4 3 RELEASE PACKAGE . 4 4 STARTING WITH THE TI-MSP430 PROJECT . 5 4.1 REQUIREMENTS . 5 4.2 CONNECTING THE HARDWARE 5 4.
3、3 OPENING AND COMPILING THE MSP430 PROJECT 6 5 STM32L (CORTEX-M3) DISCOVERY BOARD PROJECT 8 5.1 REQUIREMENTS . 8 5.2 CONNECTING THE HARDWARE 9 5.3 OPENING AND COMPILING THE IAR PROJECT 10 6 STM32F4 (CORTEX-M4) DISCOVERY BOARD PROJECT 12 7 PYTHON CLIENT 13 Motion Driver 6.0 Getting Started Guide Docu
4、ment Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 3 of 16 PRELIMINARY 1 Revision History Revision Date Revision Description 06/27/2014 1.0 Initial Release 07/17/2014 1.1 Added STM32F4 information Motion Driver 6.0 Getting Started Guide Document Number: AN
5、-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 4 of 16 PRELIMINARY 2 Purpose Motion Driver is an embedded software stack of the sensor driver layer that easily configures and leverages many of the features of the InvenSense motion tracking solutions. The motion devic
6、es supported are MPU6050/MPU6500/MPU9150/MPU9250. Many of the features of the hardware and the on board Digital Motion Processor (DMP) are encapsulated into modular APIs which can be used and referenced. Motion Driver is designed as a solution which can be easily ported to most MCUs. With the releas
7、e of the Motion Driver 6.0 it includes a 9-axis solution for ARM MCUs and the TI-MSP430. 6-axis only solutions should continue to reference the Motion Driver 5.1.2 for easier understanding of the software. This document details how to set up the hardware and get the default projects up and running.
8、It is recommended as a good way to understand the Motion Driver algorithms, DMP, and MPU HW features. 3 Release Package MD6.0 release package contains example projects of the TI-MSP430 using Code Composer as well as STM32F4 and STM32L using IAR. It also contains binary MPL libraries for 9-axis fusio
9、n precompiled for ARM processors and TI-MSP430 processors. MPL libraries for arm uses gcc 4.7.2 compiler. armSTM32F4_MD6 : Directory which contains the IAR project for STM32F4 Discovery Evaluation Board and the InvenSense motion solution. The STM32F4 is a Cortex-M4 MCU core. The IAR project file is
10、located under .STM3F4L_MD6ProjectseMD6EWARMSTM32F4_MD6.eww armSTM32L_MD6 : Directory which contains the IAR project for STM32L Discovery Evaluation Board and the InvenSense motion solution. The IAR project file is located under .STM32L_MD6ProjectseMD6EWARMSTM32L_MD6.eww .documentation : All relevant
11、 documentations regarding MD6 is under this directory eMPL-pythonclient : Python client used to test and demonstrate the motion device performance as well as display log information mpl libraries : Directory which contains the InvenSense Proprietary binary MPL (Motion Processing Library) used in the
12、 MD6.0. ARM libraries are compiled using GCC 4.7.2 while the TI libraries are using Code Composer 5.5 msp430eMD-6.0 : Contains the Code Composer project for MD6.0. Motion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETA
13、RY 5 of 16 PRELIMINARY 4 Starting with the TI-MSP430 Project 4.1 Requirements o Code Composer Studio to compile MSP430 example o TI-MSP430 JTAG for downloading and debugging o Motion Driver 6.0 source files o InvenSense CA-SDK evaluation board (can be purchased through ) 4.2 Connecting the Hardware
14、InvenSense CA-SDK evaluation board Micro-USB Connect to PC for power and CA-SDK output TI-MSP430 JTAG connect to PC with Code Composer Software and also to the CA-SDK. Motion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPR
15、IETARY 6 of 16 PRELIMINARY 4.3 Opening and Compiling the MSP430 Project Select import under the file menu. Choose existing CCS eclipse project. Click the browse button to select the Motion Driver folder. Open the Motion Driver project by clicking finish. Motion Driver 6.0 Getting Started Guide Docum
16、ent Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 7 of 16 PRELIMINARY Select the Project pull-down menu and Build All to compile the project With the JTAG and CA-SDK hardware connected download the firmware by selecting the Run pull down menu and Debug Mot
17、ion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 8 of 16 PRELIMINARY You can then run the firmware through the debugger or turn off and on the CA-SDK to run off flash. 5 STM32L (Cortex-M3) Discovery Board Project
18、5.1 Requirements IAR ARM Workbench Compiler STM32L Discovery Evaluation Board (purchasable through DigiKey, Mouser, etc) Motion Driver 6.0 source files InvenSense evaluation boards for MPU6050 or MPU6500 or MPU9150 or MPU9250 Motion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS-0.0.6 R
19、evision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 9 of 16 PRELIMINARY 5.2 Connecting the Hardware InvenSense Eval Board connection to Discovery Board The connection from the InvenSense eval board to the discovery board will require wiring between the two PCB boards. The InvenSense eva
20、l board pin outs are similar InvenSense Eval Board STM43L Discovery Board USB connect to PC for power and debugging UART output Motion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 10 of 16 PRELIMINARY To connect t
21、o the Discovery Board you will need to connect these 5 pins EVB Header Pin Number Description Discovery Board GPIO Pin Number 3 INT output PA1 13 GND GND 19 VCC_IN EXT_3V 16 IC SCL PB10 18 IC SDA PB11 Discovery Board UART Output The MD6.0 outputs via data via its UART1 pins. The data is used by the
22、python client to display information for the user. The pins are Discovery Board UART Out Pin Number Description PA9 UART Tx PA10 UART Rx You will need to use a UART convertor to the PC. There are several UART to Serial or UART to USB convertors available. 5.3 Opening and Compiling the IAR Project Do
23、uble click on the IAR ARM project file to automatically open the workspace in IAR ARM compiler. Project file is under the directory /STM32L_MD6/Projects/eMD6/EWARM/STM32L_MD6.eww Motion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENT
24、IAL & PROPRIETARY 11 of 16 PRELIMINARY Select the Project pull down menu and Rebuild All Motion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 12 of 16 PRELIMINARY With the hardware connected, hit the Download and D
25、ebug ICON 6 STM32F4 (Cortex-M4) Discovery Board Project The STM32F4 (Cortex-M4) port is similar to the STM32L port with the following differences Project compiled for STM32F4-Discovery Board using board support files for the STM32F407VG. The Discovery Board is purchasable through the usual distribut
26、ion channels Motion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 13 of 16 PRELIMINARY MPL library compiled in arm gcc compiler 4.7.2 but with Cortex-M4 specific settings for better optimization. It can still work
27、with the MPL library for generic ARM core. UART output from STM32F-Discovery Board Discovery Board UART Out Pin Number Description PA2 UART Tx PA3 UART Rx Most of the software is the same except for the system and board related files. 7 Python Client A python client is included with the release pack
28、age to test the performance and display log information. The client can be found in the release package under the directory eMPL-pythonclient The python client also accepts user input and provides the input the sample HAL Application. The user would be able to enable/disable sensors, enable computat
29、ion algorithms, enable hardware features, and view log information. You would need to install Python (version 2.5 and above), pyserial and pygame for the python script to execute. Motion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDEN
30、TIAL & PROPRIETARY 14 of 16 PRELIMINARY Installing Python 2.7 (32-bits version) or above, pyserial, and pygame Python: https:/www.python.org/downloads/ Pyserial: https:/pypi.python.org/pypi/pyserial Pygame: http:/www.pygame.org/download.shtml Connect your flashed and working hardware to your PC and
31、find the COM port in the device manager if the connected device Start the python client by opening up a command prompt window and browse to the python client directly and enter the following command o python eMPL-client.py Motion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS-0.0.6 Revi
32、sion: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 15 of 16 PRELIMINARY 2 Windows will pop one. 1 contains a 3D Cube which corresponds with the quaternion angles outputted from the device. The other window will display any related logs or data Motion Driver 6.0 can accept input commands a
33、nd display various different data. You must first make sure the cube window is the focused window then type in the input command. For TI-MSP430 you must first type inv then the command. For IAR project you only need to type the command only. Commands l, s, and x are for MSP430 only. o 8 : Toggles Ac
34、cel Sensor o 9 : Toggles Gyro Sensor o 0 : Toggles Compass Sensor o a : Prints Accel Data o g : Prints Gyro Data o c : Prints Compass Data o e : Prints Eular Data in radius o r : Prints Rotational Matrix Data o q : Prints Quaternions Motion Driver 6.0 Getting Started Guide Document Number: AN-EMAPPS
35、-0.0.6 Revision: 1.0 Release Date: 07/17/2014 CONFIDENTIAL & PROPRIETARY 16 of 16 PRELIMINARY o h : Prints Heading Data in degrees o i : Prints Linear Acceleration data o w : Get compass accuracy and status o d : Register Dump o p : Turn on Low Power Accel Mode at 20Hz sampling o l : Load calibratio
36、n data from flash memory o s : Save calibration data to flash memory o t : run factory self test and calibration routine o 1 : Change sensor output data rate to 10Hz o 2 : Change sensor output data rate to 20Hz o 3 : Change sensor output data rate to 40Hz o 4 : Change sensor output data rate to 50Hz
37、 o 5 : Change sensor output data rate to 100Hz o , : set interrupts to DMP gestures only o . : set interrupts to DMP data ready o 6 : Print Pedometer data o 7 : Reset Pedometer data o f : Toggle DMP on/off o m : Enter Low Power Interrupt Mode o x : Reset the MSP430 o v : Toggle DMP Low Power Quatern
38、ion Generation InvenSense Inc. 1197 Borregas Ave., Sunnyvale, CA 94089 U.S.A. Tel: +1 (408) 988-7339 Fax: +1 (408) 988-8104 Website: Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 06/27/2014 CONFIDENTIAL & PROPRIETARY PRELIMINARY Motion Driver 6.0 Features User Guide Motion Driver 6.0
39、 Features User Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 06/27/2014 CONFIDENTIAL & PROPRIETARY 2 of 6 PRELIMINARY Table of Contents 1 REVISION HISTORY . 3 2 PURPOSE 4 3 BEFORE YOU START 4 4 THE DMP FEATURES . 4 5 THE MPL 5 6 MPU HARDWARE FEATURES 6 Motion Driver 6.0 Features
40、 User Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0 Release Date: 06/27/2014 CONFIDENTIAL & PROPRIETARY 3 of 6 PRELIMINARY 1 Revision History Revision Date Revision Description 06/27/2014 1.0 Initial Release Motion Driver 6.0 Features User Guide Document Number: AN-EMAPPS-0.0.6 Revision: 1.0
41、Release Date: 06/27/2014 CONFIDENTIAL & PROPRIETARY 4 of 6 PRELIMINARY 2 Purpose Motion Driver is an embedded software stack of the sensor driver layer that easily configures and leverages many of the features of the InvenSense motion tracking solutions. The motion devices supported are MPU6050/MPU6
42、500/MPU9150/MPU9250. Many of the features of the hardware and the on board Digital Motion Processor (DMP) are encapsulated into modular APIs which can be used and referenced. Motion Driver is designed as a solution which can be easily ported to most MCUs. With the release of the Motion Driver 6.0 it
43、 includes a 9-axis solution for ARM MCUs and the TI-MSP430. 6-axis only solutions should continue to reference the Motion Driver 5.1.2 for easier understanding of the software. This document details the various features of MD6. It will go into details on the Motion Processor Library algorithm (MPL),
44、 the Digital Motion Processor features (DMP), and the MPU hardware capabilities. 3 Before you start Please read the Motion Driver 6.0 Getting Started Guide. It is recommended that customers bring up the Motion Driver 6.0 on one of the ported platforms (TI-MSP430 or IAR for ARM) so they can immediate
45、ly see the features. 4 The DMP features The DMP is a fast, low power, programmable, embedded lightweight processor in the MPU devices. It is design to offload functionality, like sensor fusion and gesture recognition, from the MCU to save overall power in the system. The DMP has many features which
46、can be dynamically turned off and on at run-time. Individual feature can also be disabled while leaving others running. All DMP data is outputted to the FIFO except for pedometer. The DMP can also be programmed to generate an interrupt via gesture or if data ready. For details on flashing and enabli
47、ng the DMP please read the porting guide. 3 Axis Low Power Quaternions gyro only quaternions. This feature when enabled will integrate the gyro data at 200Hz while outputting the sensor fusion data to the FIFO at the user requested rate. The 200Hz integration will allow for more accurate sensor fusi
48、on data. In MD6, if this feature is enabled, the driver will push the 3-axis quaternion into the MPL library and the MPL will handle the accel and compass integrations. 6 Axis Low Power Quaternions gyro and accel quaternions. Similar to the 3-axis LPQ, integrates the accel and gyro at 200Hz sampling rates will outputting to the FIFO at the user requested rates. The 3-axis LPQ and 6-axis LPQ are mutually exclusive and should not be run concurrently. If enabled the 6-axis quaternions can be pushed into the MPL library and the MPL will handle the compass integration for 9-axis. O