Sensors Knowledge Base

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

Sensors Knowledge Base

Discussions

Sort by:
Unibody Package with Side Port_867B-04  
View full article
Hi Everyone, As I am often asked for a simple bare metal example code illustrating the use of the accelerometer vector-magnitude function, I have decided to share here one of my examples I created for the FXLS8471Q accelerometer while working with the Freescale FRDM-KL25Z platform and FRDM-FXS-MULT2-B sensor expansion board. This example code complements the Python code snippet from the AN4692. The FXLS8471Q is set for detection of a change in tilt angle exceeding 17.25° from the horizontal plane. Once an event is triggered, an interrupt will be generated on the INT1 pin: void FXLS8471Q_Init (void) {      FXLS8471Q_WriteRegister(A_VECM_THS_MSB_REG, 0x84);            // Threshold value set to 300mg or ~17.25°    FXLS8471Q_WriteRegister(A_VECM_THS_LSB_REG, 0xCC);          FXLS8471Q_WriteRegister(A_VECM_CNT_REG, 0x01);                // Debounce timer period set to 80ms          FXLS8471Q_WriteRegister(A_VECM_INITX_MSB_REG, 0x00);    FXLS8471Q_WriteRegister(A_VECM_INITX_LSB_REG, 0x00);    FXLS8471Q_WriteRegister(A_VECM_INITY_MSB_REG, 0x00);    FXLS8471Q_WriteRegister(A_VECM_INITY_LSB_REG, 0x00);    FXLS8471Q_WriteRegister(A_VECM_INITZ_MSB_REG, 0x10);          // Set Z-axis to 1g  as a reference value    FXLS8471Q_WriteRegister(A_VECM_INITZ_LSB_REG, 0x00);          FXLS8471Q_WriteRegister(A_VECM_CFG_REG, 0x78);                // Event latch enabled, A_VECM_INITX/Y/Z used as initial reference, acceleration vector-magnitude detection feature enabled          FXLS8471Q_WriteRegister(CTRL_REG4, 0x02);                     // Acceleration vector-magnitude interrupt enabled    FXLS8471Q_WriteRegister(CTRL_REG5, 0x02);                     // Acceleration vector-magnitude interrupt routed to INT1 - PTA5          FXLS8471Q_WriteRegister(CTRL_REG1, 0x29);                     // ODR = 12.5Hz, Active mode } In the ISR, only the interrupt flag is cleared and the  INT_SOURCE (0x0C) register is read in order to clear the SRC_A_VECM status bit and deassert the INT1 pin, as shown on the screenshot below. void PORTA_IRQHandler() {    PORTA_PCR5 |= PORT_PCR_ISF_MASK;                              // Clear the interrupt flag    IntSource = FXLS8471Q_ReadRegister(INT_SOURCE_REG);           // Read the INT_SOURCE register to clear the SRC_A_VECM bit   } Attached you can find the complete source code. If there are any questions regarding this simple example code, please feel free to ask below. Your feedback or suggestions are also welcome. Regards, Tomas
View full article
The FXLS8471Q Freescale accelerometer is highly versatile for industrial and consumer high-performance low-g applications that offer noise density, board mount offset, temperature performance and sensitivity. Integrated motion detection features include tilt, shake and tap detection with a new vector magnitude output that simplifies implementation and reduces power consumption. This new FXLS8471Q accelerometer has a SPI interface that is pin-compatible with Freescale’s industry-leading I2C accelerometer portfolio. Here is a Render of the FXLS8471 Breakout- Board downloaded from OSH Park: And here is an image of the Layout Design for this board: In the Attachments section, you can find the Schematic Source File (.SCH), Schematic PDF File, Layout Source File (BRD), Gerber Files (GTL, GBL, GTS, GBS, GTO, GBO, GKO, XLN) and BOM for this Breakout-board. If you are interested in more designs like this breakout board for other sensors, please go to Freescale Sensors Breakout Boards Designs – HOME
View full article
Hi Everyone, In this document I would like to go through a simple example code I created for the FRDMKL25-A8471 kit using the KDS 3.0.2 and KSDK 2.0. I will not cover the Sensor Toolbox – CE and Intelligent Sensing Framework (ISF) which primarily support this kit. The FreeMASTER tool is used to visualize the acceleration data that are read from the FXLS8471Q using an interrupt technique through the SPI interface. This example illustrates: 1. Initialization of the MKL25Z128 MCU (mainly PORT and SPI modules). 2. SPI data write and read operations. 3. Initialization of the FXLS8471Q to achieve the highest resolution. 4. Output data reading using an interrupt technique. 5. Conversion of the output values from registers 0x01 – 0x06 to real acceleration values in g’s. 6. Visualization of the output values in the FreeMASTER tool. 1. As you can see in the FRDMSTBC-A8471/FRDM-KL25Z schematics and the image below, SPI signals are routed to the SPI0 module of the KL25Z MCU and the INT1 output is connected to the PTD4 pin. The PTD0 pin (Chip Select) is not controlled automatically by SPI0 module, hence it is configured as a general-purpose output. The INT1 output of the FXLS8471Q is configured as a push-pull active-low output, so the corresponding PTD4 pin configuration is GPIO with an interrupt on falling edge. The configuration is done in the BOARD_InitPins() function using the NXP Pins Tool for Kinetis MCUs. void BOARD_InitPins(void) {    CLOCK_EnableClock(kCLOCK_PortD);                                          /* Port D Clock Gate Control: Clock enabled */    CLOCK_EnableClock(kCLOCK_Spi0);                                           /* SPI0 Clock Gate Control: Clock enabled */    PORT_SetPinMux(PORTD, PIN1_IDX, kPORT_MuxAlt2);                           /* PORTD1 (pin 74) is configured as SPI0_SCK */    PORT_SetPinMux(PORTD, PIN2_IDX, kPORT_MuxAlt2);                           /* PORTD2 (pin 75) is configured as SPI0_MOSI */    PORT_SetPinMux(PORTD, PIN3_IDX, kPORT_MuxAlt2);                           /* PORTD3 (pin 76) is configured as SPI0_MISO */    PORT_SetPinMux(PORTD, PIN0_IDX, kPORT_MuxAsGpio);                         /* PORTD0 (pin 73) is configured as PTD0 */    GPIO_PinInit(GPIOD, PIN0_IDX, &CS_config);                                /* PTD0 = 1 (Chip Select inactive) */       PORT_SetPinMux(PORTD, PIN4_IDX , kPORT_MuxAsGpio);                        /* PORTD4 (pin 77) is configured as PTD4 */    PORT_SetPinInterruptConfig(PORTD, PIN4_IDX, kPORT_InterruptFallingEdge);  /* PTD4 is configured for falling edge interrupts */      NVIC_EnableIRQ(PORTD_IRQn);                                               /* Enable PORTD interrupt on NVIC */ } The SPI_INIT() function is used to enable and configure the SPI0 module. The FXLS8471Q uses the ‘Mode 0′ SPI protocol, which means that an inactive state of clock signal is low and data are captured on the leading edge of clock signal and changed on the falling edge. The SPI clock is 500 kHz. void SPI_Init(void) {    uint32_t sourceClock = 0U;    sourceClock = CLOCK_GetFreq(kCLOCK_BusClk);    spi_master_config_t masterConfig = {    .enableMaster = true,    .enableStopInWaitMode = false,    .polarity = kSPI_ClockPolarityActiveHigh,    .phase = kSPI_ClockPhaseFirstEdge,    .direction = kSPI_MsbFirst,    .outputMode = kSPI_SlaveSelectAsGpio,    .pinMode = kSPI_PinModeNormal,    .baudRate_Bps = 500000U     };    SPI_MasterInit(SPI0, &masterConfig, sourceClock); } 2. The falling edge on the CS pin starts the SPI communication. A write operation is initiated by transmitting a 1 for the R/W bit. Then the 8-bit register address, ADDR[7:0] is encoded in the first and second serialized bytes. Data to be written starts in the third serialized byte. The order of the bits is as follows: Byte 0: R/W, ADDR[6], ADDR[5], ADDR[4], ADDR[3], ADDR[2], ADDR[1], ADDR[0] Byte 1: ADDR[7], X, X, X, X, X, X, X Byte 2: DATA[7], DATA[6], DATA[5], DATA[4], DATA[3], DATA[2], DATA[1], DATA[0] The rising edge on the CS pin stops the SPI communication. Below is the write operation which writes the value 0x3D to the CTRL_REG1 (0x3A). Similarly a read operation is initiated by transmitting a 0 for the R/W bit. Then the 8-bit register address, ADDR[7:0] is encoded in the first and second serialized bytes. The data is read from the MISO pin (MSB first). The screenshot below shows the read operation which reads the correct value 0x6A from the WHO_AM_I register (0x0D). Multiple read operations are performed similar to single read except bytes are read in multiples of eight SCLK cycles. The register address is auto incremented so that every eighth next clock edges will latch the MSB of the next register. A burst read of 6 bytes from registers 0x01 to 0x06 is shown below. It also shows how the INT1 pin is automatically cleared by reading the acceleration output data. 3. At the beginning of the initialization, all FXLS8471Q registers are reset to their default values by setting the RST bit of the CTRL_REG2 register. The dynamic range is set to ±2g and to achieve the highest resolution, the LNOISE bit is set and the lowest ODR (1.56Hz) and the High Resolution mode are selected (more details in AN4075). The DRDY interrupt is enabled and routed to the INT1 interrupt pin that is configured to be a push-pull, active-low output. void FXLS8471Q_Init (void) {    FXLS8471Q_WriteRegister(CTRL_REG2, 0x40);            /* Reset all registers to POR values */    Pause(0xC62);                                        /* ~1ms delay */    FXLS8471Q_WriteRegister(CTRL_REG2, 0x02);            /* High Resolution mode */    FXLS8471Q_WriteRegister(CTRL_REG3, 0x00);            /* Push-pull, active low interrupt */    FXLS8471Q_WriteRegister(CTRL_REG4, 0x01);            /* Enable DRDY interrupt */    FXLS8471Q_WriteRegister(CTRL_REG5, 0x01);            /* DRDY interrupt routed to INT1 - PTD4 */    FXLS8471Q_WriteRegister(CTRL_REG1, 0x3D);            /* ODR = 1.56Hz, Reduced noise, Active mode */ } 4. In the ISR, only the interrupt flag is cleared and the DataReady variable is set to indicate the arrival of new data. void PORTD_IRQHandler(void) {    PORT_ClearPinsInterruptFlags(PORTD, 1<<4);           /* Clear the interrupt flag */    DataReady = 1; } 5. In the main loop, the DataReady variable is periodically checked and if it is set, the accelerometer registers 0x01 – 0x06 are read and then converted to signed 14-bit values and real values in g’s. if (DataReady)                                                        /* Is a new set of data ready? */ {    DataReady = 0;    FXLS8471Q_ReadMultiRegisters(OUT_X_MSB_REG, 6, AccData);           /* Read data output registers 0x01-0x06 */    Xout_14_bit = ((int16_t) (AccData[0]<<8 | AccData[1])) >> 2;       /* Compute 14-bit X-axis output value */    Yout_14_bit = ((int16_t) (AccData[2]<<8 | AccData[3])) >> 2;       /* Compute 14-bit Y-axis output value */    Zout_14_bit = ((int16_t) (AccData[4]<<8 | AccData[5])) >> 2;       /* Compute 14-bit Z-axis output value */    Xout_g = ((float) Xout_14_bit) / SENSITIVITY_2G;                   /* Compute X-axis output value in g's */    Yout_g = ((float) Yout_14_bit) / SENSITIVITY_2G;                   /* Compute Y-axis output value in g's */    Zout_g = ((float) Zout_14_bit) / SENSITIVITY_2G;                   /* Compute Z-axis output value in g's */ } 6. The calculated values can be watched in the Debug perspective or in the FreeMASTER application. To open and run the FreeMASTER project, install the FreeMASTER 2.0 application and FreeMASTER Communication Driver. Attached you can find the complete source code written in the KDS 3.0.2 including the FreeMASTER project. If there are any questions regarding this simple application, do not hesitate to ask below. Your feedback or suggestions are also welcome. Best regards, Tomas
View full article
Hands-on Training using Sensors Development Ecosystem
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
The attached is a PRE-RELEASE copy of the next version of the Freescale Sensor Fusion Library for Kinetis MCUs.  It is a pre-release because we are still working to update the datasheet and userguide to accomodate new changes.  The datasheet and user guides included in this copy are identical to the current production versions found at http://www.freescale.com/sensorfusion.  This is the first release of the library which provides ALL SOURCE CODE.  The software license is unchanged from the prior release, and is re-produced at the end of this posting.  Please do not download the file if you can't agree to these license terms.   In order to get around virus filter on the community, I've had to create a simple zip file of the fusion toolkit.  There's no installer.  Just unzip it in your directory of choice.   Pre-Release Notes for Freescale Sensor Fusion Library for Kinetis MCUs Previous production release: build 417 This release: build 420 This is a pre-release kit.  The included datasheet and user guide relate to the previous version (build 417).  Updates are in progress and will be published shortly. In the meantime, changes (at a high level) are listed below. Changes: 1.  Removed all license checking functions 2.  Fusion and magnetic calibration libraries are now included in source form.    libFusion.a is now gone.  It has been replaced by additional files in the Sources directory.  3.  Added template projects for Kinetis Design Studio 4.  Added KL46Z board support 5.  Community supported at https://community.freescale.com/community/sensors/sensorfusion 6.  The datasheet has been updated with simulated fusion metrics, code sizes and systick counts 7.  "FLASH_EU" target names have been changed to "FLASH" 8.  Changed branding from "Xtrinsic" to "Freescale".  This resulted in project prefixes  being changed from "XSFK_" to "FSFK_". 9.  Removed the Accelerometer + Magnetometer 6-axis Kalman filter (the eCompass implementation  is more efficient) 10. Debug packets are now on by default.  This enables the Sensor Fusion Toolkit for Android to startup with the correct board display on powerup. 11. The following source files have been renamed:     FSL_utils.c/.h are now drivers.c/.h     tasks_func.c/.h are now tasks.c/.h     proj_config.h is now build.h     ProcessorExpert.c is now main.c     baranski_kalman.h is now kalman.h 12. license.h has been removed 13. Added bare metal eCompass implementation for KL46Z (no MQXLite) 14. This version will not include run configurations for all KDS projects. There are too many permutations, and the tools are being regularly updated. Errata: 1.  Newer K64F Freedom boards can utilize several different versions of the OpenSDA interface.  The MBED drivers do not deal properly with flash security and can temporarily "brick" a board.  In order for the download function to work properly, the value of the NV_FSEC portion of the CPU_FLASH_CONFIG_FIELD within file name Generated_Files/CPU_Config.h must have a value of 0xFE.  Processor Expert (which generates this file) does not currently support that value.  You must make the change manually after running Processor Expert. 2.  When compiling for the first time in KDS, the tool may generate the following error message: "writing to APSR without specifying a bitmask".  This is an invalid error. Simply build a second time and the error will disappear. 3.  MQXLite 1.1.0 created via Processor Expert incorrectly handles contexts switches for the  floating point unit on the K64F.  As shipped, this does not present a problem because  floating point computations are normally completed within one sample period.  However if you add additional code to that project template, such that computations extend beyond one sample period, you will get incorrect results (there is no warning!). MQXLite 1.1.1 fixes this issue.  Check the MQX1 settings in Processor Expert to see which  version you are using. 4.  I2C transmission speeds are configured for 300KHz to 400KHz.   During the build process, it is normal to see the following:     "Warning: The device is designed to operate up to 100kHz! (SCL frequency)".     The development team routinely operates at higher I2C frequencies, although these are not necessarily guaranteed in the device datasheets.  Other warnings arise from the  MQXLite code generated by Processor Expert.  The actual fusion library is believed to be clean. Xtrinsic Sensor Fusion Library for Kinetis MCUs License: LA_OPT50 Version 20 January 2014 IMPORTANT. Read the following Freescale Software License Agreement (“Agreement”) completely.  By selecting the “I Agree” button at the end of this page, you indicate that you accept the terms of this Agreement and you also acknowledge that you have the authority, on behalf of your company, to bind your company to such terms.  You may then download or install the file. FREESCALE END-USER SOFTWARE LICENSE AGREEMENT This is a license agreement between you (either as an individual or as an authorized representative acting on behalf of your employer) and Freescale Semiconductor, Inc. (“Freescale”). It concerns your rights to use software package and any accompanying written materials (the “Software”). The Software includes any updates or error corrections or documentation relating to the Software provided to you by Freescale under this License. In consideration for Freescale allowing you to access the Software, you are agreeing to be bound by the terms of this Agreement. If you do not agree to all of the terms of this Agreement, do not download or install the Software. If you change your mind later, stop using the Software and delete all copies of the Software in your possession or control. Any copies of the Software that you have already distributed, where permitted, and do not destroy will continue to be governed by this Agreement. Your prior use will also continue to be governed by this Agreement. 1.         LICENSE GRANT. Exclusively in conjunction with Licensee’s development and sale of a product containing Freescale Xtrinsic sensor solutions (e.g., an accelerometer, magnetometer, and a gyroscope in any discrete or combined form factor) supplied directly or indirectly from Freescale (“Freescale System”), or education programs relating to the use of a Freescale System, Freescale grants to you, free of charge, the non-exclusive, non-transferable right (1) to use the Software, (2) to reproduce the Software, (3) to prepare derivative works of the Software, (4) to distribute the Software and derivative works thereof in object (machine-readable) form as part of a Freescale System, and (5) to sublicense to others the right to use the distributed Software as included within the Freescale System. If you violate any of the terms or restrictions of this Agreement, Freescale may immediately terminate this Agreement, and require that you stop using and delete all copies of the Software in your possession or control.   Any license granted above only extends to Freescale’s intellectual property rights that would be necessarily infringed by the Software as provided to you by Freescale and as used within the scope of the licenses granted.  You must advise Freescale of any results obtained including any problems or suggested improvements thereof.  Freescale retains the right to use such results and related information in any manner it deems appropriate. 2.         OTHER RESTRICTIONS.  Subject to the license grant above, the following restrictions apply: a.         Freescale reserves all rights not expressly granted herein. b.         You may not rent, lease, sublicense, lend or encumber the Software, unless otherwise expressly agreed to within this Agreement c.         You may not distribute, manufacture, have manufactured, sublicense or otherwise reproduce the Software for purposes other than intended in this Agreement. d.         You may not remove or alter any proprietary legends, notices, or trademarks contained in the Licensed Software, e.         The terms and conditions of this Agreement will apply to any Software updates, provided to you at Freescale’s discretion, that replace and/or supplement the original Software, unless such update contains a separate license. f.          You may not translate, reverse engineer, decompile, or disassemble the Software provided to you solely in object code format (machine readable) except to the extent applicable law specifically prohibits such restriction.  You will prohibit your sublicensees from translating, reverse engineering, decompiling, or disassembling the Software except to the extent applicable law specifically prohibits such restriction. 3.         OPEN SOURCE.  Any open source software included in the Software licensed herein is not licensed under the terms of this Agreement, but is instead licensed under the terms of applicable open source license(s), such as the BSD License, Apache License or the Lesser GNU General Public License.  Your use of such open source software is subject to the terms of each applicable license.  You must agree to the terms of each such applicable license, or you should not use the open source software. 4.         COPYRIGHT.  The Software is licensed to you, not sold.  Freescale owns the Software, and United States copyright laws and international treaty provisions protect the Software. Therefore, you must treat the Software like any other copyrighted material (e.g. a book or musical recording). You may not use or copy the Software for any other purpose than what is described in this Agreement. Except as expressly provided herein, Freescale does not grant to you any express or implied rights under any Freescale or third party patents, copyrights, trademarks, or trade secrets. Additionally, you must reproduce and apply any copyright or other proprietary rights notices included on or embedded in the Software to any copies made thereof, in whole or in part, if any.  You may not remove any copyright notices of Freescale incorporated in the Software. 5.         TERM AND TERMINATION.   The term of this Agreement shall commence on the date of installation or download and shall be continue until terminated in accordance with this Agreement. Freescale has the right to terminate this Agreement without notice and require that you stop using and delete all copies of the Software in your possession or control if you violate any of the terms or restrictions of this Agreement.  Freescale may terminate this Agreement should any of the Software become, or in Freescale's reasonable opinion is likely to become, the subject of a claim of intellectual infringement or trade secret misappropriation.  Upon termination, you must cease use of and destroy, the Software and confirm compliance in writing to Freescale. Upon termination, the license granted pursuant to this Agreement immediately terminates and the provisions of Sections 4 through 18 will survive any termination of this Agreement. 6.         SUPPORT.  Freescale is NOT obligated to provide any support, upgrades or new releases of the Software. If you wish, you may contact Freescale and report problems and provide suggestions regarding the Software. Freescale has no obligation whatsoever to respond in any way to such a problem report or suggestion. Freescale may make changes to the Software at any time, without any obligation to notify or provide updated versions of the Software to you. 7.         NO WARRANTY.  TO THE MAXIMUM EXTENT PERMITTED BY LAW, FREESCALE EXPRESSLY DISCLAIMS ANY WARRANTY FOR THE SOFTWARE. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. YOU ASSUME THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF THE SOFTWARE, OR ANY SYSTEMS YOU DESIGN USING THE SOFTWARE (IF ANY). NOTHING IN THIS AGREEMENT MAY BE CONSTRUED AS A WARRANTY OR REPRESENTATION BY FREESCALE THAT THE SOFTWARE OR ANY DERIVATIVE WORK DEVELOPED WITH OR INCORPORATING THE SOFTWARE WILL BE FREE FROM INFRINGEMENT OF THE INTELLECTUAL PROPERTY RIGHTS OF THIRD PARTIES. 8.         INDEMNITY. You agree to fully defend and indemnify Freescale from any and all claims, liabilities, and costs (including reasonable attorney’s fees) related to (1) your use (including your sublicensee’s use, if permitted) of the Software or (2) your violation of the terms and conditions of this Agreement. 9.         LIMITATION OF LIABILITY.  IN NO EVENT WILL FREESCALE BE LIABLE, WHETHER IN CONTRACT, TORT, OR OTHERWISE, FOR ANY INCIDENTAL, SPECIAL, INDIRECT, CONSEQUENTIAL OR PUNITIVE DAMAGES, INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR ANY LOSS OF USE, LOSS OF TIME, INCONVENIENCE, COMMERCIAL LOSS, OR LOST PROFITS, SAVINGS, OR REVENUES TO THE FULL EXTENT SUCH MAY BE DISCLAIMED BY LAW EVEN IF INFORMED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.  FREESCALE’S LIABILITY WILL IN ANY EVENT AND UNDER ANY THEORY OF RECOVERY BE LIMITED TO THE TOTAL AMOUNT RECEIVED BY FREESCALE UNDER THIS AGREEMENT. 10.       COMPLIANCE WITH LAWS; EXPORT RESTRICTIONS. You must not resell, re-export, or provide, directly or indirectly, the licensed software or direct product thereof, in any form without obtaining appropriate export or re-export licenses from the United States Government and from the country from which the export or re-export is to occur.  An export occurs when products, technology, or software is transferred from one country to another by any means, including physical shipments, FTP file transfers, E-mails, faxes, remote server access, conversations, and the like.  An export also occurs when technology or software is transferred to a foreign national in the United States, or foreign national of the country in which the business activity is taking place.  A foreign national is any person who is neither a citizen nor permanent resident of the United States, or the country in which the business activity is taking place. Furthermore, if an export/import license, permit or other government required authority (collectively referred to as “government authorization”) is required to transfer technology, software, hardware or other Freescale property to non- Freescale party(ies) and is not approved, then Freescale is not obligated to transfer the Software under this Agreement until such “government authorization” is granted.. 11.       GOVERNMENT RIGHTS.  The Licensed Software is a “Commercial Item” as defined in 48 C.F.R. §2.101, consisting of “Commercial Computer Software” and “Commercial Computer Software Documentation,” as such terms are used in 48 C.F.R. § 12.212 or 48 C.F.R. §227.7202, as applicable and are only licensed to U.S. Government end users with the rights as are set forth herein.. 12.       HIGH RISK ACTIVITIES.  You acknowledge that the Software is not fault tolerant and is not designed, manufactured or intended by Freescale for incorporation into products intended for use or resale in on-line control equipment in hazardous, dangerous to life or potentially life-threatening environments requiring fail-safe performance, such as in the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, direct life support machines or weapons systems, in which the failure of products could lead directly to death, personal injury or severe physical or environmental damage (“High Risk Activities”). You specifically represent and warrant that you will not use the Software or any derivative work of the Software for High Risk Activities. 13.       CHOICE OF LAW; VENUE; LIMITATIONS.  You agree that the statutes and laws of the United States and the State of Texas, USA, without regard to conflicts of laws principles, will apply to all matters relating to this Agreement or the Software, and you agree that any litigation will be subject to the exclusive jurisdiction of the state or federal courts in Texas, USA.  You agree that regardless of any statute or law to the contrary, any claim or cause of action arising out of or related to this Agreement or the Software must be filed within one (1) year after such claim or cause of action arose or be forever barred. 14.       CONFIDENTIAL INFORMATION.  You must treat the Software as confidential information and you agree to retain the Software in confidence perpetually, with respect to Software in source code form (human readable), or for a period of five (5) years from the date of termination of this Agreement, with respect to all other parts of the Software.  During this period you may not disclose any part of the Software to anyone other than employees who have a need to know of the Software and who have executed written agreements obligating them to protect such Licensed Software to at least the same degree of care as in this Agreement.  You agree to use the same degree of care, but no less than a reasonable degree of care, with the Software as you do with your own confidential information. You may disclose Software to the extent required by a court or under operation of law or order provided that you notify Freescale of such requirement prior to disclosure, which you only disclose information required, and that you allow Freescale the opportunity to object to such court or other legal body requiring such disclosure. 15.       PRODUCT LABELING.  You are not authorized to use any Freescale trademarks, brand names, or logos. 16.       ENTIRE AGREEMENT.  This Agreement constitutes the entire agreement between you and Freescale regarding the subject matter of this Agreement, and supersedes all prior communications, negotiations, understandings, agreements or representations, either written or oral, if any.  This Agreement may only be amended in written form, executed by you and Freescale. 17.       SEVERABILITY.  If any provision of this Agreement is held for any reason to be invalid or unenforceable, then the remaining provisions of this Agreement will be unimpaired and, unless a modification or replacement of the invalid or unenforceable provision is further held to deprive you or Freescale of a material benefit, in which case the Agreement will immediately terminate, the invalid or unenforceable provision will be replaced with a provision that is valid and enforceable and that comes closest to the intention underlying the invalid or unenforceable provision. 18.       NO WAIVER.  The waiver by Freescale of any breach of any provision of this Agreement will not operate or be construed as a waiver of any other or a subsequent breach of the same or a different provision.     © 2004-2014 Freescale Semiconductor, Inc. All rights reserved.
View full article
Hi, The MPL3115A2, provides highly accurate pressure and altitude data with variable sampling rate capability. It has very low-power consumption, smart features and requires zero data processing, it is ideal for mobile devices, medical and security applications. Here is a Render of the MPL3115A2 Breakout- Board downloaded from OSH Park: And here is an image of the Layout Design for this board: In the Attachments section, you can find the Schematic Source File (.SCH), Schematic PDF File, Layout Source File (BRD), Gerber Files (GTL, GBL, GTS, GBS, GTO, GBO, GKO, XLN) and BOM for this Breakout-board. If you are interested in more designs like this breakout board for other sensors, please go to Freescale Sensors Breakout Boards Designs – HOME
View full article
Presented at Sensors Expo, 25 June 2014
View full article
This is a pre-release version of the Sensor Fusion Toolbox for Windows.  It is essentially the same tool you already know and love.  It differs in terms of the binary images that can be downloaded to your development board.  Clicking File->Flash from the toolbar will present you with a set up updated binaries.  These were built using a brand new set of 6- and 9-axis Kalman filter algorithms.  We expect these to consume much less power (2X or 3X) and to have better gyro tracking.  We are soliciting feedback from existing users of the toolkit with regard to performance of the new filters.  We do not expect to formally release until later in Q2, primarily to give the community time to try them and give us feedback.  We are not releasing source just yet, for the same reason.
View full article
Posted here in response to a query by Michael Smorto. Regards, Mike Stanley
View full article
The MMA845xQ is a smart low-power, three-axis capacitive micromachined accelerometer up to 14 bits of resolution. This accelerometer is packed with embedded functions with flexible user-programmable options, configurable to two interrupt pins. Embedded interrupt functions allow for overall power savings relieving the host processor from continuously polling data. There is access to both low-pass filtered data as well as high-pass filtered data, which minimizes the data analysis required for jolt detection and faster transitions. The device can be configured to generate inertial wake-up interrupt signals from any combination of the configurable embedded functions allowing the MMA845xQ to monitor events and remain in a low-power mode during periods of inactivity. Here is a Render of the MMA845x Breakout- Board downloaded from OSH Park: And here is an image of the Layout Design for this board: In the Attachments section, you can find the Schematic Source File (.SCH), Schematic PDF File, Layout Source File (BRD), Gerber Files (GTL, GBL, GTS, GBS, GTO, GBO, GKO, XLN) and BOM for this Breakout-board. If you are interested in more designs like this breakout board for other sensors, please go to Freescale Sensors Breakout Boards Designs – HOME
View full article
The FXLN83XX is a 3-axis, low-power, low-g accelerometer along with a CMOS signal conditioning and control ASIC in a small 3 x 3 x 1 mm QFN package. The analog outputs for the X, Y, and Z axes are internally compensated for zero-g offset and sensitivity, and then buffered to the output pads. The outputs have a fixed 0 g offset of 0.75 V, irrespective of the VDD supply voltage. The bandwidth of the output signal for each axis may be independently set using external capacitors. The host can place the FXLN83XXQ into a low-current shutdown mode to conserve power. Here is a Render of the FXLN83XX Breakout Board downloaded from OSH park: Layout Design for this board: In the attachments section, you can find the Schematic Source File (SCH), Schematic PDF File, Layout Source File (BRD), Gerber Files (GTL, GBL, GTS, GBS, GTO, GBO, GKO, XLN) and BOM files.    If you're interested in more designs like this breakout board for other sensors, please go to Freescale Sensors Breakout Boards Designs – HOMEFreescale Sensors Breakout Boards Designs – HOME
View full article
Hi Everyone, I would like to share here one of my examples I created for the MPL3115A2 while working with the NXP FRDM-KL25Z platform and FRDMSTBC-P3115 shield board. It illustrates the use of the embedded FIFO buffer to collect either pressure/temperature or altitude/temperature data that are read from the FIFO using an interrupt technique through the I2C interface. The FIFO is set to store the maximum number of samples (32). Each sample consists of 3 bytes of pressure (or altitude) data and 2 bytes of temperature data. Therefore 160 bytes (32 x (3 + 2)) in total are read from the FIFO when the FIFO is full and the FIFO interrupt is asserted. The MPL3115A2 is initialized as follows. /****************************************************************************** * MPL3115A2 initialization function ****************************************************************************** void MPL3115A2_Init (void) { I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG1, 0x04); // Reset all registers to POR values Pause(0x631); // ~1ms delay I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, F_SETUP_REG, 0xA0); // FIFO Fill mode, 32 samples I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG4, 0x40); // Enable FIFO interrupt I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG5, 0x40); // Route the FIFO interrupt to INT1 - PTA5 I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG2, 0x00); // Time step = ~1s I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG3, 0x00); // Push-pull, active low interrupt I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG1, 0x39); // Active barometer mode, OSR = 128 //I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG1, 0xB9); // Active altimeter mode, OSR = 128 }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ In the ISR, only the interrupt flag is cleared and the FIFO_DataReady variable is set to indicate that the FIFO is full. /****************************************************************************** * PORT A Interrupt handler ******************************************************************************/ void PORTA_IRQHandler() { PORTA_PCR5 |= PORT_PCR_ISF_MASK; FIFO_DataReady = 1; }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ Once the FIFO_DataReady variable is set, the STATUS register (0x00) is read to clear the FIFO interrupt status bit and deassert the INT1 pin. Afterwars the FIFO is read using a 160-byte (5 x 32 bytes) burst read starting from the OUT_P_MSB register (0x01). Then the raw pressure (or altitude) and temperature data are converted to real values. if (FIFO_DataReady) { FIFO_DataReady = 0; FIFO_Status = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, STATUS_REG); // Read the Status register to clear the FIFO interrupt status bit I2C_ReadMultiRegisters(MPL3115A2_I2C_ADDRESS, OUT_P_MSB_REG, 5*Watermark_Val, RawData); // Read the FIFO using a burst read for (i = 0; i < Watermark_Val; i++) { /* Get pressure, the 20-bit measurement in Pascals is comprised of an unsigned integer component and a fractional component. The unsigned 18-bit integer component is located in OUT_P_MSB, OUT_P_CSB and bits 7-6 of OUT_P_LSB. The fractional component is located in bits 5-4 of OUT_P_LSB. Bits 3-0 of OUT_P_LSB are not used. */ Pressure[i] = (float) (((RawData[0 + i*5] << 16) | (RawData[1 + i*5] << 8) | (RawData[2 + i*5] & 0xC0)) >> 6) + (float) ((RawData[2 + i*5] & 0x30) >> 4) * 0.25; /* Get temperature, the 12-bit temperature measurement in °C is comprised of a signed integer component and a fractional component. The signed 8-bit integer component is located in OUT_T_MSB. The fractional component is located in bits 7-4 of OUT_T_LSB. Bits 3-0 of OUT_T_LSB are not used. */ Temperature[i] = (float) ((short)((RawData[3 + i*5] << 8) | (RawData[4 + i*5] & 0xF0)) >> 4) * 0.0625; /* Get altitude, the 20-bit measurement in meters is comprised of a signed integer component and a fractional component. The signed 16-bit integer component is located in OUT_P_MSB and OUT_P_CSB. The fraction component is located in bits 7-4 of OUT_P_LSB. Bits 3-0 of OUT_P_LSB are not used */ //Altitude[i] = (float) ((short) ((RawData[0 + i*5] << 8) | RawData[1 + i*5])) + (float) (RawData[2 + i*5] >> 4) * 0.0625; } } ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ Deassertion of the INT1 pin after reading the STATUS register (0x00). The auto acquisition time step is set in this example to the lowest possible value (1s), so the FIFO is read every ~32s. The calculated values can be watched in the "Variables" window on the top right of the Debug perspective. Attached you can find the complete source code. If there are any questions regarding this simple example project, please feel free to ask below. Your feedback or suggestions are also welcome.   Regards, Tomas
View full article
This time, I would like to share with you an example project using the MPL115A1, the NXP digital barometer.   The MPL115A1 is a simple barometer with digital output for cost-effective applications. It employs a MEMS pressure sensor with a conditioning integrated circuit to provide accurate pressure data. An integrated analog-to-digital converter (ADC) provides digitized temperature and pressure sensor outputs via serial peripheral interface (SPI), with bus speeds up to 8 Mbps.   You may find more information at: MPL115A: 50 to 115kPa, Absolute Digital Pressure Sensor.   I created this project using the FRDM-KL25Z platform and the MPL115A1 absolute digital pressure sensor. The complete source code is written in KDS IDE. You may find the complete project attached to this post.   This document gives you an introduction of the MPL115A1 pressure sensor as well as the different configurations and guides you through the initialization process and how to appreciate the demonstration.   Introduction to the example project This example is based on the application note AN3785 -How to Implement the Freescale MPL115A Digital Barometer. I recommend using it as a reference.   Through this example project, the MCU is configured to use the SPI interface and the PIT module. The local pressure is read every second.   There are MPL115A1 SPI commands to read coefficients, execute Pressure and Temperature conversions, and to read Pressure and Temperature data. The sequence of the commands for the interaction is given as an example to operate the MPL115A1. Initialization of the MKL25Z128 MCU.   Sequence flow chart. The MPL115A1 interfaces to a host (or system) microcontroller in the user’s application. All communications are via SPI. A typical usage sequence is as follows: Every stage of the flow chart is applied on this example and explained below.   Reading coefficient data These are MPL115A2 SPI commands to read coefficients. The coefficients are usually stored in the host microcontoller local memory but can be re-read at any time.   Reading of the coefficients may be executed only once and the values stored in the host microcontroller. It is not necessary to read this multiple times because the coefficients within a device are constant and do not change.   Read Coefficients: [CS=0], [0x88], [0x00], [0x8A], [0x00], [0x8C], [0x00], [0x8E], [0x00], [0x90], [0x00], [0x92], [0x00], [0x94], [0x00], [0x96], [0x00], [0x00], [CS=1] Once the coefficients are obtained, they are computed inside the MPL115A1_Read_Preassure function.     Data conversion This is the MPL115A2 SPI commands to start conversion.   This is the first step that is performed each time a new pressure reading is required which is initiated by the host sending the CONVERT command. The main system circuits are activated (wake) in response to the command and after the conversion completes, the result is placed into the Pressure and Temperature ADC output registers.   Start conversion: [CS=0], [0x24], [0x00], [CS=1], [13 ms Delay]     This is the MPL115A2 SPI commands to read raw temperature and pressure data.     Start Read raw data: [CS=0], [0x80], [0x00], [0x82], [0x00], [0x84], [0x00,] [0x86], [0x00], [0x00], [CS=1]   Compensated pressure reading Once the raw rata is obtained, the compensation procedure is applied as follow:     Local pressure   Once the steps mentioned above are followed, the MPL115A1_Read_Preassure function returns the local pressure value into the local_pressure variable. I recommend evaluating this variable in order to know the final result.     I hope you find the information useful and funny.   Regards, David  
View full article
Hi Everyone,   If you are interested in a simple bare metal example code illustrating the use of the FXLS8471Q orientation detection function, please find below one of my examples I created for the FXLS8471Q accelerometer while working with the NXP FRDM-KL25Z platform and FRDMSTBC-A8471 board.   This example code complements the code snippet from the  AN4068.   void FXLS8471Q_Init (void) { FXLS8471Q_WriteRegister(CTRL_REG1, 0x00); // Standby mode FXLS8471Q_WriteRegister(PL_CFG_REG, 0x40); // Enable orientation detection FXLS8471Q_WriteRegister(PL_BF_ZCOMP_REG, 0x43); // Back/Front trip point set to 75°, Z-lockout angle set to 25° FXLS8471Q_WriteRegister(P_L_THS_REG, 0x14); // Threshold angle = 45°, hysteresis = 14° FXLS8471Q_WriteRegister(PL_COUNT_REG, 0x05); // Debounce counter set to 100ms at 50Hz FXLS8471Q_WriteRegister(CTRL_REG3, 0x00); // Push-pull, active low interrupt FXLS8471Q_WriteRegister(CTRL_REG4, 0x10); // Orientation interrupt enabled FXLS8471Q_WriteRegister(CTRL_REG5, 0x10); // Route orientation interrupt to INT1 - PTD4 FXLS8471Q_WriteRegister(CTRL_REG1, 0x21); // ODR = 50Hz, Active mode }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍     In the ISR, only the interrupt flag is cleared and the PL_STATUS (0x10) register is read in order to:   - Clear the SRC_LNDPRT flag in the INT_SOURCE register and deassert the INT1 pin, as shown on the screenshot below. - Get orientation information. 0x82 in this example corresponds to "Portrait down" orientation.   void PORTD_IRQHandler() { PORTD_PCR4 |= PORT_PCR_ISF_MASK; // Clear the interrupt flag PL_Status = FXLS8471Q_ReadRegister(PL_STATUS_REG); // Read the PL_STATUS register to clear the SRC_LNDPRT flag in the INT_SOURCE register }‍‍‍‍‍‍‍‍‍‍       Attached you can find the complete source code. If there are any questions regarding this simple example code, please feel free to ask below.    Regards, Tomas
View full article
Hi, The MMA865x, 3-axis, 10-bit/12-bit accelerometer that has industry leading performance in a small 2 x 2 x 1 mm DFN package. This accelerometer is packed with embedded functions that include flexible user-programmable options and two configurable interrupt pins. Overall power savings is achieved through inertial wake-up interrupt signals that monitor events and remain in a low-power mode during periods of inactivity. Here is a Render of the MMA865x Breakout- Board downloaded from OSH park: Layout Design for this board: In the attachments section, you can find the Schematic Source File (SCH), Schematic PDF File, Layout Source File (BRD), Gerber Files (GTL, GBL, GTS, GBS, GTO, GBO, GKO, XLN) and BOM files. If you're interested in more designs like this breakout board for other sensors, please go to Freescale Sensors Breakout Boards Designs – HOME
View full article
This is a PDF version of the Sensor Fusion tutorial I gave at the RoboBusiness conference in Santa Clara on 24 October.
View full article
Super Small Outline Package (SSOP) Case no. 1317A and 1317A-04 SSOP package offering robust media protection and small footprint.
View full article
This presentation was given at the October 2014 ARM TechCon in Santa Clara, CA.  It provides a detailed description of recent changes to Freescale's sensor fusion offering.
View full article
clicktaleID