Home
Getting started with the osxMotionFx fusion and compass library for
Contents
1. e LMode represents the gyroscope bias learning mode the library automatically tracks and calibrates gyro zero rate bias drift the possible values of this parameter are LMode 0 learning off This mode can be used in case gyro is already calibrated LMode 1 static learning Learning is performed only when the system is not moving LMode 2 dynamic learning Learning is performed also when the system is moving e gbias_xxx_th_sc represent the thresholds that define when the gbias algorithm automatically starts In fact if the data for each axis are below those thresholds the algorithm for gbias calculation is executed They should be found by testing they are different for different part numbers Values in example project are usually correct e modx represents the decimation of osx_MotionFX_update call frequency See resources optimization paragraph below for more details e acc_orientation gyro_orientation mag_orientation represent the arrays of 3 characters describing orientation of sensor axis x y and z The possible values are n north e east s South w west u up d down An example is shown in Figure 3 Example of x y Z axis values e outout_type represents the Sensor Fusion library output orientation 0 means NED 1 means ENU e start_automatic_gbias_calculation represents a flag that restarts gyroscope bias calibration when set to 1 Figure 3 Example of x y z axis values Iv 1S TOF
2. 17 Accelerometer XYZ mg V Gyroscope XYZ mdps V Magnetometer XYZ mgauss vV Start Start Sensor Fusion Gi ite augmented 3 Select between various sensors pressure temperature humidity accelerometer gyroscope magnetometer available on the expansion board see Figure 9 Sensors_DataLog Utility snapshot 2 4 Set appropriate delay interval in milliseconds between consecutive data points the default is 500 ms see Figure 9 Sensors_DataLog Utility snapshot 2 Kys DocID027533 Rev 3 13 35 osxMotionFxX library add on of X CUBE MEMS1 UM1866 software expansion for STM32Cube Figure 9 Sensors _DataLog Utility snapshot 2 yj Sensors_Datalog V1 3 0 STMicroelectronics Settings COM Devices COM E DS A Speed 9216 Interval ms 500 Pressure mbar Temperature C Accelerometer XYZ mg Gyroscope XYZ mdps v Jiv Humidity iv iv iv iv Magnetometer XYZ mgauss Start Start Sensor Fusion kys ife augmented 2 Save the log in a file within the folder called SensorsDataLog using the Save button or clear it with the Clear button see Figure 10 Sensors DataLog Utility snapshot 3 6 Check the Plot CheckBox to visualize the data log for the selected sensors see Figure 10 Sensors_DataLog Utility snapshot 3 14 35 DoclD027533 Rev 3 kyy UM1866 osxMotionFxX library add on of X CUBE MEMS1 software expansion for STM382Cube Figure 10 Sens
3. After initiating the calibration routine the Nucleo board should be slowly rotated performing a figure 6 movement in the 3D space An example is shown in Figure 6 Example of rotation of the Nucleo board during calibration While performing this pattern keep the Nucleo board clear of other magnetic objects such as cell phones computers and other steel objects To be sure that calibration was done properly it is recommended to check magnetometer data after applying calibration results using two 2D plots see Figure 4 Magnetometer data in ideal environment or after calibration for an example of good calibration and Figure 5 Magnetometer data disturbed by hard iron effect for an example of bad calibration Magnetometer calibration can be restarted by calling osx_MotionFX_compass_forceReCalibration function Figure 6 Example of rotation of the Nucleo board during calibration GSPG2702151140SG 1 6 Sensor data logging utility The X CUBE MEMS1 expansion for STM32Cube contains an utility for Windows PCs called Sensors DataLog This utility is available in the ROOT _DIR Utilities PC_software folder This section describes the usage of the utility Before using this utility the user must ensure that the necessary drivers as explained in the section relating to system setup are installed and the expansion board along with NUCLEO F401RE or NUCLEO L476RG board is connected to the PC 3 DocID027533 Rev 3 11 35 osxMotionFxX li
4. ESE Press Switch to 6x Fusion to pass dynamically from 9x fusion to 6x fusion as shown in Figure 14 Sensors_DataLog Utility snapshot 7 In order to come back to 9x fusion you can press Switch to 9x Fusion 16 35 DoclID027533 Rev 3 0 UM1866 osxMotionFxX library add on of X CUBE MEMS1 software expansion for STM32Cube Figure 14 Sensors _DataLog Utility snapshot 7 When the board is powered on the compass is not calibrated so the cube could not point to magnetic north It is shown in Figure 15 View of the board and Windows utility after power on Figure 15 View of the board and Windows utility after power on When the compass is not calibrated LED2 green LED of the Nucleo board is off In order to calibrate the compass you must press the user button on the Nucleo board and then perform the 8 movement calibration see paragraph 1 5 2 for more details You can calibrate the compass only when the sensor fusion is activated press the Start Sensor Fusion button on the PC GUI When the calibration is completed wait a few seconds until the cube shown in the GUI points to north see Figure 16 View of the board and Windows utility after calibration When the calibration is done LED2 turns on ky DocID027533 Rev 3 17 35 osxMotionFxX library add on of X CUBE MEMS1 UM1866 software expansion for STM382Cube Figure 16 View of the board and Windows utility after calibration It is possible to check
5. Nucleo to the PC Software Setup This section lists the minimum requirements for the developer to set up the SDK run the sample testing scenario based on the GUI utility and customize applications Development tool chains and compilers Please select one of the integrated development environments supported by the STMS32Cube expansion software and read the system requirements and setup information provided by the selected IDE provider PC utility The Sensors _DataLog utility for PC has following minimum requirements e PC with Intel or AMD processor running one of the following Microsoft operating systems Windows XP SP3 Windows Vista Windows 7 e Atleast 128 MBs of RAM e 2X USB ports e 40 MB of hard disk space 0 DoclD027533 Rev 3 UM1866 2 3 5 2 3 6 2 3 7 2 3 8 3 System setup guide System setup guide This section describes how to set up different hardware components before writing and executing an application on the STM32 Nucleo board with the sensor expansion board STM32 Nucleo and Sensor expansion boards setup The STM32 Nucleo board integrates the ST LINK V2 1 debugger programmer The developer can download the relevant version of the ST LINK V2 1 USB driver by accessing the STSW LINKO08 or STSW LINK009 on www st com according to which Microsoft Windows OS is used The sensor expansion board X NUCLEO IKS01A1 can be easily connected to the STM32 Nucleo motherboard through the Arduino UNO R3
6. am R24 i i ee ee en ed a T a o l FR SB9 Nucleo 3 DoclD027533 Rev 3 21 35 System setup guide UM1866 2 2 2 3 2 3 1 2 3 2 2 3 3 2 3 4 22 35 Software description The following software components are needed in order to set up a suitable development environment for creating applications using the osxMotionFX library for the STM32 Nucleo equipped with the sensor expansion board e X CUBE MEMS1 an expansion for STM32Cube dedicated to sensor application development The X CUBE MEMS1 firmware and related documentation is available on st com e osxMotionFX an add on software package for X CUBE MEMS 1 that provides fusion and compass calibration APIs The osxMotionFX firmware and related documentation is available on st com e Development tool chain and compiler The STM32Cube expansion software supports the following three environments AR Embedded Workbench for ARM EWARM toolchain ST LINK RealView Microcontroller Development Kit MDK ARM toolchain ST LINK System Workbench for STM32 Hardware and software setup This section describes the hardware and software setup procedures and required system setup Hardware setup The following hardware components are required 1 One STM32 Nucleo development platform Suggested order code NUCLEO F401RE or NUCLEO L476RG 2 One sensor expansion board order code X NUCLEO IKS01A1 3 One USB type A to Mini B USB cable to connect the STM32
7. extension connector see Figure 21 Sensor expansion board connected to STM32 Nucleo board The sensor expansion board is capable of interfacing with the external STM32 microcontroller on the STM32 Nucleo via an inter integrated circuit 12C transport layer Sensors DataLog GUI setup The Sensors _DataLog GUI included in the X CUBE MEMS1 software package is a graphical user interface that can be used to interact and obtain sensor and sensor fusion data Please see section 1 6 for a description of the how this PC utility works This utility retrieves sensor data from the connected STM32 Nucleo board and displays it in a tabular form and graphically as well In order to use the Sensors_DataLog GUI make sure you have correctly set up your hardware and software The utility can be launched by simply double clicking on the Sensors DataLog exe file located in the Utilities PC_software Sensors_DataLog folder osxMotionFX installer setup The osxMotionFX software package Is provided with a Windows installer osxMotionFX_Setup_vXXX exe that guides the user in the correct installation of the software package The installer also includes the osx License Wizard tool which allows the user to automatically obtain a valid node locked license for their Nucleo board The installer of this wizard is described in the paragraph 2 3 9 Before running the installer you need to download the latest release of the X CUBE MEMS1 software package and unzip
8. t and send it via email to open license st con Y DETI AUDIO NOTE the message is digitally signed do NOT modify the fields or text Failure to do so will prevent license authorization by the licensing server OSX Open MEMS lt MotionFX v1 2 0 6x 9x Sensor Fusion gt license request user name Mario Rossi User company STicroelectronics User email mario rossi st comn Library name OSX_MOTION_FX_V120 Board model NucleoF40iRE Node Code DOFD02123EDC 8E6277908SCCEED72i139 Site Code CBSISGAFEFISSF5 SEF 612504987 FFO2CE License Code 55369728873AC6SE034CD2725E613900 License Type EVALUATION This email has been generated by the OSX License Wizard vi 090 Once the license activation codes are received edit the content of the osx_license h file Note also delete or comment the error line found in the Middlewares ST STM32_OSX_MotionFX_Library folder of your workspace ky DocID027533 Rev 3 31 35 Acronyms and abbreviations UM1866 3 Acronyms and abbreviations Table 1 Acronyms and abbreviations Acronym Description x North y East z Down x South y East z Up p o ewu eson yeas OO 3 32 35 DocID027533 Rev 3 UM1866 References 4 References e UM1859 Getting started with the X CUBE MEMS1 motion MEMS and environmental sensor software expansion for STM32Cube 3 DocID027533 Rev 3 33 35 Revision history UM1866 5 Revision history Table 2 Document revision history Date Rev
9. the quality of the magnetometer calibration displaying the scatter plot of the magnetometer Press Show Scatter Plot as shown in Figure 17 Sensors_DataLog Utility snapshot 8 and you will see the magnetometer scatter plot as shown in Figure 18 Sensors _DataLog Utility magnetometer scatter plot Figure 17 Sensors _DataLog Utility snapshot 8 18 35 DoclD027533 Rev 3 0 UM1866 osxMotionFX library add on of X CUBE MEMS1 software expansion for STM382Cube Figure 18 Sensors _DataLog Utility magnetometer scatter plot y Scatter Plot 500 mG 250 mG 500 mG By default the calibration data is stored in RAM memory in order to be preserved when you reset the board It is also possible to store calibration data in Flash memory To do this you must compile the sample application DataLogFusion defining OSXMOTIONFX_STORE_CALIB_ FLASH in the project Kys DocID027533 Rev 3 19 35 System setup guide UM1866 2 2 1 2 1 1 20 35 System setup guide Hardware Description This section describes the hardware components needed for developing a sensor based application The sub sections that follow describe the individual components STM32 Nucleo platform The STM32 Nucleo boards provide an affordable and flexible way for users to try out new ideas and build prototypes with any STM32 microcontroller lines The Arduino connectivity support and ST morpho headers make it easy to expand the functionalit
10. this package in your workspace For example if you have the X CUBE MEMS S1 package in C workspace S TM32CubeExpansion MEMS1_VX X X at this point you can run the installer and see the welcome window as shown in Figure 22 osxMotionFX installer snapshot 1 DoclID027533 Rev 3 23 35 System setup guide UM1866 Figure 22 osxMotionFX installer snapshot 1 Setup OSX MotionFX Library Welcome to the OSX MotionFX Y fd Library Setup Wizard augmented This wil install OSX MotonFX Library 1 1 0 on your computer Itis recommended that you dose al other applications before osi Di te N re Click Next to continue or Cancel to exit Setup You must then accept the license agreement as shown in Figure 23 osxMotionFX installer snapshot 2 Figure 23 osxMotionFX installer snapshot 2 Setup OSX MotionFX Library License Agreement Please read the following important information before continuing Please read the following License Agreement You must accept the terms of this agreement before continuing with the installation Copyright C STMicroelectronics N V ST 2014 Notice This Software induding as the case may be software in binary form documentation and other related items is provided by ST under the terms of this license By using this Software you the licensee agree that you have read understood and will comply with the following terms and conditions All rights not expressly granted
11. to the mag x float FrTime merge rate to the accel when external accelerations occurs unsigned char LMode gyro bias learn mode l static learning 2 dynamic learning 7 float gbias mag th sc 6X scaler for the gyro bias mag threshold nominal f float gbias acc th sc 6X scaler for the gyro bias mag threshold nominal 7 float gbias gyro th sc 6X scaler for the gyro bias mag threshold nominal a i float gbias mag th sc 9X scaler for the gyro bias mag threshold nominal a float gbias acc th sc 9X scaler for the gyro bias mag threshold nominal A float gbias gyro th sc 9X scaler for the gyro bias mag threshold nominal f unsigned char modx setting to indicate the decimation set to 1 in smartphone tablet set to gt 1 in embedded solutions Char acc _orientation QNUM AXES accelerometer data orientation char gyro orientation QNUM AXES gyroscope data orientation Si char mag_orientation QNUM AXES magnetometer data orientation osxMFX Engine Output Ref Sys output_type 0 NED 1 ENU af int start automatic gbias calculation osxMFX knobs 0 DoclD027533 Rev 3 UM1866 osxMotionFxX library add on of X CUBE MEMS1 software expansion for STM32Cube e ATime MTime and FrTime represent the weighting stability of sensors in prediction trust to the sensor they can be a value from 0 to 1 it is recommended to keep default values
12. 2887 3AC68E034CD2725E61900 EVALUATION This email has been generated by the OSX ensoftwarex development tools i Showlibraryinfo s digitally signed do NOT modify the fields or o will prevent license authorization by the licensing server license request License wizard v1 090 text Then you should accept the license agreement see Figure 36 osx License Wizard snapshot 9 30 35 DoclD027533 Rev 3 ky UM1866 System setup guide Figure 36 osx License Wizard snapshot 9 License agreement OpenSoftwareX Open MEMS The osx MotionFXxX API software is only available to purchasers of the STM32 Nucleo development board AND the MEMS and environmental sensor expansion board for STM32 Nucleo ie X NUCLEO IKSO1A1 AND The osx MotionFx API software is identified as the Proprietary information of STMicroelectronics or its Licensors as set forth in Section 4 of the OpenSoftwareX M1 Limited License Agreement AND The licensee is required to acknowledge its Proprietary status prior to gaining access to the license request procedure Copyright C STMicroelectronics N V ST 2014 Notice This Software including as the case may be software in binary form documentation and other related items is provided by ST under the terms of this license By using this Software you the licensee agree that you have read understood and will comply with the following terms and conditions All rights
13. Recognition User information Mario Rossi User name STMicroelectronics Company Email mario rossi st com MotonFx v1 2 0 6x 9x Sensor Fusion Identify STM32 Nudeo board Generate license request e Show library info Ext At this point you should see information about your Nucleo board Then you should edit the User name Company and Email forms and press the Generate license request see Figure 35 osx License Wizard snapshot 8 Figure 35 osx License Wizard snapshot 8 OSX License Wizard v1 090 Tools Help S74 le augmented se open MEMS open AUDIO Email Site identification User information User name Company Mario Rossi STMicroelectronics mario rossi st com Node code DOFD02123EDCSE62779085CCEED 72139 E Identify STM32 Nudeo board Ste code Generate license request i Sand keeras repent emais the text in the belo 0Opy T ecttor between the nes and send it ta emat tc m ow s o De open license st NOTE the message 1 do so OSX Open MEMS lt MOTIONFX v1 2 0 6x 9x Sensor Fusion gt user name user company user email Library name Board model Node Code Site Code License Code License Type Mario Rossi STicroelectronics marito rossi st com OSX_MOTION_FX_Vi20 NuCTeOFSO01RE DOFDO2123EDC 8E6277908SCCEED72139 CB3J1 GAFEFI9OSFS 9EF612504987FFO02CB FSS3697
14. TONN x 4 mies M285 eases ZZESiwor EZGSiwo GSPG2702151135SG As shown in the Figure 3 Example of x y z axis values first sensor magnetometer is oriented SEU x South y East z Up while the second accelerometer gyroscope is ENU x East y Nor th z Up The osx_MotionFX_propagate and the osx_MotionFX_update functions expect input from sensors in osxMFX_input structure ky DocID027533 Rev 3 7 35 osxMotionFX library add on of X CUBE MEMS1 UM1866 software expansion for STM32Cube 8 35 typedef struct float mag NUM AXES calibrated mag uT 8 float acc NUM AXES aw y float gyro NUM AXES gyro dpg ae OSxMEX input e mag represents magnetometer data after calibration in uT 50 e acc represents accelerometer data in g gyro represents gyroscope data in dps The osx_MotionFX_propagate and the osx_MotionFX_update functions provide output of the sensor fusion in osxMFX_output structure typedef struct float rotation 9X NUM_ AXES 9 axes yaw pitch and roll float quaternion 9X QNUM AXES 9 axes quaternion float gravity 9X NUM AXES 9 axes device frame gravity sad float linear acceleration 9X NUM AXES 9 axes device frame lin accel y float heading 9X 9 axes heading x7 similarly for 6 axis SF we osxMFX output e rotation represents the orientation of the system in three angles format yaw pitch and roll e quaternion r
15. brary add on of X CUBE MEMS1 software expansion for STM32Cube 12 35 Please perform the following steps 1 Figure 7 Device manager view in Windows the port is COM13 Figure 7 Device manager view in Windows aay Device Manager UM1866 Check the Windows Device Manager to note the ST COM port for example in File Action View Help o0 r m amp 4 gy AGRCWD2443 2 Batteries Computer g Disk drives amp Display adapters lt 3 DVD CD ROM drives 05 Human Interface Devices ca IDE ATA ATAPI controllers EF Jungo gt Keyboards F Mice and other pointing devices E Monitors amp Network adapters gt Other devices Portable Devices TI Ports COM amp LPT Communications Port COM1 Y Intel R Active Management Technology SOL COM3 STMicroelectronics STLink Virtual COM Port COM13 E Processors QP Security Devices Sound video and game controllers JE System devices Universal Serial Bus controllers Universal Serial Bus devices 2 expansion board is correct DoclD027533 Rev 3 Launch Sensors_DataLog exe and check if the COM device number for the current 0 UM1866 osxMotionFxX library add on of X CUBE MEMS1 software expansion for STM382Cube Figure 8 Sensors _DataLog Utility snapshot 1 hy Sensors_DataLog V1 3 0 STMicroelectronics i Settings COM Devices COM13 z Save Speed Interval ms 500 Pressure mbar V Temperature C V Humidity
16. cID027533 Rev 3 35 35
17. cuts are installed see Figure 27 osxMotionFX installer snapshot 6 Figure 27 osxMotionFX installer snapshot 6 Setup OSX MotionFX Library Select Start Menu Folder Where should Setup place the program s shortcuts z r Setup will create the program s shortcuts in the following Start Menu folder To continue dick Next If you would like to select a different folder dick Browse icroelectronics OpenSoftwareX Open MEMS Libraries OSX MotonFXx Browse After this point the osxMotionFX installer can finish the software installation 2 3 9 osx License wizard This tool allows the user to automatically obtain a valid node locked license for their Nucleo board You can see in Figure 28 osx License Wizard snapshot 1 the welcome window 0 26 35 DocID027533 Rev 3 UM1866 System setup guide Figure 28 osx License Wizard snapshot 1 Setup OSX LicenseWizard Welcome to the OSX LicenseWizard Setup Wizard This will install OSX LicenseWizard 1 0 1 on your computer It is recommended that you dose all other applications before continuing Click Next to continue or Cancel to exit Setup You need to accept the license agreement as shown in Figure 29 osx License Wizard snapshot 2 Figure 29 osx License Wizard snapshot 2 Setup OSX LicenseWizard License Agreement Please read the following important information before continuing Please read the following License Agreement You must accept the t
18. data The osx_MotionFX_update is the function of correction It is used to correct if needed the prediction solution It weighs more accelerometer and magnetometer data The osx_MotionFX_update function can be called either every time the osx_MotionFX_propagate is invoked or less in systems that have less computation power The osx_MotionFX_update function takes approximately three times more computation time of the MCU compared to the osx_MotionFX_propagate function The typical operation flow of the osxMotionFX library can be summarized with the following steps 1 Initialize sensors 2 Initialize the sensor fusion library and calibration library osx_MotionFX_ initialize and osx_MotionFX_compass_init 3 Setup parameters of the library in a Knobs structure osx_MotionFX_getKnobs and osx_MotionFX_setKnobs 4 Start 6 axis or 9 axis engine osx_MotionFX_enable_6X or osx_MotionFX_enable_9X 5 Ataselected output data rate of sensor fusion do regularly e g using a timer of MCU or data ready signal from one of the sensors Read and convert data from sensors Call osx_MotionFX_propagate Call osx_MotionFX_update Both osx_MotionFX_propagate and osx_MotionFX_update functions take as an input sensor data and both of them also provide output data of Sensor Fusion library The osxMotionFX library is parameterized using a Knobs structure typedef struct float ATime merge rate to the accel a float MTime merge rate
19. eir magnetization direction Basically the local geomagnetic field is deformed with different gain on different directions The effect of the soft iron distortion is to make the ideal full round sphere become a tilted ellipsoid in the x y plane the soft iron distortion is identified by a tilted ellipse with the origin in 0 0 for XY axis XZ If PCB is designed correctly the soft iron effect is not present and therefore there is no need for soft iron effect compensation valid for X NUCLEO IKS01A1 Magnetometer has an offset by itself Then there can be and usually there are hard iron and or soft iron distortions Hard iron effect is different from board to board each board can be magnetized in a different way Soft iron effect is always equal for all same boards only one board can be characterized for soft iron and the result can be copied to the other boards Magnetometer calibration library is included in osxMotionFX library If PCB is well designed by taking into account the magnetometer placement high current traces other components clearance soft iron will not be present For this reason osxMotionFX library can compensate for hard iron effect only When the calibration is enabled user needs to cover as much as possible 3D sphere by moving the board otherwise there will be a drift in the output of the library Gyroscope has a zero rate offset which needs to be compensated In the osxMotionFX library there is estimation of gyro
20. ements of the library in terms of MCU MPU load The osx_MotionFX_update function is a correction step in the Sensor Fusion algorithm It requires approximately three times more computation power than osx_MotionFX_propagate function If systems resources are limited e g in embedded system this function does not need to be called at the same frequency as the output data rate of the library Using modx parameter in osxMFX_knobs structure it is possible to decrease frequency of osx_MotionFX_update function calls For example it is possible to set modx equals to 2 Then the osx_MotionFX_propagate function will be called at the output data rate of the Sensor Fusion and the osx_MotionFX_update function will be called DocID027533 Rev 3 Lys UM1866 1 5 2 osxMotionFxX library add on of X CUBE MEMS1 software expansion for STM32Cube only after every second osx_MotionFX_propagate function call For tablet or other system with MCU MPU you can set modx to 1 for STM32F4 you can set modx to 1 and for STM32F1 you can set the modx to 2 The library can be used on Cortex M0O e g STM32L0 as well Sensors calibration in the osxMotionFxX library STMicroelectronics produces its sensors with high effort for a precise operation However there are factors affecting operation of sensors that are often present only in final application These factors need to be evaluated by users The osxMotionFX library contains routines for calibration of magnetometer for ha
21. en you can run the osx License Wizard First you need to select the library you want to activate as shown in Figure 33 osx License Wizard snapshot 6 Figure 33 osx License Wizard snapshot 6 OSX License Wizard v1 090 Tools Help Nudeo board Board model Yy Flash size Ram size le augmented Site identification c S x lt Select the brary to be activated gt Node code fy STN a B316AFEF 198F 59EF6 1250498 7FFO2CE OpenSoftware Site code open MEMS Opensof twar ex I er AUDIO 32 Nucleo License wizard v1 090 STMicroelectronics The next step is to identify the Nucleo board plugged into your PC To do this you can press the Identify STM32 Nucleo board button see Figure 34 osx License Wizard snapshot 7 3 DocID027533 Rev 3 29 35 System setup guide OSX License Wizard v1 090 UM1866 Figure 34 osx License Wizard snapshot 7 Tools Help r S7 life augmented OSX OpenSoftwarex open MI EMS open AU DIO J Nudeo board Board model oF401RE Flash size 512KB Ram size 96 KB Site identification PE eee me DDFD02123EDC8E62779085CCEED 72139 sTMicroelectronics Opensoftwar ex S 32 Nucleo License wizard vi 090 Date Thursday 03 September 15 Num of libraries found on this machine 3 gt gt MOTIONFX v1 2 0 6x 9x Sensor Fusion gt MOTIONAR v1 0 0 Activity Recognition gt gt MOTIONCP v Carry Position
22. ensors calibration in the osxMotionFX library sere 9 1 6 Sensor data logging utility ce cccseeeecceseeeeeeeeeeeeeeeeeesseeeeeeseeeees 11 2 VSCOM SOU guide ereraa 20 2 1 Pra GWale DOSC Iae cedvatcaeciates dad augedidearetdedreaaeeedueiald 20 2 1 1 SU M32 INUGICO DIAT ON oseca 20 2 1 2 X NUCLEO IKSO1A1 expansion DOAaMC cccccceeeeeseeeeeeeeeeeeeeaes 20 2 2 DOM Wale Ge SCHONOM ocsi Eei 22 2 3 Hardware and Software setup cccccsecccseeeeseeeeeeeeeeeeeeseeeseeesees 22 2 3 1 Hardware setup ccccsssccccceseecceesseecceseecssaneeecsauseeeseseeessaseeessansees 22 2 3 2 SONY SEUD esnai eeN e ESE EER AERIANA 22 2 3 3 Development tool chains and compilers cccccseeeeeeseeeeeeneeees 22 A PON er ee ee 22 29 9 System setup guide ccccccseesecceceeeeeeeeecceeaseeeeceaaeeeeeesseaeeeeeesaaees 23 2 3 6 STM32 Nucleo and Sensor expansion boards SetuDp 0008 23 2o Sensors DataLog GUI setup eee cceeeeeeeeeeeeeeeeeeesaeeeeeeeeneaees 23 2 3 8 OSXMotionFX installer setup ccccesseeeeeeeeseeeeeeeeeeeaeeeeeeneeeeesaees 23 2 3 9 OSX LACCM SS WIZ ANC oesi E niet ts meden statue reutqmede 26 3 Acronyms and abbreviations ccccceeeeeeeeeeeeeeeeeeeeeeeeeeseeeeeeenenees 32 4 References eS ea 33 5 Revision hiStory s asnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nn 34 2 35 DoclD027533 Rev 3 Kyy UM1866 1 1 1 2 3 osxMotionFX librar
23. epresents orientation of the system in four numbers format this format gives the same information as rotation it has advantages for computation and therefore it is usually used by other algorithms which can follow the sensor fusion e gravity represents the static acceleration i e Earth s gravity vector extracted from acceleration data e linear_acceleration represents the dynamic acceleration i e movement vector extracted from acceleration data e heading represents the direction to the magnetic North Based on practical experience it is recommended to use 100 Hz as output data rate for the sensor fusion library For this reason it is important to set up adequately the output data rate of the sensors The gyroscope and the accelerometer should use an output data rate more than 100 Hz The magnetometer can be set to a lower output data rate i e an output data rate of 20 40 Hz is typically good for LISS3MDL sensor The osxMotionFX library is capable to compute both 6 axis and 9 axis sensor fusion It can even do it in parallel The library parameters structure osxMFX_knobs and the library output structure osxMFX_output have several fields which are dedicated to 6 axis and 9 axis respectively It is only necessary to enable the desired 6 axis or 9 axis operation by calling osx_MotionFX_enable_6X or osx_MotionFX_enable_9X respectively For 6 axis sensor fusion magnetometer data are not required It is possible to scale the system requir
24. erms of this agreement before continuing with the installation Notice This Software nduding as the case may be software in binary form documentation and other related items is provided by ST under the terms of this license By using this Software you the licensee agree that you have read understood and will comply with the following terms and conditions All rights not expressly granted under this license are reserved LIMITED LICENSE AGREEMENT FOR ST MATERIALS EVALUATION I accept the agreement _ I do not accept the agreement In the next step the installer asks for the destination location of the osx License Wizard as shown in Figure 30 osx License Wizard snapshot 3 3 DocID027533 Rev 3 27 35 System setup guide UM1866 Figure 30 osx License Wizard snapshot 3 Setup OSX LicenseWizard Select Destination Location Where should OSX LicenseWizard be installed b Setup will install OSX LicenseWizard into the following folder To continue dick Next If you would like to select a different folder dick Browse Microelectronics OpenSoftwareX Open MEMS MotionFX for STM32 Browse At least 25 0 MB of free disk space is required lt Back Cancel In the next step you must provide the path to the Start menu folder where the shortcuts are installed see Figure 31 osx License Wizard snapshot 4 Figure 31 osx License Wizard snapshot 4 Setup OSX LicenseWizard Select Start Men
25. formation about the APIs of osxMotionFX and compass calibration libraries can be found in a compiled HTML file named OSXMotionFX_Package chm and located in the Documentation folder of the software package where all the functions and parameters are fully described The osxMotionFX engine is provided as a node locked library which allows derivative firmware images to run on a specific STM32 Nucleo device only Licensing activation codes must to be requested from ST and included in the project and will become part of the build process prior to attempting its usage The resulting firmware binary image will therefore be node locked For complete information about the open MEMS license agreement please refer to the license file located in the Middlewares ST STM32_OSX_MotionFX_Library folder Sample application description A sample application of osxMotionFX fusion and compass calibration using the sensor expansion board with the NUCLEO F401RE board or the NUCLEO L476RG board can be found into the Projects folder of the software package In this application sensor and sensor fusion data are transmitted in real time from the Nucleo board to PC via UART interface Transmitted data can be viewed using sensors DataLog application a PC based application developed by ST Microelectronics included in the X CUBE MEMS1 package refer to section 1 6 for detailed usage of utility that reads and visualizes the sensors data and the sensor fusion data For mo
26. hw UM1866 Y life augmented User manual Getting started with the osxMotionFx fusion and compass library for X CUBE MEMS1 expansion for STM32Cube Introduction This user manual describes the osxMotionFX fusion and compass calibration library The osxMotionFX Suite is filtering and predictive software It uses advanced algorithms to integrate outputs from multiple MEMS sensors in a smart way independent of environmental conditions to reach optimum performance osxMotionFX is an add on software package for the X CUBE MEMS1 expansion for STM32Cube This manual also provides an overview of the sample application using the library APIs and running on the STM32 Nucleo equipped with the X NUCLEO IKS0O1A1 expansion board Finally it presents an overview of the software installer used to install the software package on a Windows PC The software is based on STM32Cube technology and expands STM32Cube based packages Information about STM32Cube is available on www st com at http www st com stm32cube October 2015 DoclID027533 Rev 3 1 35 www st com Contents UM1866 Contents 1 osxMotionFX library add on of X CUBE MEMS1 software EXDaNSION f r SUM G2 CU C sasia Ra aa 3 1 1 NENION oss asec caresses E 3 1 2 PU TUS UTO ean E E EER E 3 1 3 FOGOS U UO e E E AE 4 1 4 AP a E 5 1 5 Sample application AESCLIPtION cccccceececseeeeeeeeeeseeeeeseeeeeeaeeeeens 5 1 5 1 6 axis and 9 axis sensor fusion osxMotionFX library cc 5 1 5 2 s
27. ion software to access and use the sensor expansion board are the following e STM32Cube HAL layer The HAL driver layer provides a generic multi instance simple set of APIs application programming interfaces to interact with the upper layers application libraries and stacks It is composed of generic and extension APIs It is directly built around a generic architecture and allows the layers that are built upon such as the middleware layer to implement their functionalities without dependencies on the specific hardware configuration for a given microcontroller unit MCU This structure improves library code reusability and guarantees easy portability to other devices e Board support package BSP layer The software package needs to support the peripherals on the STM32 Nucleo board apart from the MCU This software is included in the board support package BSP This is a limited set of APIs which provides a programming interface for certain board specific peripherals e g the LED user button etc This interface also helps in identifying the specific board version If the sensor expansion board is used it provides the programming interface for various inertial and environmental sensors It provides support for initializing and reading sensor data DoclD027533 Rev 3 3 35 osxMotionFxX library add on of X CUBE MEMS1 UM1866 software expansion for STM32Cube The diagram below outlines the software architecture of the package Figure 1
28. ision Changes 15 Apr 2015 HEES 12 Jun 2015 D Updated Title on the cover page and osxMotionFX plus X CUBE MEMS1 software architecture figure 06 Oct 2015 3 Updated Section 1 5 1 6 axis and 9 axis sensor fusion osxMotionFX library ky 34 35 DoclD027533 Rev 3 UM1866 IMPORTANT NOTICE PLEASE READ CAREFULLY STMicroelectronics NV and its subsidiaries ST reserve the right to make changes corrections enhancements modifications and improvements to ST products and or to this document at any time without notice Purchasers should obtain the latest relevant information on ST products before placing orders ST products are sold pursuant to ST s terms and conditions of sale in place at the time of order acknowledgement Purchasers are solely responsible for the choice selection and use of ST products and ST assumes no liability for application assistance or the design of Purchasers products No license express or implied to any intellectual property right is granted by ST herein Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product ST and the ST logo are trademarks of ST All other product or service names are the property of their respective owners Information in this document supersedes and replaces information previously supplied in any prior versions of this document 2015 STMicroelectronics All rights reserved Kys Do
29. not expressly granted under this license are reserved LIMITED LICENSE AGREEMENT FOR ST MATERIALS EVALUATION OpenSoftwareX M1 IMPORTANT READ CAREFULLY This Limited License Agreement LLA for ST materials is made between you on behalf of yourself or on behalf of any entity by which you are employed or engaged collectively referred to in this LLA as You or Licensee and STMicroelectronics International NV a company incorporated under the laws of the Netherlands acting for the purpose of this LLA through its Swiss branch located at 39 Chemin du Champ des Filles 1228 Plan les Ouates Geneve Switzerland hereinafter ST Affiliates shall mean any corporation partnership or I accept the terms in the license agreement I do not accept the terms in the license agreement Cancel Finally you press the Send license request email button as shown in Figure 37 osx License Wizard snapshot 10 Figure 37 osx License Wizard snapshot 10 OSX License Wizard v1 090 Tools Help Nudeo board User information i Board model ORE User name Mario Rossi y f Flash size 512KB Company STMicroelectronics Ram sze 96KB Emal mario rossi st com e augmented Site identification S pa MotionFX v1 2 0 6x 9x Sensor Fusion Node code DFD02123EDC8E6277908SCCEED 72139 Identify STM32 Nudeo board OpenSoftwarex a Generate icense request Copy the text in the below section between
30. o the following folder To continue click Next If you would like to select a different folder dick Browse gt Program Files x86 STMicroelectronics OpenSoftwareXx Browse At least 27 9 MB of free disk space is required me Gea After this you must provide the path to the X CUBE MEMS1 package see Figure 26 osxMotionFX installer snapshot 5 Remember to insert the correct path to the X CUBE MEMS1 package otherwise the sample application will not compile This is the path where you can locate the folders Documentation Projects Drivers Utilities etc contained in the X CUBE MEMS1 software package In our example it is C workspace STM32CubeExpansion MEMS1_V1 2 0 3 DoclD027533 Rev 3 System setup guide UM1866 Figure 26 osxMotionFX installer snapshot 5 Setup OSX MotionFX Library Select STM32 Workspace Directory Where should middleware libraries be installed Select the folder in which Setup should install library files then dick Next This should be the root path of an existing X CUBE MEMS 1 installation if available where this library and accompanying application code will be installed If a new workspace folder is created just be aware that an STM32Cube and relevant component drivers are required to build the induded application code C workspace STM32CubeExpansion_MEMS1_V1 2 0 In the next step you must provide the path to the Start menu folder where the short
31. ors DataLog Utility snapshot 3 yj Sensors_Datalog V1 3 0 STMicroelectronics Settings If A COM Devices COM13 Zi vos SEYE a O Er JE Interval ms 500 Pressure mbar V Temperature C V Humidity v Accelerometer XYZ mg V Gyroscope XYZ mdps V Magnetometer XYZ mgauss V Start Start Sensor Fusion kys ife augmented Press Start and data is displayed as shown in Figure 11 Sensors _DataLog Utility snapshot 4 Figure 11 Sensors_DataLog Utility snapshot 4 A bak i Lii ime uwe L RI ux ise imo 133400 LIA 35500 teed eA 0 i AS FELEI I BeBe Se guecegecease ETI FRETE ATIRE HR FETE E ieaie ii a sec BEES FEET SSSRATVIAGSAS St eeeheas 8 Press Start Sensor Fusion and a 3D cube is displayed as shown in Figure 12 Sensors_DataLog Utility snapshot 5 The cube animation is generated using sensor fusion quaternions 3 DocID027533 Rev 3 15 35 osxMotionFxX library add on of X CUBE MEMS1 UM1866 software expansion for STM382Cube Figure 12 Sensors DataLog Utility snapshot 5 9 Check the Log CheckBox in order to see the MEMS sensors data and the sensor fusion data quaternions and Euler angles as shown in Figure 13 Sensors_DataLog Utility snapshot 6 Figure 13 Sensors DataLog Utility snapshot 6 tn sl Stee om s m TT 29028 2 moan s PEELE
32. osxMotionFX plus X CUBE MEMS1 software architecture Sample Application OSXMotionFX CMSIS Middleware Hardware Abstraction Layer API Boards Support Packages E Ge Se Es ae HW Components STM32 Nucleo Board X NUCLEO IKS01A1 Expansion Board L Board Demonstrations j 7 GSPG2702151120SG 1 3 Folders structure This section provides an overview of the package folders structure The image below outlines the architecture of the package Figure 2 osxMotionFX package folder structure do _htmresc p Documentation do Middlewares di Projects 05XMotionFX_package xml e OSXMotionFX_Release_Notes html The following folders are included in the software package e Documentation this folder contains a compiled HTML file generated from the source code and documenting in detail the software components and APIs e Middlewares this folder contains the osxMotionFX library binary code documentation and license information e Projects this folder contains a sample application used to access sensor and sensor fusion data provided for the NUCLEO F401RE and the NUCLEO L476RG platforms 4 35 DocID027533 Rev 3 Kys UM1866 1 4 1 5 1 5 1 3 osxMotionFX library add on of X CUBE MEMS1 software expansion for STM32Cube with three development environments IAR Embedded Workbench for ARM RealView Microcontroller Development Kit MDK ARM System Workbench for STM32 APIs Detailed technical in
33. rd iron effect and gyroscope calibration routines Hard iron distortion is normally generated by ferromagnetic material with permanent magnetic fields that are part of the object e g a tablet in use These materials could be permanent magnets or magnetized iron or steel They are time invariant and deform the local geomagnetic field with different offset on different directions Generally if the user performs many 3D rotations of the object in an ideal environment no hard iron soft iron distortion and plots the collected magnetic sensor raw data the result will be a perfect sphere with no offset Figure 4 Magnetometer data in ideal environment or after calibration 500 400 300 200 The hard iron distortion effect is to offset the sphere along the x y and z axes in the x y plane the hard iron distortion is identified by an offset of the origin of the ideal circle from 0 0 scatter plots for XY and XZ axis are ok to see if there is an offset DoclD027533 Rev 3 9 35 osxMotionFxX library add on of X CUBE MEMS1 UM1866 software expansion for STM32Cube 10 35 Figure 5 Magnetometer data disturbed by hard iron effect Soft iron distortion is generated by magnetically soft materials or current carrying PCB traces While the hard iron distortion is constant regardless of the orientation the soft iron distortion changes with the orientation of the object in the Earth s field soft magnetic materials are changing th
34. re information about MotionFX engine refer to paragraph 1 5 1 When the board is powered on the compass is not calibrated When the compass is not calibrated LED2 green LED of the Nucleo board is off In order to calibrate the compass press the user button on the Nucleo board and perform the 8 movement calibration see paragraph 1 5 2 for details You can calibrate the compass only when the sensor fusion is activated press the Start Sensor Fusion button on the PC GUI When the calibration is done LED2 turns on and the compass points to the north By default the calibration data is stored in RAM memory in order to be preserved when the board is reset It is also possible to store calibration data in Flash memory To do this you need to compile the sample application DataLogFusion defining OSXMOTIONFX_STORE_CALIB_ FLASH in the project By default the application uses the fusion 9X accelerometer gyroscope magnetometer You can switch dynamically from fusion 9X to fusion 6X accelerometer gyroscope pushing the apposite button on the Sensors _DataLog GUI When using the fusion 6X the compass calibration is no longer required 6 axis and 9 axis sensor fusion osxMotionFX library The osxMotionFX library implements sensor fusion algorithm for estimation of 3D orientation in space It uses digital filter based on Kalman theory to fuse data from several sensors Using this method it compensates for limitations of single sen
35. scope offset done automatically all the time Accelerometer calibration is not necessary for sensor fusion except for applications demanding very high orientation precision Accelerometer calibration requires placing the system into a several positions perfectly aligned with direction of Earth gravity see AN3182 for more information The osxMotionFX library includes the magnetometer calibration library which compensates the hard iron distortions The magnetometer calibration can be done periodically at a slower frequency than sensor fusion output data rate e g 25 Hz and the flow can be Summarized as 1 Set input data from accelerometer and magnetometer to calibration library osx_MotionFX_compass_saveAcc and osx_MotionFX_compass_saveMag functions 2 Call calibration function osx_MotionFX_compass_run function 3 Check if calibration was successful osx_MotionFX_compass_isCalibrated function DocID027533 Rev 3 ky UM1866 osxMotionFxX library add on of X CUBE MEMS1 software expansion for STM382Cube If it returns 1 then the calibration was successful and the results magnetometer offset can be read by osx_MotionFX_getCalibrationData function Otherwise it needs to repeat all the operations from step 1 4 Apply calibration results MAG _Calibrated AXIS_X MAG_Value AXIS_X magOffset magOffx MAG _Calibrated AXIS_Y MAG_Value AXIS_Y magOffset magOffY MAG _Calibrated AXIS_Z MAG_Value AXIS_Z magOffset magOffZ
36. sors For instance a gyroscope suffers from data drift that can affect the orientation estimation This can be fixed by using the magnetometer that provides absolute orientation value On the contrary magnetometer has not a very high bandwidth and suffers of magnetic disturbance all these weaknesses can be compensated through the usage of gyroscope 9 axis sensor fusion DoclD027533 Rev 3 0 35 osxMotionFX library add on of X CUBE MEMS1 UM1866 software expansion for STM32Cube 6 35 utilizes data from accelerometer gyroscope and magnetometer A G M and provides absolute orientation in 3D space including heading i e magnetic North direction 6 axis sensor fusion utilizes data from accelerometer and gyroscope A G it does not use magnetometer It has lower computational requirements but it does not provide information about absolute orientation of the device 6 axis sensor fusion is good for fast movements e g for gaming and when absolute orientation is not necessary The osxMotionF xX library contains both 6 and 9 axis sensor fusion 6 axis and 9 axis sensor fusion algorithms are integrated in one library They can even be running simultaneously The osxMotionFX library has two very important internal functions which execute the sensor fusion computation osx_MotionFX_propagate and osx_MotionFX_update The osx_MotionFX_propagate is a prediction function and it is used to estimate the orientation in 3D space This phase weights more gyroscope
37. u Folder Where should Setup place the program s shortcuts i Setup will create the program s shortcuts in the following Start Menu folder To continue dick Next If you would like to select a different folder dick Browse f Microelectronics OpenSoftwareX Open MEMS MotionFX for STM32 Browse lt Back Cret Cancel After this step the osx License Wizard can finish the software installation The osx License Wizard needs to access some information on the Nucleo board in order to create the request for the node locked license For this reason the osx License Wizard asks for the installation of some additional packages Microsoft VS 2013 redistributable and STM32 ST LINK Utility if you have not already installed them see Figure 32 osx License Wizard snapshot 5 0 28 35 DocID027533 Rev 3 UM1866 System setup guide Figure 32 osx License Wizard snapshot 5 Setup OSX LicenseWizard Completing the OSX Vy f i LicenseWizard Setup Wizard Setup has finished installing OSX LicenseWizard on your computer The application may be launched by selecting the installed icons C S bi Click Finish to exit Setup pens SoMtwarler ile augmented V Microsoft VS2013 redistributable required MEMS 7 STM32 ST LINK Utility v3 5 required V Run the LicenseWizard Before starting the osx License Wizard you must connect via USB cable the Nucleo board that you want to link to the node locked license Th
38. under this license are reserved LIMITED LICENSE AGREEMENT FOR ST MATERIALS EVALUATION I accept the agreement C I do not accept the agreement The installer provides some information such as the requirements of the latest release of the X CUBE MEMS1 software package see Figure 24 osxMotionFX installer snapshot 3 0 24 35 DoclD027533 Rev 3 UM1866 System setup guide Figure 24 osxMotionFX installer snapshot 3 Setup OSX MotionFX Library Information Please read the following important information before continuing When you are ready to continue with Setup click Next OSX Open MEMS MotionFX v1 1 0 This application will install the MotionFX node locked libraries to the Middleware folder inside the STM32 workspace folder if available IMPORTANT latest X CUBE MEMS1 package required To build the included sample application you should download and install the latest version of the X CUBE MEMS1 software from here http Jiwww st com web catalog tools FM116 SC1248 PF261191 CHANGE LOG Updated MotionFX API v1 0 6 lt Bak next gt canei In the next step the installer asks for the destination location of the osxMotionFX library as shown in Figure 25 osxMotionFX installer snapshot 4 Figure 25 osxMotionFX installer snapshot 4 Setup OSX MotionFX Library Select Destination Location Where should OSX MotionFX Library be installed b Setup will install OSX MotionFX Library int
39. y add on of X CUBE MEMS1 software expansion for STM32Cube osxMotionFX library add on of X CUBE MEMS1 software expansion for STM32Cube Overview The osxMotionFX library is a software package that expands the functionality provided by X CUBE MEMS1 software The key features of the package are e Complete middleware to build applications using temperature and humidity sensors HTS221 a pressure sensor LPS25HB and motion sensors LISSMDL and LSM6DS0 e Gyroscope bias and magnetometer offset calibration routine e osxMotionFX INEMOEngine PRO real time motion sensor data fusion under OPEN MEMS license e Easy portability across different MCU families thanks to STM32Cube e Sample application to transmit real time sensor and sensor fusion data to a PC e Sample implementation available on board X NUCLEO IKSO1A1 when connected to NUCLEO F401RE or NUCLEO L476RG The osxMotionFX iINEMOEngine PRO suite is filtering and predictive software It uses advanced algorithms to integrate outputs from multiple MEMS sensors in a smart way independent of environmental conditions to reach optimum performance The software comes with a sample application running on X NUCLEO IKS01A1 when connected to a NUCLEO F401RE or a NUCLEO L476RG Architecture This software is an expansion for X CUBE MEMS1 software The package extends STM32Cube by providing a middleware component for the osxMotionFX library The software layers used by the applicat
40. y of the STM32 Nucleo open development platform with a wide choice of specialized expansion boards The STM32 Nucleo board does not require any separate probes as it integrates the ST LINK V2 1 debugger programmer The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples Information about the STM32 Nucleo boards is available on st com at http www st com stm32nucleo Figure 19 STM32 Nucleo board Enabled GSPG2301151455SG X NUCLEO IKS01A1 expansion board The X NUCLEO IKSO01A1 is a sensor expansion board for use with the STM32 Nucleo system It is also compatible with Arduino UNO R3 connector layout and is designed around the STMicroelectronics humidity HTS221 pressure LPS25HB and motion sensors LISSMDL and LSM6DS0 The X NUCLEO IKS01A1 interfaces with the STM32 MCU via I C pin and the user can change the default I C address and the device IRQ by changing one resistor on the evaluation board 0 DoclD027533 Rev 3 UM1866 System setup guide Figure 20 X NUCLEO IKS01A1 sensor expansion board 15998 TT 2126 PLOIECH 1 94V A HSB EER SBL o5 JP2 c4 FTH C6 X NUCLE0 IKS01A1 Information about the X NUCLEO IKS01A1 expansion board is available on st com at http www st com x nucleo Figure 21 Sensor expansion board connected to STM32 Nucleo board rn tes HEM 4D o Ha 4 ER rt oa DO ct M8 m7 TFR or NENA fim
Download Pdf Manuals
Related Search
Related Contents
μ -7020 / μ -7010 取扱説明書 Playing of audio via voice calls initiated from visual navigation Micro-ondas com convecção e grelhador 製品安全データシート - GE Healthcare Life Sciences 広告ページです。レポートは次ページから⇒⇒⇒ SETTOP Athletics ENG - Al Samsung JET Manual de Usuario Copyright © All rights reserved.
Failed to retrieve file