Freescale Sensor Fusion For Kinetis Product Development Kit User Guide
Freescale Sensor Fusion For Kinetis Product Development Kit User Guide
Contents
Sensor fusion is a process by which data from several different 2 Quick Start Guides....................................................9
sensors are “fused” to compute something more than could be 3 Project Details........................... ............................. 18
determined by any one sensor alone. An example is computing
the orientation of a device in three dimensional space. That 4 Software Tasks........................................................ 23
data is then used to alter the perspective presented by a 3-D 5 Adding Support for a New PCB............ ................. 27
GUI or game.
6 Bluetooth Packet Structure.............. ....................... 31
The Freescale Sensor Fusion Library for Kinetis MCUs (also
referred to as Fusion Library or development kit) provides 7 Odds and Ends.............................. ..........................35
advanced functions for computation of device orientation, 8 Revision History......................... ............................ 36
linear acceleration, gyro offset and magnetic interference
based on the outputs of Freescale inertial and magnetic A Appendix A................................. ............................36
sensors.
The development kit now includes:
• Full source code for the sensor fusion libraries
• Prepackaged implementations targeted at specific
Freedom development platforms.
• Support for CodeWarrior and Kinetis Design Studio
• Full documentation including user manual and fusion
data sheet
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 SHALL
FREESCALE SEMICONDUCTOR, INC. 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.
This product provides access to source code for all functions. The software features include:
• Fusion and magnetic calibration algorithms are pre-compiled as a linkable library
• Programmable sensor sample rate (Default= 200 Hz)
• Programmable sensor fusion rate (Default = 200 Hz)
• Supported frames of reference include NED, Android and Windows 8.
• No procedural interface to learn.
• Write sensor readings into one set of global structures
• Read fusion results from a different set of global structures
• Ability to compile and link any combination of four standard algorithms
• Accelerometer only (tilt)
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
2 Freescale Semiconductor, Inc.
Introduction
1.4 Requirements
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 3
Introduction
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
4 Freescale Semiconductor, Inc.
Introduction
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 5
Introduction
All three are built from the same PCB design and differ only in the number of parts on the board. The Fusion Library works
with any of the three boards, but the FRDM-FXS-MULTI-B is the only one that supports Bluetooth communications to the
Freescale Sensor Fusion Toolbox for Android.
Key components of the FRDM-FXS-MULTI-B are identified in Figure 6.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
6 Freescale Semiconductor, Inc.
Introduction
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 7
Introduction
1. See Table 1 for UART portability issues on the K20D50M and K64F boards.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
8 Freescale Semiconductor, Inc.
Quick Start Guides
1.4.4 CodeWarrior
CodeWarrior 10.6 or above must be used to build these applications. CodeWarrior can be downloaded from Freescale at CW-
MCU10 CodeWarrior for MCUs.
Sensor and fusion results are simply read from predefined structures.
The development kit provides access to drivers, hardware abstraction layers, communications interfaces, and more. Although
this guide provides a convenient place to start, the user is not limited to only the configurability that is described. Details of
complete configurability can be found in later sections of this guide.
The process to upgrade the K64F Version 2 OpenSDA (MBED) boot loader is described at mbed.org/handbook/
Firmware-FRDM-K64F.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 9
Quick Start Guides
a. Hold down the Reset button (located in box #2 above) and then power the board by connecting a powered USB
cord to the USB port (located in box #1 above). The LED will blink (located in box #3 above), indicating that the
board is now in boot loader mode. Release the Reset button at this point.
b. Open Windows Explorer and locate the BOOTLOADER thumb drive.
c. If necessary, extract the DEBUG-APP-Vxxx.SDA file from the
Pemicro_OpenSDA_Debug_MSD_Update_Apps_yyyy_mm_dd.zip file.
d. Drag the DEBUG-APP-Vxxx.SDA file onto the thumb drive (any application or firmware file can be drag-and-
dropped onto the device at this point).
e. Unplug the USB cable from the board then plug it back in. The Freedom Development Platform is now updated
to the latest firmware or application.
3. Start the installer and then follow the instructions in the installation wizard.
NOTE
The user can choose to install CodeWarrior, Kinetis Design Studio, or both sets of
template projects.
approximations.c
approximations.h
build.h
drivers.c
drivers.h
Events.c
Events.h
files.txt
fusion.c
fusion.h
include_all.h
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
10 Freescale Semiconductor, Inc.
Quick Start Guides
magnetic.c
magnetic.h
main.c
matrix.c
matrix.h
mqx_tasks.c
mqx_tasks.h
orientation.c
orientation.h
tasks.c
tasks.h
user_tasks.c
user_tasks.h
NOTE
The contents of the Sources directory is identical regardless of which board is
targeted. Hardware specific customizations are done in Processor Expert. That
code will go into the Generated_Code and MQXLITE directories.
3. Open CodeWarrior and in the Workspace Launcher dialog, see Figure 9, choose the workspace where the product
development project is located.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 11
Quick Start Guides
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
12 Freescale Semiconductor, Inc.
Quick Start Guides
6. By default, all Freedom Development Platforms projects are configured to be used with the FRDM-FXS-MULTI-B
sensor board. When using FRDM-K20D50M or FRDM-K64F with the FRDM-FXS-MULTI board, the Processor
Expert UART configuration for the project should be changed. The UART assignment for different combinations of
Freedom Development Platform type and sensor board is shown in Table 2. You need to make this change whenever
you use the UART/USB wired interface, even with the MULTI-B board.
a. To change the UART assignment in Processor Expert, in the CodeWarrior Projects tab, select the appropriate
project name for the board you are using. See Figure 12.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 13
Quick Start Guides
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
14 Freescale Semiconductor, Inc.
Quick Start Guides
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 15
Quick Start Guides
2.1.4 Limitations
Sensors supported using the development kit out-of-the box include FXOS8700CQ 6-axis accelerometer/magnetometer
combination sensor and the FXAS21000 gyroscope. Kalman filters are tuned for specific sensors. Alternate sensor
combinations are available, and more can easily be added by making the appropriate additions to drivers.c/.h and build.h.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
16 Freescale Semiconductor, Inc.
Quick Start Guides
1. For a MULTI-B board, be sure to either remove jumper J7 , when using a wired connection, OR pair the device with
your PC's Bluetooth adapter. Step 1, above requirement applies only to the wired interface.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 17
Project Details
3 Project Details
This section discusses implementation details for the template programs for Freescale Kinetis microcontrollers. These
leverage the MQXLITE RTOS and device drivers generated via the Processor Expert code generation tool.
NOTE
For users who are planning to employ a different RTOS, the functions in this table make
good interface points for the new RTOS.
These functions are called from the MQX task definitions, and provide a very high level interface to the fusion library.
In both cases, the low level functions can be thought of as the “sensor drivers”. The Init functions perform any one-time
initialization required by the sensors. The Read functions are responsible for reading sensor values and then populating those
to global structures for use by the fusion routines.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
18 Freescale Semiconductor, Inc.
Project Details
Full source code is provided for all layers of software, allowing the user to customize as necessary for your board design.
Inspect the source code in drivers.c to determine if other sensor drivers are available in the release.
UART2 On-BlockReeceived
magnetic calibration
embedded
and
application
sensor fusion
algorithms UART SendData()
}
tasks.c * FXOS8700_Init
* FXAS21000_Init
* FXOS8700_ReadData
* FXAS21000_ReadData
These are defined in drivers.c
Accel Gyro Mag
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 19
Project Details
The library is precompiled with all four options above enabled. This allows ready comparison of the different options in real
time. Disabling an option is as easy as commenting out the appropriate #define in build.h.
Global data structures are allocated as follows in source file tasks.c in response to the build options above. Key structure
pointers are shown in the table below.
Table 4. Global Structures
Pointer Function Structure Name Structure Type Defined in Include File
Accelerometer thisAccel AccelSensor build.h
Magnetometer thisMag MagSensor
Gyroscope thisGyro GyroSensor
3-axis results thisSV_3DOF_G_BASIC SV_3DOF_G_BASIC tasks.h
eCompass results thisSV_6DOF_GB_BASIC SB_6DOF_GB_BASIC
accel+gyro results thisSV_6DOF_GY_KALMAN SV_6DOF_GY_KALMAN
9-axis results thisSV_9DOF_GBY_KALMAN SV_9DOF_GBY_KALMAN
3.4.1 Accelerometer
Accelerometer values are stored as int16. Multiply by thisAccel->fgPerCount to convert to gravities.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
20 Freescale Semiconductor, Inc.
Project Details
3.4.2 Gyroscope
Gyroscope values are stored as int16. Multiply by thisGyro->fDegPerSecPerCount to convert to degrees/second.
3.4.3 Magnetometer
Magnetometer values are stored as int16. Multiply by thisMag->fCountsPeruT to convert to μTs. Both raw and calibrated
magnetometer outputs are available. Scaling is the same for both.
thisSV_3DOF_G_BASIC // OR
thisSV_6DOF_GB_BASIC // OR
thisSV_6DOF_GY_KALMAN // OR
thisSV_9DOF_GBY_KALMAN
Structures within tasks.h may be re-arranged in future versions of the library. Index directly to the data you need using the
pointer names in Table 5.
Table 5 Fusion Algorithm Options correspond to the following:
• G = SV_3DOF_G_BASIC (accel only)
• GB = SV_6DOF_GB_BASIC (accel + mag eCompass)
• GY = accel + gyro Kalman
• GBY = 9-axis Kalman
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 21
Project Details
//fq = thisSV_3DOF_G_BASIC.fLPq; // OR
//fq = thisSV_6DOF_GB_BASIC.fLPq; // OR
//fq = thisSV_6DOF_GY_KALMAN.fqPl; // OR
fq = thisSV_9DOF_GBY_KALMAN.fqPl;
q0 = fq.q0;
q1 = fq.q1;
q2 = fq.q2;
q3 = fq.q3;
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
22 Freescale Semiconductor, Inc.
Software Tasks
4 Software Tasks
Kinetis template programs for Sensor Fusion Library are partitioned into three software tasks.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 23
Software Tasks
The accelerometer, magnetometer, and gyro sensors operate asynchronously to the RTOS. Typically, the sensors are
configured to run freely at a nominal output data rate of 200 Hz and are polled by the Sampling task at 200 Hz.
Figure 20 illustrates the basic structure of the three real-time tasks used by the fusion library and the hierarchical scheduling
of the software tasks.
FTM0:
12 MHz Bus Clock
SENSORFS=200 Hz
UserStartup()
Fusion FUSION_TASK
Fusion_Init();
UserMediumFrequencyTaskInit()
25 Hz Software Event
(RunKFEventStruct)
Hardware specific
Fusion_Run();
UserMediumFrequencyTaskRun()
Hardware Independent
Calibration MAGCAL_TASK
Events ResetMagCalibration();
MagCal_Run();
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
24 Freescale Semiconductor, Inc.
Software Tasks
5 ms
40 ms
FXOS8700 Output (200 Hz)
FXAS21000 Output (200 Hz)
Sensor Sampling Task (200 Hz)
Sensor Fusion Task (200 Hz)
Magnetic Calibration Task
4.3 user_tasks.c
The CodeWarrior and KDS template projects successfully build in their as-shipped configurations. However, additional
functionality may be supplemented by adding code in the file user_tasks.c (see code listing below) wherever //
PUT YOUR CODE HERE appears. After adding the code, the updated application can be built and downloaded to the
development board.
If using the product development version, the file user_tasks.c can be considered redundant and may be removed by the
developer if desired. Be sure to remove all calls to affected functions before deleting the file.
*
* (C) Freescale Semiconductor, Inc.
* user_tasks.c
*
* Created on: Sep 13, 2013
* Author: Michael Stanley
*/
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 25
Software Tasks
#include "Cpu.h"
#include "Events.h"
#include "mqx_tasks.h"
#include "UART2.h"
#include "include_all.h"
void UserStartup(void)
{
// The following UART function call initializes Bluetooth communications used by the
// Freescale Sensor Fusion Toolbox. If the developer is not using the toolbox,
// these can be removed.
//
// initialize BlueRadios Bluetooth module
BlueRadios_Init(UART2_DeviceData);
// put code here to be executed at the end of the RTOS startup sequence.
//
// PUT YOUR CODE HERE
//
return;
}
void UserHighFrequencyTaskInit(void)
{
// User code to be executed ONE TIME the first time the high frequency task is run.
//
// PUT YOUR CODE HERE
//
return;
}
void UserMediumFrequencyTaskInit(void)
{
// User code to be executed ONE TIME the first time the medium frequency task is run
//
// PUT YOUR CODE HERE
//
return;
}
void UserHighFrequencyTaskRun(void)
{
// The default frequency at which this code runs is 200Hz.
// This code runs after sensors are sampled.
// In general, try to keep "high intensity" code out of UserHighFrequencyTaskRun.
// The high frequency task also has highest priority.
//
// PUT YOUR CODE HERE
//
return;
}
void UserMediumFrequencyTaskRun(void)
{
// This code runs after the Kalman filter loop
// The default frequency at which this code runs is 25Hz.
// The following UART function constructs and sends Bluetooth packets used by the
// Freescale Sensor Fusion Toolbox. If the developer is not using the toolbox,
// it can be removed.
// transmit orientation over the radio link
CreateAndSendBluetoothPacketsViaUART(UART2_DeviceData);
//
// PUT YOUR CODE HERE
//
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
26 Freescale Semiconductor, Inc.
Adding Support for a New PCB
return;
}
// [5 in practice but can be variable]: add the tail byte for the debug packet type 2
sUARTOutputBuf[iIndex++] = 0x7E;
NOTE
UART/Bluetooth communications are included for ease of use, but they are NOT
considered part of the Fusion Library. This portion of the library should be treated as
example code which may be changed in future versions of the library. In this section it is
presumed that the user is adapting one of the Freescale Fusion Library template projects
to a similar Kinetis-based board, also using MQXLITE. Ports to other (possibly non-
Freescale) MCUs will require the user to write their own sensor drivers and supply their
own RTOS layers. Regardless of the MCU/RTOS used, Freescale recommends the user
adopt the task structure and outlined in Tasks Structure. The functions discussed in that
section provide the cleanest point at which to interface to different hardware/RTOS
architectures.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 27
Adding Support for a New PCB
If the user's project utilizes the same default peripherals and sensors defined in earlier sections, they will probably not need to
make any changes to 1-3 above. If you use a different communications mechanism or packet structure, item 4 will need to be
replaced.
mqx_tasks.c
This file contains:
• Main_task(): Basic initialization of events, timers and peripherals
• RdSensData_task(): High frequency sensor sampling
• Fusion_task(): Top level control loop for sensor fusion
• MagCal_task(): Low frequency task for magnetic calibration
2. If the user is employing non-Kinetis MCUs, this file will probably need to be completely reworked.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
28 Freescale Semiconductor, Inc.
Adding Support for a New PCB
If the user's project needs additional MQX-Lite tasks, in this file, modify Main_task() to initialize them at startup. Several
GPIOs have been pre-allocated for LED control within mqx_tasks.c. The user will need to remove or modify those references
if those resources are not available in the project.
tasks.c
Each sensor PCB will have a different layout of the accelerometer, magnetometer and gyro sensors, which will require
alignment in the Hardware Abstraction Layer (HAL) software.
The function ApplyHAL() in the source file tasks.c contains the HAL sensor alignment code for supported PCBs and the
three supported coordinate systems. The existing software, shown below for one permutation, should be used as a template
for the alignment in the new PCB. Detailed instructions on this subject will be presented in an upcoming application note.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 29
Adding Support for a New PCB
#ifdef K20D50M
#define THIS_BOARD_ID BOARD_FRDM_K20D50M
#endif
#ifdef FXLC95000CL
#define THIS_BOARD_ID BOARD_FRDM_FXLC95000CL
#endif
#ifdef KL26Z
#define THIS_BOARD_ID BOARD_FRDM_KL26Z
#endif
#ifdef K64F
#define THIS_BOARD_ID BOARD_FRDM_K64F
#endif
#ifdef KL16Z
#define THIS_BOARD_ID BOARD_FRDM_KL16Z
#endif
#ifdef KL46Z
#define THIS_BOARD_ID BOARD_FRDM_KL46Z
#endif
#ifdef KL46Z_STANDALONE
#define THIS_BOARD_ID BOARD_FRDM_KL46Z_STANDALONE
#endif
Coordinate System
The coordinate system to be used is set by THISCOORDSYSTEM with valid values being NED, ANDROID, and WIN8.
The quaternion representing the orientation transmitted to the Freescale Sensor Fusion Toolbox for Android is the same for
all three coordinate systems, but the Euler angles and sensor values are different.
Orientation Models
The software is capable of running the 3-axis (accelerometer only), 6-axis (accelerometer and magnetometer eCompass) and
9-axis (accelerometer, magnetometer and gyro sensors) in parallel. The default setting computes the 6-axis and 9-axis
orientation because the Bluetooth interface transmits the 6-axis and 9-axis orientation, but not the 3-axis orientation
quaternion, to the Android tablet for display. For a pure 9-axis application, define only COMPUTE_9DOF_GBY_KALMAN in the
list below.
main.c
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
30 Freescale Semiconductor, Inc.
Bluetooth Packet Structure
This file contains the application's main() function which performs microcontroller initialization and starts the MQX Lite
operating system. This function should be replaced with equivalent processor initialization and operating startup code if
either is changed.
The debug mode is now required to be always on, since this packet transmits the firmware version number that is displayed
by the Toolbox. Additionally, a packet may be sent to change quaternion type whenever the Source/Algorithm selector in the
Sensor Fusion Toolbox is changed.
The Fusion Toolbox does the inverse mapping as the data stream is received. Partial packets are discarded. The options menu
has a Toggle Hex Display option available for developers coding their own board interface.
On the embedded app side, the 0x7E and 0x7D encoding is performed automatically by function sBufAppendItem(),
which is used to create outgoing packet structures. The developer only needs to explicitly add starting and ending 0x7E
delimiters.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 31
Bluetooth Packet Structure
Table 8 represents the packet format adopted by the Fusion Toolbox on 1 August 2013. The assumption inherent in this
format is that the application will instruct the development board with regard to desired algorithm.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
32 Freescale Semiconductor, Inc.
Bluetooth Packet Structure
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 33
Bluetooth Packet Structure
3. The debug packet must be enabled for firmware version number and sysTick counts to be properly displayed by the
Toolbox.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
34 Freescale Semiconductor, Inc.
Odds and Ends
• Q9## = transmit 9-axis quaternion in standard packet (default) (transmitted when "Remote 9axis" is selected on the
Source/Algorithms spinner)
• RPC+ = Roll/Pitch/Compass packet on
• RPC- = Roll/Pitch/Compass packet off (default)
• RST# = Sensor Fusion soft reset (resets all sensor fusion data structures)
• VG+# = Virtual gyro packet on
• VG-# = Virtual gyro packet off (default)
Note that the commands above can request that the embedded board perform computations in a specific way. Where
applicable, the Flags field of Packet type 1, Table 8, should be checked to confirm that the proper operation has taken place.
7.1 ANSI C
The Sensor Fusion Library software is written according to the ANSI C90 standard and does not use any of the ANSI C99 or
C11 extensions.
Integers are a mixture of standard C long (four byte) integers with typedef as int32 and C short (2 byte) integers with typedef
as int16. Floating point variables are all single precision of size four bytes.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 35
Revision History
Conditions that lead to inaccurate results are detected and the results computed using an alternative algorithm suitable for
those cases where the primary algorithm fails. An example is the calculation of the orientation quaternion from a rotation
matrix where the primary algorithm differencing elements across the diagonal approaches a 0/0 calculation. The alternative
algorithm used near 180 degree rotations operates on the matrix diagonal elements instead.
The sensor fusion algorithms have been tested to be stable for tens of millions of 200 Hz iterations. Accumulation of
rounding errors in the rotation quaternions or matrices is prevented by regular renormalization.
8 Revision History
Revision Revision
Description
number date
0 02/2014 Initial version
1 04/2014 Updated license scheme documentation. Demo and (new board-specific) Production licenses
explained.
Quick start instructions for software installation via the installer added.
The software revision includes many enhancements - the major ones are as follows:
1. Added MPL3115 I2C driver. I2C driver for MPL3115 now detects whether MPL3115 is
present so as to support the 9 axis board
2. Debug packet (Type 2) transmits firmware build in place of padding byte
3. Added Altitude / Temperature packet
4. Added Kalman packet
5. Added Magnetics packet
6. Added FXAS21002 driver and sensor option
7. Support for Sequential/Parallel algorithm
8. RST command implemented
9. Code and comments cleaned up and made clearer throughout
10. ALT+/ALT- commands added to support Altitude packet
11. Global variable definitions are now consolidated into two structs named globals and
mqxglobals.
1.1 05/2014 Updated documentation for additional board support of FRDM-K64F.
Added instructions for UART selection based on the MULTI board being used.
1.2 09/2014 1. Removed all references to license checks
2. The fusion library is now open source
3. Added KL46Z support
4. Added KDS support
Appendix A Appendix A
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
36 Freescale Semiconductor, Inc.
Creating a Run Configuration for OpenSDA 1.0 boards
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 37
Creating a Run Configuration for OpenSDA 1.0 boards
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
38 Freescale Semiconductor, Inc.
Creating a Run Configuration for OpenSDA 1.0 boards
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 39
Creating a Run Configuration for OpenSDA 1.0 boards
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
40 Freescale Semiconductor, Inc.
Creating a Run Configuration for OpenSDA 1.0 boards
9. Configure the New Connection dialog as shown in Figure A-7. (If you have a K20D50M board, change KL25Z to
K50D50M) and then click the Finish button. The focus will return to the Run Configuration dialog.
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 41
Creating a Run Configuration for OpenSDA 1.0 boards
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
42 Freescale Semiconductor, Inc.
Creating Run Configuration for Segger OpenSDA
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 43
Creating Run Configuration for Segger OpenSDA
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
44 Freescale Semiconductor, Inc.
Figure A-10. Segger OpenSDA Debug Configuration
Freescale Sensor Fusion for Kinetis Product Development Kit User Guide, Rev 1.2, 9/2014
Freescale Semiconductor, Inc. 45
How to Reach Us: Information in this document is provided solely to enable system and
software implementers to use Freescale products. There are no express
Home Page:
or implied copyright licenses granted hereunder to design or fabricate
freescale.com
any integrated circuits based on the information in this document.
Web Support: Freescale reserves the right to make changes without further notice to
freescale.com/support any products herein.
Freescale makes no warranty, representation, or guarantee regarding
the suitability of its products for any particular purpose, nor does
Freescale assume any liability arising out of the application or use of
any product or circuit, and specifically disclaims any and all liability,
including without limitation consequential or incidental damages.
“Typical” parameters that may be provided in Freescale data sheets
and/or specifications can and do vary in different applications, and
actual performance may vary over time. All operating parameters,
including “typicals,” must be validated for each customer application by
customer's technical experts. Freescale does not convey any license
under its patent rights nor the rights of others. Freescale sells products
pursuant to standard terms and conditions of sale, which can be found
at the following address: freescale.com/SalesTermsandConditions.
Freescale, the Freescale logo, CodeWarrior, and Kinetis are trademarks
of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Freedom
Development Platform is a trademark of Freescale Semiconductor, Inc.
All other product or service names are the property of their respective
owners.
© 2014 Freescale Semiconductor, Inc.