Sensors Knowledge Base

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sensors Knowledge Base

Discussions

Sort by:
Posted here in response to a query by Michael Smorto. Regards, Mike Stanley
View full article
This is a standalone project generated via the Kinetis Project Generator tool for SF Version 7.1 operating on K64F/MULT2B shield with FreeRTOS.
View full article
Attached is an LPCExpresso project for LPC1549.  It is compatible with the latest version of the Sensor Fusion Toolbox for Windows (the version targeted at Version 6.00 and 7.00 sensor fusion).  This project is a variant on the Sensor Fusion Version 6.00 library.  Algorithmically this is virtually identical to Version 7.00.
View full article
All, Drop the attached into SDK_2.0_FRDM-KL25Z/boards/frdmkl25z_virtual_shield/issdk_examples/algorithms/sensorfusion/baremetal_sensor_fusion. Apologies for both the delay in posting and the fact that even though I thought I was linking to files elsewhere in the system, I ended up getting local copies built into this project.  Some of you may like that.  I don't particularly.  But as I've noted elsewhere, KDS and I have our differences... Regards, Mike
View full article
All, The attached was put together in response to the posting by Andrew Hartnett.  It contains a bare-metal IAR project for 9-axis sensor fusion V7.00 on the KL25Z.  You need to have built KSDK for the KL25Z to include the ISSDK option.  Then unzip this file into your SDK_2.0_FRDM-KL25Z/boards directory.  The sample project is then located at SDK_2.0_FRDM-KL25Z/boards/frdmkl25z_virtual_shield/issdk_examples/algorithms/sensorfusion/baremetal_sensor_fusion/iar. There is also an included freertos_sensor_fusion project.  Ignore that for now.  It compiles and links, but needs more RAM than the KL25Z supplies.  I'm looking at ways to decrease the RAM requirements to fit. Regards, Mike
View full article
This this shows how to implement the power cycling feature described in Section 4.8, Fusion Standby mode, of the Version 7.00 Sensor Fusion User Guide.  It will power down the gyro when the board is stationary, and also suspend sensor fusion.   Last computed results continue to be sent until new motion is detected.  One nice side effect is that 6-axis yaw drift is almost eliminated.
View full article
Here's a zip file which incorporates the patch I outlined in my previous posting.
View full article
As requested in a prior posting...
View full article
All, We are busily working to integrate Version 7.00 of the sensor fusion library into the Kinetis Expert (KEX) ecosystem.  ETA is early August.  I have attached here a preview copy of the user manual for that release.  This is subject to the usual disclaimers: content subject to change, no liability, yada yada yada.  There are a LOT of changes.    These are documented ad nauseum in the user guide.  I've also added a lot of our old blog content into the user guide, as I keep getting requests for them.  Please take a look and give me your feedback.   FYI, Here is a sample main() for the new fusion, running on FreeRTOS:   /* FreeRTOS kernel includes. */ #include "FreeRTOS.h" #include "task.h" #include "queue.h" #include "timers.h" #include "event_groups.h" // KSDK and ISSDK Headers #include "fsl_debug_console.h"  // KSDK header file for the debug interface #include "board.h"              // KSDK header file to define board configuration #include "pin_mux.h"            // KSDK header file for pin mux initialization functions #include "clock_config.h"       // KSDK header file for clock configuration #include "fsl_port.h"           // KSDK header file for Port I/O control #include "fsl_i2c.h"            // KSDK header file for I2C interfaces #include "Driver_I2C_SDK2.h"    // ISSDK header file for CMSIS I2C Driver #include "fxas21002.h"          // register address and bit field definitions #include "mpl3115.h"            // register address and bit field definitions #include "fxos8700.h"           // register address and bit field definitions // Sensor Fusion Headers #include "sensor_fusion.h"      // top level magCal and sensor fusion interfaces #include "control.h"           // Command/Streaming interface - application specific #include "status.h"            // Sta:tus indicator interface - application specific #include "drivers.h"           // NXP sensor drivers OR customer-supplied drivers // Global data structures SensorFusionGlobals sfg;                ///< This is the primary sensor fusion data structure ControlSubsystem controlSubsystem;      ///< used for serial communications StatusSubsystem statusSubsystem;        ///< provides visual (usually LED) status indicator PhysicalSensor sensors[3];              ///< This implementation uses three physical sensors EventGroupHandle_t event_group = NULL; static void read_task(void *pvParameters);              // FreeRTOS Task definition static void fusion_task(void *pvParameters);            // FreeRTOS Task definition /// This is a FreeRTOS (dual task) implementation of the NXP sensor fusion demo build. int main(void) {     ARM_DRIVER_I2C* I2Cdrv = &I2C_S_DRIVER_BLOCKING;       // defined in the <shield>.h file     BOARD_InitPins();                   // defined in pin_mux.c, initializes pkg pins     BOARD_BootClockRUN();               // defined in clock_config.c, initializes clocks     BOARD_InitDebugConsole();           // defined in board.c, initializes the OpenSDA port     I2Cdrv->Initialize(NULL);                                 // Initialize the KSDK driver for the I2C port     I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);      // Configure the I2C bus speed     initializeControlPort(&controlSubsystem);                           // configure pins and ports for the control sub-system     initializeStatusSubsystem(&statusSubsystem);                        // configure pins and ports for the status sub-system     initSensorFusionGlobals(&sfg, &statusSubsystem, &controlSubsystem); // Initialize sensor fusion structures     // "install" the sensors we will be using     sfg.installSensor(&sfg, &sensors[0], FXOS8700_I2C_ADDR, 1, (void*) I2Cdrv, FXOS8700_Init,  FXOS8700_Read);     sfg.installSensor(&sfg, &sensors[1], FXAS21002_I2C_ADDR, 1, (void*) I2Cdrv, FXAS21002_Init, FXAS21002_Read);     sfg.installSensor(&sfg, &sensors[2], MPL3115_I2C_ADDR, 2, (void*) I2Cdrv, MPL3115_Init, MPL3115_Read);     sfg.initializeFusionEngine(&sfg);         // This will initialize sensors and magnetic calibration     event_group = xEventGroupCreate();     xTaskCreate(read_task, "READ", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, NULL);     xTaskCreate(fusion_task, "FUSION", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL);     sfg.setStatus(&sfg, NORMAL);                // If we got this far, let's set status state to NORMAL     vTaskStartScheduler();                      // Start the RTOS scheduler     sfg.setStatus(&sfg, HARD_FAULT);            // If we got this far, FreeRTOS does not have enough memory allocated     for (;;) ; } static void read_task(void *pvParameters) {     uint16_t i=0;                       // general counter variable     portTickType lastWakeTime;     const portTickType frequency = 1;   // tick counter runs at the read rate     lastWakeTime = xTaskGetTickCount();     while (1)     {         for (i=1; i<=OVERSAMPLE_RATE; i++) {             vTaskDelayUntil(&lastWakeTime, frequency);             sfg.readSensors(&sfg, i);              // Reads sensors, applies HAL and does averaging (if applicable)         }         xEventGroupSetBits(event_group, B0);     } } static void fusion_task(void *pvParameters) {     uint16_t i=0;  // general counter variable     while (1)     {         xEventGroupWaitBits(event_group,    /* The event group handle. */                             B0,             /* The bit pattern the event group is waiting for. */                             pdTRUE,         /* BIT_0 and BIT_4 will be cleared automatically. */                             pdFALSE,        /* Don't wait for both bits, either bit unblock task. */                             portMAX_DELAY); /* Block indefinitely to wait for the condition to be met. */         sfg.conditionSensorReadings(&sfg);  // magCal is run as part of this         sfg.runFusion(&sfg);                // Run the actual fusion algorithms         sfg.applyPerturbation(&sfg);        // apply debug perturbation (testing only)         sfg.loopcounter++;                  // The loop counter is used to "serialize" mag cal operations         i=i+1;         if (i>=4) {                         // Some status codes include a "blink" feature.  This loop                 i=0;                        // should cycle at least four times for that to operate correctly.                 sfg.updateStatus(&sfg);     // This is where pending status updates are made visible         }         sfg.queueStatus(&sfg, NORMAL);      // assume NORMAL status for next pass through the loop         sfg.pControlSubsystem->stream(&sfg, sUARTOutputBuffer);      // Send stream data to the Sensor Fusion Toolbox     } } /// \endcode
View full article
All, We've had some problems with migration of Freescale blogs over to the NXP domain.  One set of listings that gets requested a fair bit are the postings on orientation representations.  The attached is a PDF version of the same material which will be contained in the upcoming Sensor Fusion Version 7.00 User Guide.
View full article
You will have to add a .exe extension to the unzipped file.
View full article
I am occasionally asked for the source code for the Android version of our Sensor Fusion Toolbox.  Well, here it is, complete with new NXP graphics and updated links.
View full article
All, This is my personal "cheat sheet" that I use as reference whenever I have to code angular transformations from one frame of reference to another.  There's nothing unique here, it just organizes things in a way that I can find them quickly.  I hope you find it useful. Mike
View full article
Attached is a PDF dump of a classic blog post.  Please forgive the format problems.  I'll work with the web team in January to get it reposted to the NXP site. Mike
View full article
The attached is the windows installer for the latest verson of the Windows version of the Freescale Sensor Fusion Toolbox.  This version must be used with Version 5.00 of the sensor fusion library.  It is NOT backward compatible, as the structure of the undocumented Kalman filter packet has changed. Please uninstall any prior versions of the toolbox before running this installer. As in prior releases, you can reflash your Freedom boards from within the application itself.  So if you want to try the new fusion without downloading the new library and firing up KDS or CodeWarrior, you can. Version 5.00 was posted to this same board just a few minutes ago in a separate post.  It contains full documentation, including algorithm development, datasheet and user guide. Regards, Mike Stanley
View full article
You saw it here first! The attached zip file contains full documentation and source code (both CodeWarrior and KDS) for Version 5 of Freescale's Sensor Fusion Library for Kinetis MCUs. The 6 and 9-axis Kalman filters have been rewritten from scratch by fusion expert Mark Pedley.  The new versions have improved dynamic tracking and at-rest stability.  All documentation has been updated, and full implementation details are included.  We continue to use the BSD 3-clause software license, so you are virtually unlimited in how you use the library.   I will note that due to the Kalman filter changes, Mark made some changes to the undocumented Kalman filter packets which are utilized by the Windows Version of the Freescale Sensor Fusion Toolbox.  This breaks compatibility with older versions of the toolbox.  I will be posting a pre-release of the new one immediately after completing this post.  The Android version of the toolbox does not make use of the Kalman filter packet, and should be forward compatible - although an updated version of that is in the works as well.   Structure of the new library is very similar to Version 4.22, which was the previous production version.  There are changes, but I don't expect anyone to have problems adapting existing projects to the new version of the library.  I think you will get improved performance if you do.   Regards, Mike Stanley
View full article
All, Twitter traffic revealed a need for PDF versions of the sensor fusion documentation.  Apologies for any inconvenience.  Our standard documents are in Word format (we make extensive use of the equation tools in Word), and we supply them in that same format to make it easy to reuse the material.  But for those who do not have Word, please see the attached PDF. Regards, Mike
View full article
clicktaleID