Freescale Semiconductor DATA SHEET: PRODUCT PREVIEW Document Number: FSFLK_DS Rev. 0.7, 9/2015 Freescale Sensor Fusion Library for Kinetis MCUs Updated for Freescale Sensor Fusion Release 5.00 1 2 3 4 Contents Introduction .................................................................................................................................... 3 Functional Overview ...................................................................................................................... 6 2.1 Introduction ............................................................................................................................... 6 2.2 Accelerometer Only .................................................................................................................. 6 2.3 Accelerometer Plus Magnetometer ........................................................................................... 7 2.4 Accelerometer Plus Gyroscope ................................................................................................. 7 2.5 Accelerometer Plus Magnetometer Plus Gyroscope ................................................................. 7 Additional Support ......................................................................................................................... 8 3.1 Freescale Sensor Fusion Toolbox for Android .......................................................................... 9 3.2 Freescale Sensor Fusion Toolbox for Windows ........................................................................ 9 3.3 Terms and Acronyms .............................................................................................................. 11 3.4 References ............................................................................................................................. 12 Mechanical and Electrical Specifications ................................................................................... 12 4.1 General Considerations .......................................................................................................... 12 4.2 Hardware Platforms Used to Measure Performance ............................................................... 13 4.3 Simulation Environments ........................................................................................................ 16 4.4 Frame of Reference ................................................................................................................ 18 4.5 Electrical Specifications .......................................................................................................... 18 4.6 Computation Metrics ............................................................................................................... 19 4.6.1 Statistics from Build #5.00 of the Sensor Fusion Library .................................................................. 19 4.7 Magnetic Calibration Metrics ................................................................................................... 20 4.7.1 Background ....................................................................................................................................... 20 4.7.2 The Magnetic Buffer.......................................................................................................................... 21 4.7.3 Magnetic Calibration Performance Metrics ....................................................................................... 22 4.8 Fusion Model Performance Metrics......................................................................................... 22 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 Background ....................................................................................................................................... 22 Gyro Offset Step Response .............................................................................................................. 23 Error in Computed Linear Acceleration............................................................................................. 24 Limitations Imposed via Sensor Choice/Configuration ..................................................................... 25 9-Axis Parametrics ............................................................................................................................ 26 6-axis Accelerometer + Magnetometer Parametrics ........................................................................ 27 (c) 2015 Freescale Semiconductor, Inc. 4.8.7 6-axis Accelerometer + Gyro Parametrics ........................................................................................ 27 4.8.8 3-axis Accelerometer Only Parametrics ........................................................................................... 28 5 Test Descriptions ......................................................................................................................... 28 5.1 MCU Current .......................................................................................................................... 28 5.1.1 Intent ................................................................................................................................................. 28 5.1.2 Procedure ......................................................................................................................................... 28 5.2 Flash and RAM Required ........................................................................................................ 29 5.2.1 Intent ................................................................................................................................................. 29 5.2.2 Procedure ......................................................................................................................................... 29 5.3 Fusion Loop Execution Time................................................................................................... 29 5.4 Compass Heading Linearity and Accuracy.............................................................................. 29 5.4.1 Intent ................................................................................................................................................. 29 5.4.2 Procedure ......................................................................................................................................... 30 5.5 Orientation Static Drift ............................................................................................................. 31 5.5.1 Intent ................................................................................................................................................. 31 5.5.2 Procedure ......................................................................................................................................... 31 5.6 Orientation Static Noise .......................................................................................................... 32 5.6.1 Intent ................................................................................................................................................. 32 5.6.2 Procedure ......................................................................................................................................... 32 5.7 Orientation Dynamic Drift ........................................................................................................ 32 5.7.1 Intent ................................................................................................................................................. 32 5.7.2 Procedure ......................................................................................................................................... 32 5.8 Maximum Angular Rate .......................................................................................................... 32 5.8.1 Intent ................................................................................................................................................. 32 5.8.2 Procedure ......................................................................................................................................... 32 5.9 Orientation Response Delay ................................................................................................... 33 5.9.1 Waveform Definitions ........................................................................................................................ 33 5.9.2 Intent ................................................................................................................................................. 33 5.9.3 Procedure ......................................................................................................................................... 33 5.10 Orientation Magnetic Immunity (Static Device)........................................................................ 34 5.10.1 Intent ................................................................................................................................................. 34 5.10.2 Procedure ......................................................................................................................................... 34 5.11 Orientation Magnetic Immunity (Moving Device) ..................................................................... 34 5.11.1 Intent ................................................................................................................................................. 34 5.11.2 Procedure ......................................................................................................................................... 34 5.12 Error in Computed Gyro Bias .................................................................................................. 34 5.12.1 Intent ................................................................................................................................................. 34 5.12.2 Procedure ......................................................................................................................................... 34 5.13 Gyro Offset Step Response .................................................................................................... 35 5.13.1 Intent ................................................................................................................................................. 35 5.13.2 Procedure ......................................................................................................................................... 35 5.14 Error in Computed Linear Acceleration ................................................................................... 35 5.14.1 Intent ................................................................................................................................................. 35 5.14.2 Procedure ......................................................................................................................................... 35 6 Revision history for XSFLK_DS .................................................................................................. 36 2 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. 1 Introduction Sensor Fusion is the process where data from several different sensors are fused to complete computations that a single sensor could not handle. An example of sensor fusion is computing the orientation of a device in 3-dimensional space using an accelerometer and magnetometer. That data might then be used to alter the perspective presented by a 3D GUI or game. The Freescale Sensor Fusion Library for Kinetis MCUs provides advanced functions for computation of device orientation, linear acceleration, gyroscope offset and magnetic interference based upon the outputs of Freescale inertial and magnetic sensors. Features * Supports: -- Accelerometer only (roll, pitch and tilt) -- Magnetometer only (2D auto) -- Gyro only -- Accelerometer plus magnetometer (eCompass) -- Accelerometer plus gyro (gaming) -- Accelerometer plus magnetometer plus gyroscope sensors * Includes Freescale's award-winning magnetic compensation software -- Provides geomagnetic field strength, hard- and soft-iron corrections, and quality-of-fit indication * Very low power consumption -- 3 mA 9-axis fusion IDD on Kinetis ARM(R) Cortex(R) M0+ devices at 25 Hz fusion rate/200 Hz sensor rate -- 0.6mA 9-axis fusion IDD on Kinetis ARM Cortex M4F devices at 25 Hz fusion rate/200 Hz sensor rate * Programmable sensor sample and fusion rates * Supports multiple 3D frames of reference (aerospace NED, Android and Windows 8) * Library is coded in standard C99 ANSI C * Compatible with the Freescale Sensor Fusion Toolbox for Android and Windows * Supported by Freescale CodeWarrior, Kinetis Design Studio and Processor Expert tools * Out-of-the box support for the following Freedom Development Platforms with FRDM-FXS-MULTx family of sensor boards -- Cortex M0+: FRDM-KL25Z / FRDM-KL26Z / FRDM-KL46Z -- Cortex M4: FRDM-K20D50M -- Cortex M4F: FRDM-K64F / FRDM-K22F (KDS only) * Library version 5.00 includes bonus bare-metal implementations for tilt and eCompass. Typical Applications * * * * Notebook, tablet and smartphone sensor fusion Gaming, motion control, head-mounted displays, wearable electronics Air mouse, remote control Navigation, eCompass, IoT (Internet of Things) sensor data management Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Introduction Table 1. Feature Comparison of the Freescale Sensor Fusion Algorithm Options Feature Filter type Accel only Mag only Gyro Only Accel + gyro Accel + mag 1 Accel + mag + gyro Low pass Low pass N/A Indirect Kalman Low pass Roll / Pitch / Tilt in degrees Yes No Yes Yes Yes Yes Yaw in degrees No Yes Yes No Yes Yes 2 Angular rate in degrees/second virtual 2 axis 3 Indirect Kalman Yaw only Yes Yes virtual 3 axis Yes Compass heading (magnetic north) in degrees No Yes No No Yes Yes Quarternion and rotation vector Yes Yaw only Yes 5 Yes Yes Yes Rotation matrix Yes Yaw only Yes 5 Yes Yes Yes Linear acceleration separate from gravity No No No Yes Yes 4 ENU (Windows 8 variant) frame of reference Yes 4 ENU (Android variant) frame of reference Yes 4 Magnetic calibration included N/A NED (North-East-Down) frame of reference No Yes Yes 4 Yes 4 Yes Yes Yes Yes 4 Yes 4 Yes Yes Yes Yes 4 Yes 4 Yes Yes Yes N/A N/A Yes Yes Yes Gyro offset calibration included N/A N/A No Yes N/A Yes FRDM-KL25Z board support Yes Yes Yes Yes Yes Yes FRDM-KL46Z board support Yes Yes Yes Yes Yes Yes FRDM-K20D50M board support Yes Yes Yes Yes Yes Yes FRDM-KL26Z board support Yes Yes Yes Yes Yes Yes FRDM-K64F board support Yes Yes Yes Yes Yes Yes FRDM-K22F board support 1. 2. 3. 4. 5. 4 KDS only More precisely: a non-linear modified exponential low pass quaternion SLERP filter. Angular rate for 6 and 9-axis configurations with a gyro include corrections for gyro offset. Subject to well-known limitation of being blind to rotation about axes aligned with gravity. These solutions do not include a magnetometer, therefore there is no sense of compass heading. Rotations for gyro-only solution are relative to sensor position (there is no global frame). Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Table 2. Feature Options Feature Options License CPU selection BSD 3-Clause MKL25Z128VLK4 MKL26Z128VLH4 MK20DX128VLH5 MKL46Z256VMC4 MK64FN1M0VLL12 MK22FN512VLH12 (KDS only) Board customizable Yes Sensor sample rate Programmable Fusion rate Programmable Frame of Reference Programmable Algorithms Executing Programmable Sleep mode enabled between samples/calculations No It can be added by user, but will interfere with UART operation RTOS MQX-Lite Code flexibility Full source code is provided. All files are can be modified. Access to Processor Expert Product Deliverables 1. 2. 3. Yes * This datasheet * Software user guide * Zip file containing both CodeWarrior and KDS projects Listed MCUs are those supported by included project templates. The fusion library should be portable to any ARM(R) processor without change. Ports to other architectures are expected to be very straightforward, as the library is written in standard C. FRDM-KL25Z, FRDM-KL26Z, FRDM-KL46Z, FRDM-K20D50M, FRDM-K64F and FRDM-K22F are supported out-of-the box and may be used as templates for other boards. The sensor fusion library was written assuming the MQXLite RTOS, but should be easily adaptable to other operating systems. See the "Freescale Sensor Fusion for Kinetis User Guide" for additional details. The sensor fusion library has also been incorporated into Freescale's Intelligent Sensing Framework (ISF). ISF 2.2 offers an RTOS abstraction that allows you to target alternate real time operating systems. The Freescale Sensor Fusion Toolbox includes bonus projects for 3-axis tilt and 6-axis eCompass running without an RTOS. Sensor shield boards are not needed for these configurations. This results in very low-cost demonstration platforms. The bonus projects are compatible with the Sensor Fusion Toolbox for Windows over USB connection. The FRDM-KL46Z eCompass version can also be used stand-alone since the compass heading is displayed directly on the FRDM-KL46Z LCD display. The bare-board eCompass projects have sensor sampling, sensor fusion and magnetic algorithms run as a single task at 25Hz. On power up, the green LED flashes slowly to indicate that the software is executing but that there is no magnetic calibration solution. The green LED then flashes rapidly to signal that the compass heading display is accurate and that a valid magnetic calibration has been obtained after rotating the Freedom development board. Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Functional Overview 2 Functional Overview 2.1 Introduction Sensor fusion encompasses a variety of techniques that: * Trade off strengths and weaknesses of the various sensors to compute something more than can be calculated using the individual components * Improve the quality and noise level of computed results by taking advantage of: -- Known data redundancies between sensors -- Knowledge of system transfer functions, dynamics and kinematics The Freescale Sensor Fusion Library for Kinetis (Fusion Library) supports several combinations of sensors. In general, performance improves as more sensors are added to the system. The primary function of the library is to compute orientation of a sensor subsystem relative to a global frame of reference. Orientation can be expressed in a number of different ways: * Tilt from vertical (may also be expressed as roll + pitch) * Compass heading (geomagnetic north) * Full 3D rotation from a global frame in any of the following forms: -- Rotation matrix -- Rotation vector (3D axis of rotation and rotation about that axis) -- Quaternion -- Euler angles (roll, pitch and yaw) For additional portability details and guidelines refer to the Freescale Sensor Fusion for Kinetis MCUs User Guide which is part of the Sensor Fusion Library installation. The Fusion Library is available in source code form and is designed to sit on top of board abstractions provided by Processor Expert and MQXLite. The C source and header files in the Sources directory of the project templates are board and MCU independent. Board dependencies are included as compile time options. If a particular board does not bring out the GPIO, I2C or UART needed, the board will not be compati compatible ble with the software and therefore will not be supported by Processor Expert. 2.2 Accelerometer Only An accelerometer measures linear acceleration minus gravity. If linear acceleration is zero, this sensor can be used to measure tilt from vertical, roll and p pitch. itch. Computation of yaw is not supported by this configuration. Figure 1. Accelerometer only block diagram 6 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. 2.3 Accelerometer Plus Magnetometer The accelerometer plus magnetometer configuration is often used as an electronic compass. The electronic compass is subject to the linear acceleration equals zero, assumption. Accuracy is dependent upon negligible magnetic interference from the environment in which the sensors travel. Figure 2. Accelerometer plus magnetometer block diagram 2.4 Accelerometer Plus Gyroscope Using a gyroscope in addition to an accelerometer yields the ability to smoothly measure rotation in 3D space, although the system can only yield orientation to some random horizontal global frame of reference. That is, the system has no sense of magnetic north. Computation of yaw is not supported by this configuration. This configuration is commonly known as an Inertial Measurement Unit (IMU). Figure 3. Accelerometer Plus Gyroscope Block Diagram 2.5 Accelerometer Plus Magnetometer Plus Gyroscope Sometimes referred to as Magnetic, Angular Rate and Gravity (MARG), this subsystem offers an optimal combination of sensors for smooth tracking of orientation and separation of gravity and linear acceleration. This system is capable of yielding absolute orientation data with respect to magnetic north. Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Additional Support Figure 4. Accelerometer Plus Magnetometer Plus Gyroscope Block Diagram 3 Additional Support Freescale Sensor Fusion Toolbox provides support for both Android and Windows operating systems. See Table for the differences between the two implementations. Table 3. Freescale Sensor Fusion Toolbox Features by Platform Feature Android PC Bluetooth wireless link Requires BT on PC (built-in or dongle) Ethernet wireless link On WiGo board only -- UART over USB -- OS requirements >=Android 4.0.3 >=Windows 7.0 Support for native sensors -- Device View Panorama View -- Statistics View -- Canvas View -- Orientation XY Plots -- Inertial XY Plots -- Magnetics -- Kalman -- Altimeter XY Plots -- Data Logging Integrated documentation 8 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Feature Availability Price Android PC Google Play Freescale website Free Free 3.1 Freescale Sensor Fusion Toolbox for Android The Fusion Library is supplied in the form of CodeWarrior projects for specific Freescale development boards. The basic function of the Sensor Fusion Android implementation are shown in Figure 5. These projects are compatible with the Freescale Sensor Fusion Toolbox for Android, which can be freely downloaded from Google Play. For download and training links, visit freescale.com/sensorfusion. Figure 5. Freescale Sensor Fusion Toolbox for Android Basic Functions 3.2 Freescale Sensor Fusion Toolbox for Windows The Sensor Fusion Toolbox includes an equivalent vversion ersion of the software for Windows. For download and training links, visit freescale.com/sensorfusion. Important Note: Version 5.0 of the Sensor Fusion Library has a modified Kalman packet structure as compared to that used in prior releases. Be sure you have downloaded the Windows toolbox built 3 Sept 2015 or later. Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Additional Support Figure 6 and Figure 7 are Sensor Fusion Toolbox screenshots of the Windows version. Figure 6. PC Version - Main Tab Figure 7. PC Version - Magnetics Tab 10 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. 3.3 Terms and Acronyms Term Definition DUT Device Under Test ENU A global frame of reference described by X = East, Y = North, Z = Up g gauss IMU abbreviation for gravities. 1 standard gravity = 9.80665 m/s2. Accelerometers are commonly trimmed using the local gravimetric field, which can vary by 1/2 percent depending upon altitude and latitude. CGS system unit for measuring magnetic field strength. 100 T = 1 gauss. Inertial Measurement Unit = accelerometer + gyro Kinetis Freescale family of ARM(R)-based MCUs MagCal Magnetic Calibration MARG Magnetic Angular Rate Gravity = IMU + magnetometer MCU microTesla Micro-Controller Unit The Tesla is the SI unit for measuring magnetic field strength. 1E-4 Tesla = 100 T = 1 gauss NED A global frame of reference described by X = North, Y = East, Z = Down pitch In the Aerospace/NED frame of reference, defined as a rotation about the Y-axis RHR Right Hand Rule--a standard convention for describing the positive/negative sense of rotations about an axis of rotation. See http://en.wikipedia.org/wiki/Right_hand_rule. roll RPY SI In the Aerospace/NED frame of reference, defined as a rotation about the X-axis Roll, Pitch, and Yaw. In the Aerospace/NED frame of reference these are defined as rotations about the X axis,Y axis, and Z axis International System of Units (meter, kilogram, second, ...) SLERP Spherical Linear intERPolation - See http://en.wikipedia.org/wiki/SLERP SysTick A feature of the ARM(R) processor; a clock timer which for the purposes of this discussion, 1 sysTick = 1 CPU clock cycle. tilt UART yaw Angle from vertical Universal Asynchronous Receiver / Transmitter, also known as SCI (Serial Communications Interface) In the Aerospace/NED frame of reference, defined as a rotation about the Z-axis Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Mechanical and Electrical Specifications 3.4 References 1. "Orientation Representations: Part 1" at http://blogs.freescale.com/iot/2012/10/orientationrepresentations-part-1/ community/the-embedded-beat/blog/2012/ 10/29/orientationrepresentations-part-1 2. "Orientation Representations: Part 2" at http://blogs.freescale.com/sensors/2013/01/orientationrepresentations-part-2/ community/the-embedded-beat/blog/2013/ 01/22/orientationrepresentations-part-2 3. "Hard and soft iron magnetic compensation explained" at http://blogs.freescale.com/sensors/2011/03/hard-and-soft-iron-magnetic-compensation-explained/ community.freescale.com/community/the-embeddedbeat/ blog/2011/03/14/hard- and-soft-ironmagnetic-compensation-explained 4. CodeWarrior Integrated Development Environment Software at freescale.com/codewarrior 5. Kinetis Design Studio Integrated Development Environment 6. "Euler Angles" at http://en.wikipedia.org/wiki/Euler_Angles 7. "Introduction to Random Signals and Applied Kalman Filtering", 3rd edition, by Robert Grover brown and Patrick Y.C. Hwang, John Wiley & Sons, 1997 8. "Quaternions and Rotation Sequences", Jack B. Kuipers, Princeton University Press, 1999 9. Freescale Freedom development platform home page at freescale.com/freedom 10. OpenSDA User's Guide, Freescale Semiconductor, Rev 0.93, 2012-09-18 11. PE micro Open SDA Support 12. PE micro Embedded OSBDM support 13. Matlab computer software by MathWorks--http://www.mathworks.com/products/ matlab/ 14. www.freescale.com/opensda 4 Mechanical and Electrical Specifications 4.1 General Considerations Fusion algorithms can be tuned to trade off one performance parameter versus another. Examples include: * Speedy handling of magnetic interference versus slower convergence to magnetic north * Smoothness versus responsiveness * Accuracy versus bandwidth NOTE All of the above means that there is no one correct configuration. Accordingly, this datasheet presents typical performance as observed on the sample projects supplied by Freescale on specific Freescale development platforms. No attempt has been made to measure a statistically significant number of boards. Measured values are typically those observed on as few as one board. 12 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. 4.2 Hardware Platforms Used to Measure Performance In the following subsections, some parametrics are measured, some represent simulated results. There are multiple methods used to determine parametrics. These make use of hardware platforms for benchmarking purposes, in addition to Matlab. Kinetis Cortex M0+ This configuration is composed of a Freescale KL25Z, KL46Z or KL26Z Freedom development platform paired with a FXS-MULT2-B Bluetooth-enabled sensor board1. Use of Bluetooth allows the board to be rotated freely, untethered by cords or power cables. Table 4. Cortex M0+ Test Configuration Component / Parameter Baseboard Value FRDM-KL25Z / FRDM-KL26Z / FRDM-KL-46Z Sensor Board FRDM-FXS-MULT2-B MCU Kinetis MKL25Z128VLK4 / MKL26Z128VLH4 / MKL46Z256VMC4 CPU ARM(R) Cortex M0+ CPU Clock 48 MHz Bus Clock 24 MHz Accelerometer FXOS8700CQ Magnetometer Gyroscope FXAS21000 Sensor Sampling Rate 200 Hz Fusion Rate 25 Hz Magnetic Calibration Rate Twice per minute once full calibration is reached This board combination is battery powered and nominally regulated to 3.3 V for use by the sensors in question. 1 The primary difference between the FRDM-FXS-MULTI-B and FRDM-FXS-MULT2-B is that the latter includes a production FXAS21002 gyroscope, whereas the former used FXAS21000 pre-production units. The FRDMFXS-MULTI-B board is no longer in production, but continues to be supported by the kit. The two boards are similar in appearance. Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Mechanical and Electrical Specifications Figure 8. FRDM-KL25Z / FRDM-FXS-MULTI-B sensor fusion prototype platform Figure 9. Expanded Diagram of FRDM-FXS-MULT2-B Sensor Board 14 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Kinetis Cortex M4 Table 5. Kinetis Cortex M4 Component / Parameter Value Baseboard FRDM-K20D50M Sensor Board FRDM-FXS-MULT2-B MCU Kinetis MK20DX128VLH5 CPU ARM(R) Cortex M4 CPU Clock 48 MHz Bus Clock 24 MHz Accelerometer FXOS8700CQ Magnetometer Gyroscope FXAS21000 Sensor Sampling Rate 200 Hz Fusion Rate 25 Hz Magnetic Calibration Rate Twice per minute once full calibration is reached This board combination is battery powered and nominally regulated to 3.3 V for use by the sensors in question. Physically, the FRDM-K20D50M / FRDM-FXS-MULT2- B board combination is similar to the KL25Z variant shown in Figure 8, with the exception that the bottom board is red. Kinetis Cortex M4 with FPU Table 6. Kinetis Cortex M4 with FPU Component / Parameter Value Baseboard FRDM-K64F / FRDM-K22F Sensor Board FRDM-FXS-MULT2-B MCU Kinetis MK64FN1M0VLL12 / MK22FN512VLH12 CPU ARM(R) Cortex M4 with FPU CPU Clock 120 MHz Bus Clock 60 MHz Accelerometer FXOS8700CQ Magnetometer Gyroscope FXAS21000 Sensor Sampling Rate 200 Hz Fusion Rate 25 Hz Magnetic Calibration Rate Twice per minute once full calibration is reached The FRDM-K64F /FRDM-K22F / FRDM-FXS-MULTI-B board combinations are similar to the KL25Z variant shown in Figure 8, except that the bottom base board is different. Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Mechanical and Electrical Specifications 4.3 Simulation Environments Many parameters are difficult, if not impossible, to reliably measure in a lab or production environment. Ambient magnetic fields vary tremendously in indoor environments. Determining filter sensitivities to various input parameters can only be done in a simulated environment. Accordingly, the subsequent sub-sections sections discuss environments that may be used to explore these areas. Pure Matlab Matlab is commonly used in the early development of sensor fusion algorithms. It can be used to model physical stimulus, expected responses and filter operation. See the next section for details concerning sensorr and environmental models used to construct stimulus. Matlab Stimulus/Expected Response + Hardware Hardware-based Fusion Once algorithms are functional, they are translated into C, optimized and then optimized again. The result often makes use of fixed point arit arithmetic hmetic running on an MCU to compute results. To ensure bitbit accurate results, a mixture of Matlab (used to generate test stimulus and expected response) and hardware (used to run the filter) are used to determine many parameters. Simulated values were computed ted with version 4.17 of the sensor fusion library. Version 4.22 should have almost identical results. Version 5.00 is expected to have better dynamic tracking than indicated in this datasheet, but simulations are still outstanding. Figure 10. Mixed Simulation/Hardware Characterization Unless stated otherwise elsewhere, parameters used to create the simulated sensors and environment are: * Earth magnetic field corresponding to U.S. zip code 85284 (Tempe, Arizona) on 7 November 2013 as determined using the NOAA calculator at ngdc.noaa.gov/geomag-web -- Declination: 10 degrees 39' 36" -- Inclination: 59 degrees 32' 53" -- Horizontal Intensity: 24.2976 T -- North Component (+N | -S): 23.8782 T -- East Component (+E | -W): 4.4945 T -- Vertical Component (+D | -U): U): 41.3285 T 16 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. -- Total field: 47.9418 T * Ideal accelerometer model + simple noise -- Sample rate = 200 Hz -- milli-g noise on X,Y,Z -- 1 g = 9.80665 m/s2 assumed * Ideal magnetometer model + simple nose -- Sample rate = 200 Hz -- X, Y noise 0.85 T; Z noise 1.3 T * No hard/soft iron distortion * Ideal gyroscope model and simple noise -- Sample rate 200 Hz -- X, Y, Z noise 0.3 dps based Trajectory & Sensor Simulation Toolkit (TSim) is used to For all tests, the Freescale Matlab-based create DUT trajectories and simulated sensors readings. Some of the tests require that magnetic calibration procedure is run before the test to initialize the sensor fusion software magnetic buffer. Magnetic calibration is implemented as a trajectory made up of a sequence of random rotations lasting 30seconds. Benchtop Rotary Table based system is shown in Figure 11. In this case, Matlab is used to control a A variant on the Matlab-based desktop rotary table and to post-process process the fusion results into reports. Physical sensor readings are used to drive the fusion routines. Because indoor environments vary magnetically, results may vary from day to day as the setup is moved or electronics in the area cycle on and off. Results will also change simply because the state of the magnetic buffer is continuously updated. Figure 11. Benchtop Rotary Table Setup Freescale Sensor Fusion Library for Kinetis MCUs MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Mechanical and Electrical Specifications 4.4 Frame of Reference Table summarizes differences between the standard frames of reference supported by the fusion library. Table 7. Frame of Reference Variations NED Android Windows 8 Axes alignment NED ENU ENU Angle rotation order Yaw then pitch then roll Yaw then roll then pitch Yaw then pitch then roll Gimbal lock Roll instability (x axis) at 90 deg pitch (y axis) Pitch instability (x axis) at 90 deg roll (y axis) Roll instability (y axis) at 90 deg pitch (x axis) Roll range Clockwise -180 to 180 deg Anti-clockwise -90 to 90 deg Clockwise -90 to 90 deg Pitch range -90 to 90 deg -180 to 180 deg -180 to 180 deg Yaw range 0 to 360 0 to 360 0 to 360 Compass heading Yaw Yaw -Yaw 1. A clockwise rotation is defined as one that is positive in the Right-Hand-Rule (RHR) sense. 4.5 Electrical Specifications The parameters in each table are measured using the configurations defined in Hardware Platforms Used to Measure Performance. The MCU currents are estimated using the process defined in MCU Current. Tables 8 and 9 were developed using the build #5.00 of the Sensor Fusion Library. Table 8. Typical IDD for FRDM-KL26Z only Function Fusion Idd @ 25Hz rate (mA) Fusion Idd / Hz (mA) Accel only 0.25 0.01 2D Mag 0.19 0.01 Gyro only 0.74 0.03 Accel + Mag, eCompass 0.31 0.01 Accel + Gyro 0.92 0.04 9-axis 3.20 0.13 subtotal 5.61 0.22 estimated RTOS/other 2.79 0.44 Table 9. 9-Axis IDD as a Function of Board and Development Tool Function FRDM-K64F FRDM-K22F FRDM-K20D50M FRDM-KL46Z FRDM-KL26Z FRDM-KL25 18 Fusion Idd @ 25Hz rate (mA) Fusion Idd / Hz (mA) Compiled with CodeWarrior Compiled with KDS 0.40 N/A 3.53 3.70 3.20 2.47 0.51 0.41 4.11 4.16 3.76 2.93 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. 4.6 Computation Metrics The Sensor Fusion Library computations are measured directly using the Sensor Fusion Toolbox and the ARM(R) sysTick clock. 4.6.1 Statistics from Build #5.00 of the Sensor Fusion Library For the current build (5.00), Freescale used the built in sysTick counter to measure each iteration of the algorithm in units of CPU clock cycles. The customer can repeat the exact same measurement, because both PC and Android Sensor Fusion Toolboxes display this information in a real-time basis. The test results will vary depending device movement are presented as "typical" numbers. Table 10. SysTick Values for Freedom Development Platforms and Sensor Combinations Freedom Platform Accel 2D Mag Gyro eCompass Accel +Gyro 9-axis SysTick Values for CodeWarrior Build 5.00 in kTicks KL25Z 58 46 172 72 208 740 KL26Z 58 45 171 71 210 740 KL46Z 59 45 171 72 207 740 K20D50M 34 26 63 42 157 509 K64F 3.1 2.86 4.5 3.6 10.6 50.5 KL25Z 58 46 172 72 208 740 SysTick Values for KDS Build 5.00 in kTicks KL25Z 59 47 174 74 211 840 KL26Z 61 48 173 75 211 860 KL46Z 60 49 174 74 210 840 K20D50M 35 27 66 44 160 580 K64F 3.3 3.1 4.9 3.9 11.4 54.6 K22F 3.9 3.7 5.8 4.4 13.4 59.1 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Mechanical and Electrical Specifications Table 11. Memory Requirements for "All Algorithms" Builds Freedom Platform Text Data BSS Flash RAM CodeWarrior FRDM-KL25Z 96028 72 14776 96100 14848 FRDM-KL26Z 96020 72 14780 96092 14852 FRDM-KL46Z 95956 72 14780 96028 14852 FRDM-K20D50M 88116 72 14972 88188 15044 FRDM-K64F 79724 84 KDS 16484 79808 16568 FRDM-KL25Z 77812 172 14816 77984 14988 FRDM-KL26Z 77828 172 14816 78000 14988 FRDM-KL46Z 77772 172 14816 77944 14988 FRDM-K20D50M 67356 172 15008 67528 15180 FRDM-K64F 65024 184 16652 65208 16836 FRDM-K22F 62268 184 16492 62452 16676 Table 12. CodeWarrior Memory Requirements for FRDM-KL25Z and Single Algorithm Freedom Platform Text Data BSS Flash RAM Accel (Tilt) 2D Mag Gyro Only Accel/Mag Accel/Gyro 9-axis 34280 53904 33944 55172 54716 75552 64 64 64 64 72 64 12580 12580 12528 12588 12892 13664 34344 53968 34008 55236 54788 75616 12644 12644 12592 12652 12964 13728 4.7 Magnetic Calibration Metrics 4.7.1 Background Hard-iron effects are due to magnetic materials in the vicinity of the sensor. These materials result in an apparent offset to sensor readings when the source of interference is fixed spatially, relative to the sensor. For a given point in space, plotting magnetometer measurements at various sensor rotations results in the sphere shown on the right hand side of Figure 12. This makes sense, as the magnitude of the 3D magnetic field should not change just because the sensor is rotated. Soft-iron effects result from the interaction of ferrous materials near the sensor interacting with the ambient magnetic field. If the source of soft iron interference is again fixed spatially with respect to the sensor and does not demonstrate magnetic hysteresis, then the sphere of plotted measurements is distorted into an ellipsoid. This is shown (along with a hard-iron offset) on the left side of Figure 12. Reference 2: Orientation Representations provides background on the topic of hard- and soft-iron magnetic compensation. For the case where the sensor and sources of interference are spatially fixed with respect to one another, the distortions are linear, and can be reversed mathematically. This is the function of the Freescale magnetic calibration library. 20 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Figure 12. Distorted (left) and Corrected (right) Magnetic Field Data (simulated) Both hard- and soft-iron interferences are a function of the sensor environment, and not the sensor itself. Each product design will inevitably result in different distortions. Engineers assigned the task of physically designing PCBs and housings should pay careful attention to sources of magnetic interference early in the design phase. Inductive charging films found in some portable devices exhibit a significant amount of magnetic hysteresis. This is a nonlinear phenomena and cannot be fully corrected by the Freescale magnetic calibration library. 4.7.2 The Magnetic Buffer Freescale's magnetic calibration library performs a total least squares fit of a number of data points to map the measured ellipsoid of measurements back into the ideal sphere. Quality of that fit improves as number and spacing of samples across the ellipsoid surface increases. There is a tradeoff in terms of data set size used for calibration versus CPU resources versus quality of fit. Figure 13 shows improvement in standard deviation of computed results (for a uniform field) versus constellation size. Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Mechanical and Electrical Specifications Figure 13. Simulated Standard Deviation and Variance as f(constellation size) 4.7.3 Magnetic Calibration Performance Metrics Table 13 provides some basic guidance with regard to performance of the magnetic calibration library in a stand-alone configuration. Table 13. Magnetic Calibration Performance Metrics Characteristic Symbol Conditions Min Typ Max Unit Compass heading linearity; see Compass Heading Linearity and Accuracy TBD -- -- <5 -- degrees Compass heading accuracy; see Compass Heading Linearity and Accuracy TBD -- <5 -- degrees NOTE: The results shown in this table are more conservative than simulated numbers, and are more likely to be representative of actual results. 4.8 Fusion Model Performance Metrics 4.8.1 Background The six and nine-axis Kalman filters are optimized for calculation of device orientation. Unmodelled sources of error will affect the other sensor outputs. Tradeoffs are a function of the Kalman filter configuration and are subject to change. Separate tables are presented for each of the sensor combination options provided by the Fusion Library. Common test conditions and setups are used for all options. 22 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. NOTE: Results that follow are simulated build 4.17 using basic sensor models odels which include noise effects, but ignore nonlinearity and other factors. See Simulation Environments for details. Build uild 5.00 dynamic performance is expected to be improved from the 4.17 plots shown here. 4.8.2 Gyro Offset Step Response Gyro Offset Step Response plots are shown in Figure 14 and Figure 15 for 9-axis axis and 6- axis Accelerometer+Gyro algorithms, respectively and provide an indication of the responsiveness of the system to changes in gyro offsets. The simulation artificially introduces a step in the modeled gyro offset. However, under normal circumstances, gy gyro ro offsets change very slowly. The only times that a change such as this would likely occur are: * at powerup * if the gyro has an autonomous offset cancellation circuit (which Freescale recommends be turned OFF). Figure 14. Gyro Offset Step Response for 9-Axis algorithm Freescale Sensor Fusion Library for Kinetis MCUs MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Mechanical and Electrical Specifications Figure 15. Gyro Offset Step Response for 6 6-Axis Axis Accelerometer+Gyro algorithm 4.8.3 Error in Computed Linear Acceleration Estimation of linear acceleration in the 9 9-axis algorithm is optimized for or short duration accelerations lasting less than 1 second. Continuous accelerations are inconsistent with modeled dynamics, and the acceleration estimation error increases. The acceleration error starts leaking into the estimates of orientation resulting in errors in gyro offset and magnetic disturbance estimates. Figure 16, 16 Figure 17 and Figure 18 present the true and 9 9-axis axis algorithm calculated linear acceleration for accelerations lasting 0.5 s, 1 s and 5 s respectively. Figure 16. True and calculated linear acceleration, acceleration time 0.5 s 24 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Figure 17. True and calculated linear acceleration, acceleration time 1 s Figure 18. True and calculated linear acceleration, acceleration time 5 s Similar dependence on the magnetic pulse duration time was noticed in the Orientation Magnetic Immunity tests. A slow-moving moving magnet introduces a longer lasting magnetic field disturbance pulse than a fast-moving moving magnet. The longer the magnetic disturbance pulse lasts, the greater the orientation error it causes on the output of the fusion algorithm. 4.8.4 Limitations Imposed via Sensor Choice/Configuration Table 14 represents the sensor configuration used to determine parameters specified in this datasheet. Freescale Sensor Fusion Library ry for Kinetis MCUs MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Mechanical and Electrical Specifications Table 14. Sensor/Configuration Imposed Limitations Symbol Min Max Unit Maximum Angular Rate Characteristic ARmax -2000 +2000 dps Linear Acceleration LAmax -4 +4 g Magnetic Field Bmax -1200 +1200 T It is believed that the fusion algorithms themselves have no upper limits on any of the parameters above. These are strictly limits associated with the specific physical sensors used to characterize the library. 4.8.5 9-Axis Parametrics Table 15 provides guidance for the 9-axis (accelerometer/magnetometer/gyro) indirect Kalman filter implementation. NOTE: All parametrics provided in the following table are based on build 4.17 simulations. Build 5.00 simulations are still pending. Table 15. 9-axis Sensor Fusion Performance Metrics Characteristic Symbol Conditions(s) Min Typ Max Unit Orientation static drift OSD See Orientation Static Drift -- 0.05 -- degrees Orientation static noise OSN See Orientation Static Noise -- 1.21 -- degrees RMS Orientation dynamic drift ODD See Orientation Dynamic Drift -- 0.17 -- degrees -- dps Max angular Rate ARMAX See Maximum Angular Rate -- 1600 Error! Reference source not found. Orientation response delay ORD Gyro offset step response TGOSR 2 See Orientation Response Delay -- <1 -- fusion time interval See Gyro Offset Step Response -- 3.76 -- seconds Error in computed linear acceleration LAE See Error in Computed Linear Acceleration -- 0.243 -- g Compass heading 3 linearity CHl See Compass Heading Linearity and Accuracy -- 1.02 -- degrees Compass heading accuracy CHacc -- 1.37 -- degrees Orientation magnetic immunity - static device Omis See Orientation Magnetic Immunity (Static Device) -- 9.36 -- degrees Orientation magnetic immunity - moving device Omim See Orientation Magnetic Immunity (Moving Device) -- 8.98 -- degrees 26 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. 1. 2. 3. The Sensor Fusion algorithm has no intrinsic limitation; this was the maximum value supported by the gryo in Freescale testing. Number of output sampling periods where one period = 40 ms Linear sensors, which yields very good compass heading values were assumed. However experience shows that +/5 degrees are more realistic values. 4.8.6 6-axis Accelerometer + Magnetometer Parametrics NOTE: All parametrics provided in the following table are based on build 4.17 simulations. Build 5.00 is believed to have similar performance. Table 16. 6-axis Sensor Fusion Accel + Mag Performance Metrics Characteristic Symbol Conditions(s) Min Typ Max Unit Orientation static drift OSD See Orientation Static Drift -- 0.0018 -- degrees Orientation static noise OSN See Orientation Static Noise -- 1.06 -- degrees RMS Orientation dynamic drift ODD See Orientation Dynamic Drift -- 1.16 -- degrees Orientation response delay ORD See Orientation Response Delay -- <10 -- sample Er periods ror! Reference source not found. 2 Compass heading linearity CHl Compass heading accuracy2 CHacc 1. 2. See Compass Heading Linearity and Accuracy -- 1.20 -- degrees -- 1.58 -- degrees Number of output sampling periods where one period = 40 ms Linear sensors, which yields very good compass heading values were assumed. However, experience shows that 5 degrees are more realistic values. 4.8.7 6-axis Accelerometer + Gyro Parametrics NOTE: All parametrics provided in the following table are based on build 4.17 simulations. Build 5.00 is believed to have similar static and improved dynamic performance. Table 17. 6-axis Sensor Fusion Gyro + Accel Performance Metrics Characteristic Symbol Conditions(s) Min Typ Max Unit Orientation static drift OSD See Orientation Static Drift -- 19.07 -- degrees Orientation static noise OSN See Orientation Static Noise -- 0.068 -- degrees RMS Orientation dynamic drift ODD See Orientation Dynamic Drift -- 2.04 -- degrees See Maximum Angular Rate -- 1440 -- dps Max angular Rate ARMAX Orientation response delay ORD See Orientation Response Error! Reference source not found. Delay -- <1 -- sample 2 periods Gyro offset step response TBD See Gyro Offset Step Response -- 3.76 -- seconds Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Test Descriptions 1. 2. Output sampling period = 40 ms Number of output sampling periods where one period = 40 ms 4.8.8 3-axis Accelerometer Only Parametrics NOTE: All parametrics provided in the following table are based on build 4.17 simulations. Build 5.00 should be similar. Table 18. 3-axis Accelerometer Performance Metrics Characteristics Symbol Conditions Min Typ Max Units Tilt Error RMS TAE Note 1 -- 0.082 -- degrees Orientation response delay ORD See Orientation Response 2 Delay -- <5 -- output sample period 1. RMS of accelerometer tilt angle error is calculated using the simulated sensor noise RMS values along each of the three axes and the following formula (given for tilt error from the z-axis) TAE = arctan 2. , where NRMSx, NRMSy, NRMSz - RMS values of accelerometer noise for X, Y, Z axes in g units. Number of output sampling periods where one period = 40 ms 5 Test Descriptions Each of the following sub-sections defines the specification intent and the sample procedure for the specifications listed in Mechanical and Electrical Specifications. Procedures may evolve in future drafts of this document in order to better service the specification intents. 5.1 MCU Current 5.1.1 Intent This is the average current consumption of the MCU executing the core Fusion routines. This is obviously specific to the particular MCUs listed. This metric must be associated with a specific hardware configuration similar to those defined earlier in this document. The Freedom Development Platform was powered via the OpenSDA USB port for the results specified. 5.1.2 Procedure 1. This procedure uses modified versions of the standard demo build: a. Measure (using the Sensor Fusion Toolbox) sysTickfusion which only includes time spent in the core fusion routines. It does not include: 1) calls to magnetic calibration 2) reading sensor data 3) applying hardware abstraction layer 4) RTOS 5) Communications overhead 28 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. 2. Percentage of time spent in the core fusion routines = 100*sysTickfusion / total_sysTicks2 3. Idd Current into the MCU is measured via power jumper on the board using a simple DVM3 4. Fusion Idd = MCU Idd X percentage 5. All currents shown are in mA 6. Sample size = 1 board For devices with floating point units, this may yield a somewhat optimistic number, as the computation makes the assumption that all MCU instructions consume the same amount of power. In fact, we can expect floating point instructions to consume a bit more. 5.2 Flash and RAM Required 5.2.1 Intent These parameters are total RAM and flash memory required to implement and execute the Fusion Library plus MQX-Lite RTOS. The projects for the binaries were created using both CodeWarrior and Kinetis Design Studio. Values for Text, Data and BSS were read directly from the console window after builds completed. This includes space for code storage, static and dynamic (stack) variables. This metric must be associated with a specific hardware configuration similar to those defined in earlier in this document. 5.2.2 Procedure The text, data and bss sizes for each build were extracted using the technique outlined at MCU on Eclipse; text, data and bss: Code and Data Size Explained. 1. text; includes the user code, the vector table plus constants. 2. data; is for initialized variables, and it counts for RAM and FLASH. The linker allocates the data in FLASH which then is copied from ROM to RAM in the startup code. 3. bss; is for the uninitialized data in RAM which is initialized with zero in the startup code. Refer to Computation Metrics for statistics gathered using the 5.00 build. 5.3 Fusion Loop Execution Time This is simply CPU cycle time X sysTickfusion as measured in Section 5.1. 5.4 Compass Heading Linearity and Accuracy 5.4.1 Intent Linearity is defined as the deviation of measured data from a least squares straight line approximation of that data. Absolute accuracy is defined as the maximum difference between measured and ideal values. 2 3 Which is simply the clock rate of the MCU divided by the sensor fusion rate (nominally 25) Consult the user guide / schematic for your Freedom board to determine the specific jumper number applicable to that board. Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Test Descriptions These two concepts are illustrated in Figure 19. This metric must be stated specifically for a hardware configuration similar to those defined earlier in this document. Figure 19. Nonlinearity vs. Absolute Accuracy 5.4.2 Procedure Heading Linearity Hardware-based based Fusion. Fusion Matlab is used to Setup as defined in Matlab Stimulus/Expected Response + Hardware post-process data. 1. Precondition the DUT by executing magnetic calibration trajectory leaving DUT in AZ = + 1 orientation (See Matlab Stimulus/Expected Response + Hardware Hardware-based based Fusion) Fusion 2. Rotate DUT around the z-axis axis from 0 to 360 degrees with an increment step of 10 degrees as follows 3. Program rate table with desired steps and maximum velocity a. Rotate tabletop by 10 degrees over 0.5 second per period b. Pause 0.5 seconds c. Read orientation d. Repeat steps a-cc above until 360 degrees is reached. Absolute Heading Accuracy These numbers are based on simulations that are idealized models. The real real-world world values will tend to be approximately 5 degrees. 30 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. 5.5 Orientation Static Drift 5.5.1 Intent The maximum change in orientation observed for a DUT remaining motionless for 100 seconds. 5.5.2 Procedure Setup as defined in Matlab Stimulus/Expected Response + Hardware Hardware-based based Fusion. Fusion Matlab is used to post-process data. tric must be associated with a specific hardware configuration similar to those defined in earlier This metric in this document.. Matlab is used to record and post post- process data. 1. Precondition the DUT by executing magnetic calibration trajectory leaving DUT in a given orientation. 2. While the DUT remains in given orientation collect orientation samples for 120 seconds. 3. Plot and process the last 100 s of the test. Orientation static drift is the maximum angle change in the measured rotation vectors. 4. Repeat steps 1-3 for all 6 major orientations of the development board as shown in Figure 20. Figure 20 20. Major orientations relative to gravity Freescale Sensor Fusion Library for Kinetis MCUs MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Test Descriptions 5.6 Orientation Static Noise 5.6.1 Intent RMS noise as a function of orientation for a motionless DUT. 5.6.2 Procedure This can be based upon data gathered for the orientation static drift test. The classic standard deviation equation is used to compute the metric/value. 5.7 Orientation Dynamic Drift 5.7.1 Intent Measure of the ability of fusion code to return to a known orientation after movement. 5.7.2 Procedure Setup as defined in Matlab Stimulus/Expected Response + Hardware-based Fusion and in Figure 9. Matlab is used to post-process data. 1. Precondition the DUT by executing magnetic calibration trajectory leaving DUT in a given orientation. 2. Keep DUT in a given orientation motionless for 2 seconds. 3. Rotate DUT at 0.5 revolution/sec for 10 seconds around vertical axis. 4. Keep DUT in its last orientation motionless for 2 seconds. 5. Determine the initial orientation by averaging orientation samples from the initial motionless period and the final orientation by averaging the samples from the final motionless period. The difference between the two orientations is the orientation dynamic drift. 6. Repeat steps 1-5 for all six major orientations of the development board. 5.8 Maximum Angular Rate 5.8.1 Intent This test determines the maximum rotation rate for which the filter is able to correctly track orientation. 5.8.2 Procedure Setup as defined in Matlab Stimulus/Expected Response + Hardware-based Fusion. Matlab is used to post-process data. 1. Rotate DUT around X axis five times starting at rotation rate 360 dps. 2. Plot the ideal simulated orientation together with the orientation samples calculated by Kalman filter fusion algorithms: 9DOF and 6DOF Accelerometer + Gyro and notice if fusion data tracks the ideal orientation. 3. Increase the rotation rate by 360 dps and repeat steps 1 and 2. 4. The highest angular rate at which the fusion algorithm orientation still tracks the ideal simulated orientation is the maximum angular rate. 32 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. 5.9 Orientation Response Delay 5.9.1 Waveform Definitions 90 Input Change in Orientation The 90 input orientation change waveform is defined as: * From any starting orientation * Through the center of mass of the accelerometer * A change in one of roll, pitch or yaw (global frame) * Orientation change = 90 * Orientation change is linear in time * Transition period = 1.0 seconds * Propagation delays are measured from the 1/2 point (45) Output Orientation Changes When measuring changes in orientation, there are many ways to get from orientation A to orientation B. It is assumed that output orientation changes should track input orientation changes. The Fusion Library will inherently output those values. However, to avoid any ambiguity when measuring propagation delays, the 50% point in computed orientations changes is defined as shown in Figure 21. Figure 21. Propagation delays are measured at the plane that bi bisects sects and is perpendicular to SLERPA-B 5.9.2 Intent Orientation response delay is measured from change in physical orientation to the related change in fusion orientation output. 5.9.3 Procedure Using 90 input orientation change as defined in 90 Input Change in Orientation,, the response delay is measured from the 50% point on the input wav waveform eform to the 50% point of the output waveform as defined in Output Orientation Changes Changes. Freescale Sensor Fusion Library for Kinetis MCUs MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Test Descriptions 5.10 Orientation Magnetic Immunity (Static Device) 5.10.1 Intent The test response of the stationary DUT to momentary changes in the local magnetic field is used to measure the orientation magnetic immunity. Because the device is stationary, the accelerometer and gyroscope readings remain relatively constant, changing only due to sensor noise. 5.10.2 Procedure Setup as defined in Matlab Stimulus/Expected Response + Hardware-based Fusion. Matlab is used to post-process data. 1. 2. 3. 4. Starting point = device stationary, fusion outputs stable 100 T magnet moving at 0.25 m/s Closest approach to magnetic sensor = 5 cm Test to be simulated using environment specified in Matlab Stimulus/Expected Response + Hardware-based Fusion. Magnetic interference may be modeled as a time varying field which is consistent with the description above. 5.11 Orientation Magnetic Immunity (Moving Device) 5.11.1 Intent This test measures the immunity of a linearly, with no rotation, moving DUT to a 100 T magnet change in the magnetic field. The outputs of all acceleration and magnetic sensors change during this test. Gyro outputs should be constant throughout, with any changes attributed to noise only. 5.11.2 1. 2. 3. 4. Procedure Starting point = device stationary, fusion outputs stable. Use a 100 T magnet. The DUT moves by magnet at 0.25 m/s with the closest approach to magnet=5cm. Test to be simulated using environment specified in Matlab Stimulus/Expected Response + Hardware-based Fusion. Magnetic interference may be modeled as a location varying field which is consistent with the description above. 5.12 Error in Computed Gyro Bias 5.12.1 Intent Measure how well the fusion library tracks slowly varying gyro bias. 5.12.2 Procedure Test to be simulated using environment specified in Matlab Stimulus/Expected Response + Hardwarebased Fusion. 1. Starting point = device stationary, fusion outputs stable 2. Add 10 dps gyro offset as step function 3. Run test until computed gyro offset stabilizes 34 Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. 4. Note computed/actual for final value 5. Note response time 5.13 Gyro Offset Step Response 5.13.1 Intent Measure how well the fusion library tracks varying gyro offset. 5.13.2 Procedure Setup as defined in Matlab Stimulus/Expected Response + Hardware-based Fusion. Matlab is used to post-process data. 1. 2. 3. 4. Starting point = DUT is stationary and fusion outputs are stable. Add offset of 10 dps to gyro X read data. Run test until computed gyro offset stabilizes. Plot the gyro read data step function and the response fusion algorithm estimated offset. Record response time as time between 50% step change in gyro X read data and 50% change in fusion algorithm estimated gyro X offset. 5.14 Error in Computed Linear Acceleration 5.14.1 Intent Measure how well the fusion library tracks linear acceleration. 5.14.2 Procedure Setup as defined in Matlab Stimulus/Expected Response + Hardware-based Fusion. Matlab is used to post-process data. 1. Starting point = DUT is stationary and fusion outputs are stable. 2. Subject DUT to acceleration A*sin(2*pi*f*t), where: A = 2 g, f = 1 Hz, t = zero to one second (1 period), pi = 3.141592654 3. Plot the ideal DUT acceleration and fusion algorithm computed acceleration. Determine the maximum error between the two accelerations. Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. Revision history for FSFLK_DS 6 Revision history for FSFLK_DS Rev. No. 36 Date Description 0 12 Nov 2013 * ROUGH DRAFT ONLY - PRE-REVIEW 0.1 22 Nov 2013 * Preliminary draft includes updates from 1st review. 0.2 Feb 2014 * Initial public release. 0.3 Apr 2014 * Updated for licensing, software updates and board support changes. 0.4 May 2014 0.5 Sept 2014 0.6 Sept 2014 0.7 Sept 2015 * Updated for software updates, additional (FRDM-K64F) board support changes and electrical specs and computation metrics. * Updated Fusion Performance Metrics section by adding four new figures and tables. * adjusted selected parametric values * altered several Test Description procedures. * Separated out Computational Metrics section and various minor markups * Changed Feature - License, option text. * Feature Comparison Based on License Option, Added KDS to Product Deliverables row * Moved sections 4.1, 4.1.1 & 4.1.2 and merged in 4.11 * Added xrefs from Electrical Specs tables to appropriate Test Description sections * Adjusted Performance Metric tables, symbols and units in some cases * Updated for build 5.00 of the sensor fusion library. This version has completely redesigned 6 and 9-axis Kalman filters. * Updated all computation metrics. * Removed outdated fusion time measurements. * Added K22F for KDS. Added additional fusion options. * Changed document name from XSFLK_DS to FSFLK_DS. * Noted that MULTI-B boards have been replaced with MULT2-B boards. Freescale Sensor Fusion Library for Kinetis MCUs, Rev. 0.7, 9/2015 Freescale Semiconductor, Inc. How to Reach Us: Home Page: freescale.com Web Support: freescale.com/support Information in this document is provided solely to enable system and software implementers to use Freescale products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits based on the information in this document. Freescale reserves the right to make changes without further notice to 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 and the Freescale logo are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. All other product or service names are the property of their respective owners. (c) 2015 Freescale Semiconductor, Inc. Document Number: FSFLK_DS Revision Rev. 0.7, 9/2015 Mouser Electronics Authorized Distributor Click to View Pricing, Inventory, Delivery & Lifecycle Information: Freescale Semiconductor: FRDM-KL25Z FRDM-KL46Z FRDM-FXS-MULTI FRDM-KL26Z FRDM-K64F