传感器知识库

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Sensors Knowledge Base

讨论

排序依据:
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
查看全文
Posted here in response to a query by Michael Smorto. Regards, Mike Stanley
查看全文
Hello Freescale Community, Most of the new Freescale Sensors in our portfolio come in very small packages, some of them as small as 2x2x1mm, which is awesome! However, one of the problems that we detected last year is that many customers struggle in the evaluation stage of the project due to the small packages. They should either, buy an evaluation board or spend valuable time designing and manufacturing a PCB just for testing our devices. Our goal with this project is to share with our community the Freescale Sensors Breakout Boards we designed for this specific purpose, so you can easily manufacture your own sensor boards or modify our designs to fit  your specific application. This way you can easily evaluate Freescale sensors. The boards were designed to be used in a prototype board (DIP style pins) and they can communicate to any MCU thru IIC or SPI (depending on the sensor). These designs were made using Eagle Layout 6.5, if you want to modify the designs you can do it with the free version of Eagle CAD (for non-commercial purposes), or you can send the gerber files (included in the zip files) to your preferred PCB manufacturer. The following designs are available: + Altimeter: MPL3115A2 Breakout Board + Accelerometer: MMA845x Breakout Board MMA865x Breakout Board MMA8491 Breakout Board FXLN83xx Breakout Board FXLS8471 Breakout Board MMA690x Breakout Board + Accelerometer + Magnetometer (6-DOF): FXOS8700 Breakout Board + Gyroscope: FXAS2100x Breakout Board The above .ZIP files, contains the following design information: - Schematic Source File (.SCH) - Schematic (.PDF) - Layout Source File (.BRD) - Layout Images (.jpg) - Gerber Files (GTL, GBL, GTS, GBS, GTO, GBO, GKO, XLN). - PCB Render Image (.png created in OSH park) - BOM (.xls) Additional content: If you want to modify our designs, please download the attached library file "Freescale_Sensors_v2.lbr" and add it to your Eagle Library repository. We'll be more than glad to respond to your questions and please, let us know what you think. -Freescale Sensor's Support team.
查看全文
As we develop videos on Sensor subjects for posting to QUMU and YouTube, these guidelines are a quick reminder of some important production points to remember. These lessons are relevent for any video content we develop.
查看全文
Hi Everyone,   As I am often asked for a simple bare metal example code illustrating the use of the accelerometer transient detection function, I have decided to share here one of my examples I created for the FXLS8471Q accelerometer while working with the NXP FRDM-KL25Z platform and FRDM-FXS-MULT2-B sensor expansion board.   This example code complements the Python code snippet from the AN4693. The FXLS8471Q is set for detection of an “instantaneous” acceleration change exceeding 315mg for a minimum period of 40 ms on either the X or Y axes. Once an event is triggered, an interrupt will be generated on the INT1 pin:   void FXLS8471Q_Init (void) { FXLS8471Q_WriteRegister(TRANSIENT_THS_REG, 0x85); // Set threshold to 312.5mg (5 x 62.5mg ) FXLS8471Q_WriteRegister(TRANSIENT_COUNT_REG, 0x02); // Set debounce timer period to 40ms FXLS8471Q_WriteRegister(TRANSIENT_CFG_REG, 0x16); // Enable transient detection for X and Y axis, latch enabled FXLS8471Q_WriteRegister(CTRL_REG4, 0x20); // Acceleration transient interrupt enabled FXLS8471Q_WriteRegister(CTRL_REG5, 0x20); // Route acceleration transient interrupt to INT1 - PTA5 FXLS8471Q_WriteRegister(CTRL_REG1, 0x29); // ODR = 12.5Hz, Active mode } ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍     In the ISR, only the interrupt flag is cleared and the TRANSIENT_SRC (0x1E) register is read in order to clear the SRC_TRANS 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(TRANSIENT_SRC_REG); // Read the TRANSIENT_SRC register to clear the SRC_TRANS flag in the INT_SOURCE register EventCounter++; } ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍       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
查看全文
"Android as a Platform for Sensor Fusion Education and Evaluation" presented at 2013 Sensors Expo & Conference by Michael Stanley.
查看全文
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
查看全文
The FRDM33772BSPIEVB serves as a 6-channel and FRDM33771BSPIVB as a 14 channel battery cell controller with a passive cell balancing. A FRDM-KL25Z evaluation board is used for communication with FRDM3377xBSPIEVB and a computer through SPI interface. The kit together with BATT-6EMULATOR 6-cell battery emulator  for the FRDM33772BSPIEVB and BATT-14EMULATOR 14-cell battery emulator for FRDM33771BSPIVB or a battery pack BATT-14AAAPACK for either of them is dedicated to support customer development and evaluation. For a status reading and settings an MC3377x EvalGUI is used. Figure 1. FRDM33771SPI evaluation board Figure 2. BATT-14AAAPACK battery pack Figure 3. BATT-14EMULATOR to supply MC33771 EVBs MC3377x EvalGUI The Graphic User Interface MC3377x EvalGUI is intended to use for evaluation of MC3377x cell controllers. Figure 4. MC3377x Evaluation GUI version 4.02 Hardware setup The GUI supports two types of BMS architectures. Central, only one cluster and distributed, up to 15 clusters. For the central BMS architecture an MC33771 EVB or MC33772 EVB must be stacked on top of an FRDM-KL25Z board. One of the battery emulators or the battery pack is connected through a 34-pin cells connector. For the distributed BMS architecture a MC33664 evaluation board stacked on top of a FRDM-KL25Z is used. The MC3377x evaluation boards are connected to the MC33664 EVB through a twisted pair TPL bus. Connection to a computer is made through OpenSDA port on FRDM-KL25Z and USB on the computer side. Figure 5. FRDM-33771SPIEVB stacked on top of FRDM-KL25Z and BATT-14AAAPACK connected as central BMS architecture After hardware setup is done start the MC3377x EvalGUI and follow instructions for Initial Configuration in MC33771/772 Evaluation GUI Documentation. For access click info->Open docu in MC33771/772 Evaluation GUI. Figure 6. Access to MC33771/772 Evaluation GUI document When the initial configuration is done, voltage reading of every battery cell and overall voltage of all connected batteries in series is enabled. However current measurement is disabled by default. Figure 7. Battery cells measurement with current measurement disabled Enablement of current measurement is done in Cluster view by setting a Bit9 (IMeasEn) in in SYS_CFG1 register to logic 1. The field changes from dark green to  light green and the current measurement is enabled. Figure 8. Enablement of the current measurement Figure 9. Current measurement enabled Current in the GUI is displayed in mV and for the current consumption has to be calculated. Because shunt resistor is Rshunt=100mΩ and measured voltage 1.243mV, thus for this case the current consumption is I=Ushunt/Rshunt = 12.43mA. The shunt resistor has to be chosen so the voltage doesn’t exceed +/-150mV. The voltage is sensed on SENSE_P and SENSE_N pins of the MC3377x controller. Figure 10. Shunt resistor R1 on the BATT-14AAAPACK It’s also possible to use a resistor in the battery pack as a load. The resistor is not populated. Recommended value is 1kΩ, 3W , SMT 2512. The resistor can be connected and disconnected with SW3 switch. Figure 11. Recommended load resistor R7 and toggle switch SW3
查看全文
Hi Everyone,   In this document I would like to present a simple bare-metal example code/demo for the FXLN8371Q Xtrinsic three axis, low-power, low-g, analog output accelerometer. I have created it while working with the Freescale FRDM-KL25Z development platform and FXLN8371Q breakout board. The FreeMASTER tool is used to visualize the acceleration data that are read from the FXLN8371Q through ADC.   This example illustrates:   1. Initialization of the MKL25Z128 MCU (mainly ADC, PORT and PIT modules). 2. Simple offset calibration. 3. Accelerometer outputs reading using ADC and conversion of the 10-bit ADC values to real acceleration values in g’s. 4. Visualization of the output values in the FreeMASTER tool.   1. The FXLN8371Q breakout board (schematic is attached below) needs to have the following pins connected to the FRDM-KL25Z board:   J4-1 (VDD) => J9-4 (P3V3) J4-2 (XOUT) => J10-2 (PTB0/ADC0_SE8) J4-3 (YOUT) => J10-4 (PTB1/ADC0_SE9) J4-4 (ZOUT) => J10-6 (PTB2/ ADC0_SE12) J4-6 (GND) => J9-14 (GND) J3-3 (ST) => J9-14 (GND) J3-4 (EN) => J9-4 (P3V3)   The PIT (Periodic Interrupt Timer) is used to read the output data periodically at a fixed rate of ~200Hz. The MCU is, therefore, configured as follows.   void MCU_Init(void) {      //ADC0 module initialization      SIM_SCGC6 |= SIM_SCGC6_ADC0_MASK;        // Turn on clock to ADC0 module      SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK;       // Turn on clock to Port B module      PORTB_PCR0 |= PORT_PCR_MUX(0x00);        // PTB0 pin is ADC0 SE8 input      PORTB_PCR1 |= PORT_PCR_MUX(0x00);        // PTB1 pin is ADC0 SE9 input      PORTB_PCR2 |= PORT_PCR_MUX(0x00);        // PTB2 pin is ADC0 SE12 input      ADC0_CFG1 |= ADC_CFG1_ADLSMP_MASK | ADC_CFG1_MODE(0x02);             // Long sample time, single-ended 10-bit conversion                           //PIT module initialization      SIM_SCGC6 |= SIM_SCGC6_PIT_MASK;         // Turn on clock to PIT module      PIT_LDVAL0 = 52400;                      // Timeout period = ~5ms (200Hz)      PIT_MCR = PIT_MCR_FRZ_MASK;              // Enable clock for PIT, freeze PIT in debug mode                               //Enable PIT interrupt on NVIC          NVIC_ICPR |= 1 << ((INT_PIT - 16) % 32);      NVIC_ISER |= 1 << ((INT_PIT - 16) % 32); }   2. The simplest offset calibration method consists of placing the board on a flat surface so that X is at 0g, Y is at 0g and Z is at +1g. 16 samples are recorded and then averaged. The known sensitivity needs to be subtracted from the +1g reading to calculate an assumed 0g offset value for Z.   void Calibrate(void) {      unsigned int Count = 0;                    do                   // Accumulate 16 samples for X, Y, Z      {         ADC0_SC1A = ADC_SC1_ADCH(0x08);               // Process ADC measurements on ADC0_SE8/XOUT                                                                while(!(ADC0_SC1A & ADC_SC1_COCO_MASK)){};         Xout_10_bit += ADC0_RA;                                                                                                      ADC0_SC1A = ADC_SC1_ADCH(0x09);               // Process ADC measurements on ADC0_SE9/YOUT                while(!(ADC0_SC1A & ADC_SC1_COCO_MASK)){};         Yout_10_bit += ADC0_RA;                                                                                                            ADC0_SC1A = ADC_SC1_ADCH(0x0C);                while(!(ADC0_SC1A & ADC_SC1_COCO_MASK)){};    // Process ADC measurements on ADC0_SE12/ZOUT               Zout_10_bit += ADC0_RA;                                                         Count++;                        } while (Count < 16);                    X_offset = (float) Xout_10_bit / 16;                             // Compute X-axis offset by averaging all 16 X-axis samples      Y_offset = (float) Yout_10_bit / 16;                             // Compute Y-axis offset by averaging all 16 Y-axis samples      Z_offset = ((float) Zout_10_bit / 16) - SENSITIVITY_2G;          // Compute Z-axis offset by averaging all 16 Z-axis samples and subtracting the known sensitivity                      PIT_TCTRL0 = PIT_TCTRL_TIE_MASK | PIT_TCTRL_TEN_MASK;          // Enable PIT interrupt and PIT                                      }   3. Reading the FXLN8371Q datasheet, the output voltage when there is no acceleration is typically 0.75V and it should typically change by 229mV per 1g of acceleration in ±2g mode. The signal from a 10-bit ADC gives me a number from 0 to 1023. I will call these “ADC units”.  0V maps to 0 ADC units, VDDA (2.95V on the FRDM-KL25Z board) maps to 1023 ADC units and let’s assume it is linear in between. This means that zero acceleration on an axis should give me a reading of 260 ADC units (0.75V / 2.95V x 1023 ADC units) on the pin for that axis. Also, a change of 1 ADC unit corresponds to a voltage difference of 2.95V / 1023 ADC units = 2.884mV/ADC unit. Since the datasheet says a 1g acceleration typically corresponds to 229mV voltage difference, I can easily convert it to ADC units/g:   229 mV/g = 229 mV/g x (1023 ADC units) / 2.95V = 79.4 ADC units/g = SENSITIVITY_2g   Using this calculated sensitivity and measured offset, I convert the 10-bit ADC values to real acceleration values in g’s in the PIT ISR as follows.   void PIT_IRQHandler() {      ADC0_SC1A = ADC_SC1_ADCH(0x08);                    // Process ADC measurements on ADC0_SE8/XOUT                                                  while(!(ADC0_SC1A & ADC_SC1_COCO_MASK)){};      Xout_10_bit = ADC0_RA;                                         ADC0_SC1A = ADC_SC1_ADCH(0x09);                    // Process ADC measurements on ADC0_SE9/YOUT                while(!(ADC0_SC1A & ADC_SC1_COCO_MASK)){};      Yout_10_bit = ADC0_RA;                                               ADC0_SC1A = ADC_SC1_ADCH(0x0C);                    // Process ADC measurements on ADC0_SE12/ZOUT                while(!(ADC0_SC1A & ADC_SC1_COCO_MASK)){};      Zout_10_bit = ADC0_RA;                    Xout_g = ((float) Xout_10_bit - X_offset) / SENSITIVITY_2G;         // Compute X-axis output value in g's      Yout_g = ((float) Yout_10_bit - Y_offset) / SENSITIVITY_2G;         // Compute Y-axis output value in g's      Zout_g = ((float) Zout_10_bit - Z_offset) / SENSITIVITY_2G;         // Compute Z-axis output value in g's                     PIT_TFLG0 |= PIT_TFLG_TIF_MASK;          // Clear PIT interrupt flag }   4. The calculated values can be watched in the "Variables" window on the top right of the Debug perspective or in the FreeMASTER application. To open and run the FreeMASTER project, install the FreeMASTER application and FreeMASTER Communication Driver.       I guess this is enough to let you start experimenting with the FXLN83xxQ family of analog accelerometers. Attached you can find the complete source code written in the CW for MCU's v10.6 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.   Regards, Tomas Original Attachment has been moved to: FRDM-KL25Z-FXLN8371Q-Basic-read-using-ADC.zip Original Attachment has been moved to: FreeMASTER---FRDM-KL25Z-FXLN8371Q-Basic-read-using-ADC.zip
查看全文
Using this document you can simply introduce the measured data from the MPL3115A2 and you will get the expected output data for Altimeter/Barometric Pressure and Temperature measurements.
查看全文
List of software examples published by NXP technical support: Sensors software examples published by NXP technical support * List of breakout boards designed by NXP technical support: Freescale Sensors Breakout Boards Designs – HOME * All of the source code placed in spaces above is for example use only. NXP does not accept liability for use of this code in the user’s application.
查看全文
Unibody Package Case 344-15
查看全文
The following video shows how to run the FRDM 6DOF Bare Board eCompass using the FRDM-K22. This algorithm uses the FXOS8700 contained on the Freedom Board. In order to get more information about the Sensor Fusion Library for Kinetis MCU's 5.0, please refer to the following link: Sensor Fusion|Freescale I hope this material will be useful for you. David
查看全文
Hi Everyone, In my previous tutorial, I demonstrated how to import an ISSDK based example project into MCUXpresso IDE, build and run it on the Freedom board (FRDM-KL27Z). If you want to visualize/log sensor data, easily change sensor settings (ODR, Range, Power Mode) or directly read and write sensor registers, you can use the Freedom Sensor Toolbox-Community Edition (STB-CE) as described below or in the STBCEUG. 1. Connect the SDA port (J13) on the FRDM-KL27Z board to a USB port on your computer. 2. Open STB-CE GUI by double clicking the Freedom Sensor Toolbox (CE) shortcut located on your desktop. 3. Select "Out of Box Sensor Demonstration". 4. Select the Project to be launched and click on Continue. Base Board Name – FRDM-KL27Z Shield Board Name – OnBoard Project Name – MMA8451 Accelerometer Demo 5. The ISSDK-based MMA8451 Accelerometer Demo firmware is loaded to the KL27Z MCU and the MMA8451 Accelerometer Demo v1.0 GUI launched. 6. In the Main screen you can change basic MMA8451Q accelerometer settings (ODR, Range, Power Mode), enable embedded functions (Landsacpe/Portrait, Pulse/Tap, Freefall, Transient), start/stop accelerometer data streaming and/or logging.   7. The Register screen (MMA8451) provides low-level access (R/W) to the MMA8451Q registers along with a detailed description of the selected register. 8. To change the bit value, simply click on the corresponding cell (make sure you selected the Standby mode before writing a new value to the selected register). I hope you find this simple document useful. f there are any questions, please feel free to ask below.  Regards, Tomas
查看全文
Unibody Package with Side Port_867B-04  
查看全文
The attached is a preview copy of build 422 of the sensor fusion library, which is currently being tested by the Freescale Sensor's team. Please consult the docs/Release_Notes.txt file for changes from build 420, as well as known errata. This version is released under the following license:   Freescale Sensor Fusion Library for Kinetis MCUs IMPORTANT. Read the following Freescale Software License Agreement (“Agreement”) completely.  By downloading this file, 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 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:     * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.     * Redistributions in binary form must reproduce the above copyright  notice, this list of conditions and the following disclaimer in the  documentation and/or other materials provided with the distribution.     * Neither the name of Freescale Semiconductor, Inc. nor the  names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FREESCALE SEMICONDUCTOR, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. © 2004-2014 Freescale Semiconductor, Inc. All rights reserved.
查看全文
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
查看全文
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
查看全文
The Freescale Freedom KL26Z hardware (FRDM-KL26Z) is a capable and cost-effective design featuring a Kinetis L series microcontroller, the industry’s first microcontroller built on the ARM® Cortex™-M0+ core. It features a KL26Z128VLH4 (KL26Z), a device boasting a maximum operating frequency of 48MHz, 128KB of flash. The FRDM-KL26Z features the Freescale open standard embedded serial and debug adapter known as OpenSDA. You can find more information at following link: FRDM-KL26Z: Freescale Freedom Development Platform for Kinetis KL16 and KL26 MCUs (up to 128 KB Flash) The second required board for this example is the Freescale's Freedom Development Platform for Multiple Xtrinsic Sensors, the FRDM-FXS-MULTI. It is a sensor expansion board that contains 7 sensors among which is the FXAS21000 Xtrinsic 3-axis gyroscopic sensors. This example is using above mentioned tools to create data acquisition system (DAQ) for acquiring angular rate data measured in deg/s from the FXAS21000 Xtrinsic 3-axis gyroscopic sensors (Gyro). For data logging and visualization of acquired data FreeMASTER tool is used. The output is in 3 directions of rotation. Around X direction is for the Roll (around longitudinal axis), around Y direction is for the Pitch (around the lateral axis) and around Z direction for the Yaw (around the vertical axis). The Gyro embedded registers are accessed through an I 2 C serial interface and routed to KL26Z I 2 C 1 module with following pin association. Precisely the 7-bit I 2 C slave address is 0x20 (SA0=0) and SCL1, SDA1 lines are routed to port C of the I 2 C 1 module at KL26Z board pins PTC1 and PTC2: Proper interrupt INT1_GYRO at J1-6 needs to be routed via jumper on J6 to INT_GYRO as shown in following block diagram since the interrupts are shared with other sensors: This is then handled as GPIO port A: PTA at the KL26Z board and configured for the falling edge interrupts. For more details see the schematics of the FRDM-FXS-MULTI block diagram. This example illustrates:    1.  Initialization of the KL26Z MCU (I 2 C and PORT modules).    2. Initialization of the Gyro to achieve the resolution 0.025 dsp/LSB with +/-200 dps range and a high-pass filter on.    3. Output data reading using an interrupt technique.    4. Conversion of the output values from registers 0x01 – 0x06 to real values in deg/s.    5. Visualization of the output values in the FreeMASTER tool. 1. According to the schematic, the INT1_GYRO output of the FXAS21000 is connected to the PTA5 pin of the KL26Z MCU and both SCL and SDA lines are connected to the I2C1 module (PTC1 and PTC2 pins). The MCU is, therefore, configured as follows:      void MCU_Init(void){              //I2C1 module initialisation         SIM_SCGC4 |= SIM_SCGC4_I2C1_MASK;       // Turn on clock to I2C1 module         SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;      // Turn on clock to Port C module         PORTC_PCR1 = PORT_PCR_MUX(2);           // PTC1 pin is I2C1 SCL1 line pin alternative         PORTC_PCR2 = PORT_PCR_MUX(2);           // PTC2 pin is I2C1 SDA1 line pin alternative         I2C1_F = 0x14; // SDA hold time = 2.125us, SCL start hold time = 4.25us, SCL stop hold time = 5.125us         I2C1_C1 = I2C_C1_IICEN_MASK;                    // Enable I2C1 module              //Configure the PTA5 pin (connected to the INT_GYRO of the FXAS21000) for falling edge interrupts         SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;      // Turn on clock to Port A module         PORTA_PCR5 |= (0|PORT_PCR_ISF_MASK|     // Clear the interrupt flag         PORT_PCR_MUX(0x1)|                      // PTA5 is configured as GPIO         PORT_PCR_IRQC(0xA));                    // PTA5 is configured for falling edge interrupts             //Enable PORTA interrupt on NVIC         NVIC_ICPR |= 1 << ((INT_PORTA - 16)%32);         NVIC_ISER |= 1 << ((INT_PORTA - 16)%32);      } 2. At the beginning of the initialization, all Gyro registers are reset to their default values by setting the RST bit of the CTRL_REG1 register. Also the ZR_cond in CTRL_REG1 to trigger the offset compensation is enabled and hold till ZR_cond offset compensation is accomplished. This is meant to be used only when the IC is in zero rate condition on all axes. Writing a '1' to this bit initiates the internal zero-rate offset calibration. The ZR_cond bit self-clears after the zero-rate offset calculation, and it can only be used once after a hard or soft reset has occurred. The measuring range of Gyro is set to ±200 dps and to achieve the highest resolution the ODR = 1.5625Hz (640ms) and the High-pass filter is enabled with H-P filter cutoff frq.:0.047 Hz.      void Gyro_Init (void){              unsigned char reg_val = 0;          I2C_WriteRegister(FXAS21_I2C_ADDRESS, CTRL_REG1, 0x40); // Reset all registers to POR values              do              // Wait for the RST bit to clear              {                 reg_val = I2C_ReadRegister(FXAS21_I2C_ADDRESS, CTRL_REG1) & 0x40;              } while (reg_val);         // Zero values initialisation ------------------------------------------------------------             //      I2C_WriteRegister(FXAS21_I2C_ADDRESS, CTRL_REG1, 0x80); // ZR_cond to trigger offset compensation             do      // wait till ZR_cond to trigger offset compensation accomplished          {           reg_val = I2C_ReadRegister(FXAS21_I2C_ADDRESS, CTRL_REG1) & 0x80;               } while (reg_val);             //----------------------------------------------------------------------------------------         I2C_WriteRegister(FXAS21_I2C_ADDRESS, CTRL_REG2, 0x0C); // Enable DRDY interrupt, DRDY interrupt routed to INT1 - PTA5, Push-pull, active low interrupt         I2C_WriteRegister(FXAS21_I2C_ADDRESS, CTRL_REG0, 0x17); // High-pass filter enabled, H-P filter cutoff frq.:0.047 Hz, +/-200 dps range -> 0.025 dsp/LSB = 40 LSB/dps         I2C_WriteRegister(FXAS21_I2C_ADDRESS, CTRL_REG1, 0x1E); // ODR = 1.5625Hz(640ms), Active mode      }      Below are the snap shots of write and read section of the registers from the instructions above.           3. In the ISR, only the interrupt flag is cleared and the DataReady variable is set to indicate the arrival of new data.      void PORTA_IRQHandler(){         PORTA_PCR5 |= PORT_PCR_ISF_MASK;                        // Clear the interrupt flag         DataReady = 1;       }      4. The output values from Gyro registers 0x01 – 0x06 are first converted to signed 14-bit values and afterwards to real values in deg/s.      while(1){              if (DataReady){                 // Is a new set of data ready?                               DataReady = 0;                                                                                                I2C_ReadMultiRegisters(FXAS21_I2C_ADDRESS, OUT_X_MSB_REG, 6, GyrData);  // Read data output registers 0x01-0x06              Xout_14_bit = ((short) (GyrData[0]<<8 | GyrData[1])) >> 2;// Compute 14-bit X-axis output value      Yout_14_bit = ((short) (GyrData[2]<<8 | GyrData[3])) >> 2;// Compute 14-bit Y-axis output value              Zout_14_bit = ((short) (GyrData[4]<<8 | GyrData[5])) >> 2;// Compute 14-bit Z-axis output value                                        Roll = ((float) (Xout_14_bit)) / SENGYR_025D;   // Compute X-axis output value in dps              Pitch = ((float) (Yout_14_bit)) / SENGYR_025D;  // Compute Y-axis output value in dps              Yaw = ((float) (Zout_14_bit)) / SENGYR_025D;    // Compute Z-axis output value in dps                                    Temperature on the Gyro is also read out from the TEMP register of the Gyro              Temp = (signed char) I2C_ReadRegister(FXAS21_I2C_ADDRESS, TEMP_REG);  // temperature on Gyro      5. The calculated values can be watched in the "(x)= Variables" window on the top right of the Debug perspective of the CodeWarrior IDE or in the FreeMASTER application.      To open and run the FreeMASTER project, install the FreeMASTER 1.4 application and FreeMASTER Communication Driver that can be downloaded from following link:      FREEMASTER: FreeMASTER Run-Time Debugging Tool      User Guide for FreeMASTER is available within the installation.      For board communication in FreeMASTER following Options of Plug-in Module needs to be selected and configured for the BDM P&E Kinetis cable settings:             FreeMASTER in action screenshot: Enjoy the Freescale Gyro.
查看全文
Here's a zip file which incorporates the patch I outlined in my previous posting.
查看全文
clicktaleID