Sensors Knowledge Base

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

Sensors Knowledge Base

Discussions

Sort by:
FRDM-STBC-AGM01: 9-Axis Inertial Measurement Sensor Board FRDM-KL25Z FRDM-STBC-AGM01 - Example project in KDS 3.0.0 using KSDK 1.2.0 and Processor Expert FRDM-STBC-AGM01 - Bare metal example project   FRDMSTBC-A8471: 3-Axis Accelerometer Sensor Toolbox Development Board FRDMSTBC-A8471 - Bare metal example project FRDMSTBC-A8471 - Example project in KDS 3.0.2 using KSDK 2.0 FXLS8471Q Auto-sleep with Transient threshold trigger    MPL3115A2: 20 to 110kPa, Absolute Digital (I 2 C) Pressure Sensor MPL3115A2 - Bare metal example project FRDMKL25-P3115 - Example project in KDS 3.0.2 using KSDK 2.0 https://community.nxp.com/docs/DOC-345632    MPL115A1: 50 to 115kPa, Absolute Digital (SPI) Pressure Sensor MPL115A1- Bare metal example project    FXOS8700CQ: Digital (I 2 C/SPI) Sensor - 3-Axis Accelerometer (±2g/±4g/±8g) + 3-Axis Magnetometer FXOS8700CQ - Bare metal example project FXOS8700CQ - Magnetic threshold detection function example code  FXOS8700CQ - Auto-sleep with Magnetic threshold trigger    FXLS8471Q: ±2g/±4g/±8g, 3-Axis, 14-Bit Digital (I 2 C/SPI) Accelerometer FXLS8471Q - Bare metal example project FXLS8471Q - FIFO Fill mode example code FXLS8471Q - Accelerometer vector-magnitude function example code FXLS8471Q - Accelerometer transient detection function example code FXLS8471Q - Accelerometer motion detection function example code  FXLS8471Q - Accelerometer orientation detection function example code    MMA8652FC: ±2g/±4g/±8g, 3-Axis, 12-Bit Digital (I 2 C) Accelerometer MMA8652FC - Bare metal example project MMA8652FC - Auto-WAKE/SLEEP mode   MMA8451Q: ±2g/±4g/±8g, 3-Axis, 14-bit Digital (I 2 C) Accelerometer MMA8451Q - Bare metal example project MMA8451Q - Single Tap Detection Bare metal example project FRDM-KL27Z MMA8451Q - How to build and run an ISSDK based example project    MMA8491Q: ±8g, 3-Axis, 14-bit Digital (I 2 C) Accelerometer/Tilt Sensor MMA8491Q - Acceleration data streaming using the PIT on the Kinetis KL25Z MCU   FXLN83xxQ: 3-Axis, Low-Power, Analog Accelerometer FXLN8371Q - Bare metal example project   FXAS21002C: 3-Axis Digital (I 2 C/SPI) Gyroscope FXAS21000 – Bare metal example project FXAS21002C - Angular rate threshold detection function example code   MAG3110FC: 3-Axis Digital (I 2 C) Magnetometer MAG3110FC – Bare metal example project   LM75A: Digital temperature sensor and thermal watchdog LM75A - Temperature data streaming using the PIT on the Kinetis KL25Z MCU
View full article
Hi Everyone, In one of my previous documents I presented a simple example code/demo that reads both the altitude and temperature data from the Xtrinsic MPL3115A2 pressure sensor and visualizes them using the FreeMASTER tool via USBDM interface. This time I would like to share another example with the MPL3115A2 programmed to measure pressure (barometer mode) and temperature. The Freescale FRDM-KL25Z board coupled with the Xtrinsic MEMS sensors board was used for this project. The initialization of the Kinetis KL25Z128 MCU remains the same, the only small change is in the initialization of the MPL3115A2, this time the barometer mode is selected with the OSR of 128. void MPL3115A2_Init (void) {      unsigned char reg_val = 0;                 I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG1, 0x04);               // Reset all registers to POR values          do            // Wait for the RST bit to clear      {        reg_val = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG1) & 0x04;      } while (reg_val);      I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, PT_DATA_CFG_REG, 0x07);         // Enable data flags      I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG3, 0x11);               // Open drain, active low interrupts      I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG4, 0x80);               // Enable DRDY interrupt      I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG5, 0x00);               // DRDY interrupt routed to INT2 - PTD3      I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG1, 0x39);               // Active barometer mode, OSR = 128           } In the main loop, both pressure and temperature data are read and then calculated as follows. if (DataReady)          // Is a new set of data ready? {                  DataReady = 0;           /* Read both the pressure and temperature data */                       OUT_P_MSB = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, OUT_P_MSB_REG);             OUT_P_CSB = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, OUT_P_CSB_REG);             OUT_P_LSB = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, OUT_P_LSB_REG);             OUT_T_MSB = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, OUT_T_MSB_REG);             OUT_T_LSB = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, OUT_T_LSB_REG);                                  /* 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 = (float) (((OUT_P_MSB << 16) | (OUT_P_CSB << 😎 | (OUT_P_LSB & 0xC0)) >> 6) + (float) ((OUT_P_LSB & 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 = (float) ((signed char) OUT_T_MSB) + (float) (OUT_T_LSB >> 4) * 0.0625;                                                        }         As usual, the calculated values can be watched in the "Variables" window on the top right of the Debug perspective or in the FreeMASTER application. The complete source code written in the CW 10.3 as well as the FreeMASTER project is attached to this document. If there are any questions regarding this simple application, please feel free to ask below. Your feedback or suggestions are also welcome. Regards, Tomas
View full article
Hi Everyone,   To complete the collection of simple bare-metal examples for the Xtrinsic sensors on the FRDM-FXS-MULTI(-B) sensor expansion board, I would like to share here another example code/demo I have created for the MPL3115A2 pressure sensor.   This example illustrates: 1. Initialization of the MKL25Z128 MCU (mainly I2C and PORT modules). 2. I2C data write and read operations. 3. Initialization of the MPL3115A2. 4. Output data reading using an interrupt technique. 5. Conversion of the output values from registers 0x01 – 0x05 to real values in Pascals and °C. 6. Visualization of the output values in the FreeMASTER tool.   1. As you can see in the FRDM-FXS-MULTI(-B)/FRDM-KL25Z schematics and the image below, I2C signals are routed to the I2C1 module (PTC1 and PTC2 pins) of the KL25Z MCU and the INT1 output (INT_PED) is connected to the PTA13 pin (make sure that pins 2-3 of J5 on the sensor board are connected together using a jumper). The INT1 output of the MPL3115A2 is configured as a push-pull active-low output, so the corresponding PTA13 pin configuration is GPIO with an interrupt on falling edge.     The MCU is, therefore, configured as follows. void MCU_Init(void) {      //I2C1 module initialization      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(0x2);         // PTC1 pin is I2C1 SCL line      PORTC_PCR2 |= PORT_PCR_MUX(0x2);         // PTC2 pin is I2C1 SDA line      I2C1_F  |= I2C_F_ICR(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 PTA13 pin (connected to the INT1 of the MPL3115A2) for falling edge interrupts      SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK;       // Turn on clock to Port A module      PORTA_PCR13 |= (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. The 7-bit I 2 C address of the MPL3115A2 is fixed value 0x60 which translates to 0xC0 for a write and 0xC1 for a read. As shown above, the SCL line is connected to the PTC1 pin and SDA line to the PTC2 pin. The I2C clock frequency is 125 kHz. The screenshot below shows the write operation which writes the value 0x39 to the CTRL_REG1 register (0x26).     And here is the single byte read from the WHO_AM_I register (0x0C). As you can see, it returns the correct device ID 0xC4.     Multiple bytes of data can be read from sequential registers after each MPL3115A2 acknowledgment (AK) is received until a no acknowledge (NAK) occurs from the KL25Z followed by a stop condition (SP) signaling an end of transmission. A burst read of 5 bytes from registers 0x01 to 0x05 is shown below. It also shows how the INT1 pin is automatically deasserted by reading the output registers.       3. At the beginning of the initialization, all MPL3115A2 registers are reset to their default values by setting the RST bit of the CTRL_REG1 register. The DRDY interrupt is enabled and routed to the INT1 pin that is configured to be a push-pull, active-low output. Further, the OSR ratio of 128 is selected and finally the part goes into Active barometer (eventually altimeter) mode.   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, PT_DATA_CFG_REG, 0x07);    // Enable data flags      I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG3, 0x00);          // Push-pull, active low interrupt      I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG4, 0x80);          // Enable DRDY interrupt      I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG5, 0x80);          // DRDY interrupt routed to INT1 - PTA13      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 }   4. 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_PCR13 |= PORT_PCR_ISF_MASK;          // Clear the interrupt flag      DataReady = 1;   }   5. In the main loop, the DataReady variable is periodically checked and if it is set, both pressure (eventually altitude) and temperature data are read and then calculated.  if (DataReady)          // Is a new set of data ready? {      DataReady = 0;                                                                                                                         I2C_ReadMultiRegisters(MPL3115A2_I2C_ADDRESS, OUT_P_MSB_REG, 5, RawData);          // Read data output registers 0x01-0x05                    /* 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 RawData[0], RawData[1] and bits 7-6 of RawData[2].      The fractional component is located in bits 5-4 of RawData[2]. Bits 3-0 of RawData[2] are not used.*/                                             Pressure = (float) (((RawData[0] << 16) | (RawData[1] << 😎 | (RawData[2] & 0xC0)) >> 6) + (float) ((RawData[2] & 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 RawData[3].      The fractional component is located in bits 7-4 of RawData[4]. Bits 3-0 of OUT_T_LSB are not used. */                         Temperature = (float) ((short)((RawData[3] << 😎 | (RawData[4] & 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 RawData[0] and RawData[1].      The fraction component is located in bits 7-4 of RawData[2]. Bits 3-0 of RawData[2] are not used */                                       //Altitude = (float) ((short) ((RawData[0] << 😎 | RawData[1])) + (float) (RawData[2] >> 4) * 0.0625; }   6. 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 1.4 application and FreeMASTER Communication Driver.      Attached you can find the complete source code written in the CW for MCU's v10.5 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: FreeMASTER---FRDM-KL25Z-MPL3115A2-Pressure-and-temperature-reading-using-I2C-and-interrupt.zip Original Attachment has been moved to: FRDM-KL25Z-MPL3115A2-Pressure-and-temperature-reading-using-I2C-and-interrupt.zip
View full article
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.
View full article
Hi Everyone,   I would like to share a simple example code/demo that reads both the altitude and temperature data from the Xtrinsic MPL3115A2 pressure sensor and visualizes them using the FreeMASTER tool via USBDM interface. I have used recently released Xtrinsic MEMS sensors board that features three types of Xtrinsic sensors including the MPL3115A2 and is fully compatible with the Freescale FRDM-KL25Z platform.   According to the User Manual, both interrupt pins of the MPL3115A2 are connected to the PTD3 pin of KL25Z MCU through a 4.7K pull-up resistor as well as both SCL and SDA lines that are connected to the I2C1 module (PTE1 and PTE0 pins) on the KL25Z. The MCU is, therefore, configured as follows: void MCU_Init(void) {        //I2C1 module initialization            SIM_SCGC4 |= SIM_SCGC4_I2C1_MASK;        // Turn on clock to I2C1 module        SIM_SCGC5 |= SIM_SCGC5_PORTE_MASK;       // Turn on clock to Port E module        PORTE_PCR1 = PORT_PCR_MUX(6);            // PTE1 pin is I2C1 SCL line        PORTE_PCR0 = PORT_PCR_MUX(6);            // PTE0 pin is I2C1 SDA line        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 PTD3 pin (connected to the INT2 of the MPL3115A2) for falling edge interrupt          SIM_SCGC5 |= SIM_SCGC5_PORTD_MASK;       // Turn on clock to Port D module        PORTD_PCR3 |= (0|PORT_PCR_ISF_MASK|      // Clear the interrupt flag        PORT_PCR_MUX(0x1)|                       // PTD3 is configured as GPIO        PORT_PCR_IRQC(0xA));                     // PTD3 is configured for falling edge interrupts                     //Enable PORTD interrupt on NVIC        NVIC_ICPR |= 1 << ((INT_PORTD - 16)%32);        NVIC_ISER |= 1 << ((INT_PORTD - 16)%32); }   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() {        PORTD_PCR3 |= PORT_PCR_ISF_MASK;         // Clear the interrupt flag        DataReady = 1; } At the beginning of the initialization, all MPL3115A2 registers are reset to their default values by setting the RST bit of the CTRL_REG1 register.The DRDY interrupt is enabled and routed to the INT2 pin that is configured to be an open-drain, active-low output. During the initialization of the MPL3115A2, the OSR ratio of 128 is selected and finally the part goes into Active Altimeter mode.   void MPL3115A2_Init (void) {        unsigned char reg_val = 0;                    I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG1, 0x04);                        // Reset all registers to POR values             do            // Wait for the RST bit to clear        {           reg_val = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG1) & 0x04;        }  while (reg_val);        I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, PT_DATA_CFG_REG, 0x07);                  // Enable data flags        I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG3, 0x11);                        // Open drain, active low interrupts        I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG4, 0x80);                        // Enable DRDY interrupt        I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG5, 0x00);                        // DRDY interrupt routed to INT2 - PTD3        I2C_WriteRegister(MPL3115A2_I2C_ADDRESS, CTRL_REG1, 0xB9);                        // Active altimeter mode, OSR = 128 }   In the main loop, the DataReady variable is periodically checked and if it is set, both altitude and temperature data are read and then calculated.   if (DataReady)          // Is a new set of data ready? {                   DataReady = 0;                  OUT_P_MSB = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, OUT_P_MSB_REG);        // High byte of integer part of altitude,        OUT_P_CSB = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, OUT_P_CSB_REG);        // Low byte of integer part of altitude        OUT_P_LSB = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, OUT_P_LSB_REG);        // Decimal part of altitude in bits 7-4        OUT_T_MSB = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, OUT_T_MSB_REG);        // Integer part of temperature        OUT_T_LSB = I2C_ReadRegister(MPL3115A2_I2C_ADDRESS, OUT_T_LSB_REG);        // Decimal part of temperature in bits 7-4                           /* 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 = (float) ((short) ((OUT_P_MSB << 😎 | OUT_P_CSB)) + (float) (OUT_P_LSB >> 4) * 0.0625;                     /* 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 = (float) ((signed char) OUT_T_MSB) + (float) (OUT_T_LSB >> 4) * 0.0625;                                                              }   The calculated values can be watched in the "Variables" window on the top right of the Debug perspective or in the FreeMASTER application. Attached you can find the complete source code written in the CW 10.3 as well as the FreeMASTER project.   If there are any questions regarding this simple application, please feel free to ask below. Your feedback or suggestions are also welcome.   Regards, Tomas Original Attachment has been moved to: FreeMASTER---XTRINSIC-SENSORS-EVK_MPL3115A2_BasicReadUsingInterrupt.zip Original Attachment has been moved to: XTRINSIC-SENSORS-EVK_MPL3115A2_BasicReadUsingInterrupt.zip
View full article
Ever wondered about the pin styles for pressure sensors in their data sheets? Well then here are some useful notes. The difference between style 1 and style 2 in the package dimensions is due to the two main families of pressure sensors Freescale offers. Style 1 is usually applicable for all MPXx10, MPXx53 and MPXx2000-series SOP Type package pressure sensors featuring differential outputs. Style 2 is applicable for all MPXx4000-series, MPXx5000-series, MPXx6000-series, MPXx7000-series integrated devices in surface mount packages featuring single ended outputs. E.g. for MPXV7002DP case no. 1351-01 SMALL OUTLINE PACKAGE
View full article
SOP Dual Side Port Package_1351-01
View full article
        The FXTH87xx is a sensor for use in applications that monitor tire pressure and temperature. It contains the pressure and temperature sensors, an X-axis and a Z-axis accelerometer, a microcontroller, an LF receiver and an RF transmitter all within a single package.        Recently a customer requests help to connect FXTH87xx with Infineon TPMS receiver. We connect them each other through some testing and verification finally. The target of this document description is to replace external emitter with FXTH87xx. This document take an example to offer the users a method how to detect and decode an unknown sensor Emitter Packets using instrument provided by R&S or Anritsu, then duplicate this Emitter packets into FXTH87xx to form 315MHz, 433.92MHz TPMS emitter and receiver solution. Customer who adapts FXTH87xx can easily connect it with any external receiver using the similiar concept.
View full article
Hi Everyone, In this document I would like to present a simple example code I created for the FRDMKL25-P3115 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 both the pressure/altitude and temperature data that are read from the MPL3115A2 using an interrupt technique through the I 2 C interface. This example illustrates: 1. Initialization of the MKL25Z128 MCU (mainly PORT and I 2 C modules). 2. I 2 C data write and read operations. 3. Initialization of the MPL3115A2. 4. Output data reading using an interrupt technique. 5. Conversion of the output values from registers 0x01 – 0x05 to real values in Pascals/meters and °C 6. Visualization of the calculated values in the FreeMASTER tool. 1. As you can see in the FRDMSTBC-P3115 schematic and the image below, with jumpers J7 and J8 in their default position (2-3), the I 2 C signals are routed to the I2C1 module (PTC1 and PTC2 pins) of the KL25Z MCU. The INT1 output is connected to the PTA5 pin and configured as push-pull active-low output, so the corresponding PTA5 pin configuration is GPIO with an interrupt on falling edge. The configuration is done in the BOARD_InitPins() function. void BOARD_InitPins(void) {     CLOCK_EnableClock(kCLOCK_PortC);                                            /* Port C Clock Gate Control: Clock enabled */     CLOCK_EnableClock(kCLOCK_I2c1);                                             /* I2C1 Clock Gate Control: Clock enabled */     PORT_SetPinMux(PORTC, PIN1_IDX, kPORT_MuxAlt2);                             /* PORTC1 (pin 56) is configured as I2C1_SCL */     PORT_SetPinMux(PORTC, PIN2_IDX, kPORT_MuxAlt2);                             /* PORTC2 (pin 57) is configured as I2C1_SDA */     CLOCK_EnableClock(kCLOCK_PortA);                                            /* Port A Clock Gate Control: Clock enabled */     PORT_SetPinMux(PORTA, PIN5_IDX, kPORT_MuxAsGpio);                           /* PORTA5 (pin 31) is configured as PTA5 */     PORT_SetPinInterruptConfig(PORTA, PIN5_IDX, kPORT_InterruptFallingEdge);    /* PTA5 is configured for falling edge interrupts */     NVIC_EnableIRQ(PORTA_IRQn);                                                 /* Enable PORTA interrupt on NVIC */ } 2. The 7-bit I 2 C address of the MPL3115A2 is a fixed value 0x60 (defined in the MPL3115A2.h file) which translates to 0xC0 for a write and 0xC1 for a read. As mentioned before, the SCL line is connected to the PTC1 pin and SDA line to the PTC2 pin. The I 2 C clock frequency is 100 kHz. The I2C_Init() function is used to enable and configure the I2C1 module. void I2C_Init(void) {     i2c_master_config_t config = {     .enableMaster = true,     .enableStopHold = false,     .enableHighDrive = false,     .baudRate_Bps = 100000,     .glitchFilterWidth = 0      };     I2C_MasterInit(I2C1, &config, 24000000U);     I2C_MasterTransferCreateHandle(I2C1, &p_handle, i2c_master_callback, NULL); } The screenshot below shows the write operation which writes the value 0x39 to the CTRL_REG1 register (0x26). Here is a burst read of 5 bytes from registers 0x01 to 0x05. It also shows how the INT1 pin is automatically deasserted by reading the output registers. 3. At the beginning of the initialization, all MPL3115A2 registers are reset to their default values by setting the RST bit of the CTRL_REG1 register. The DRDY interrupt is enabled and routed to the INT1 pin that is configured to be a push-pull, active-low output. Further, the OSR ratio of 128 is selected and finally the part goes into Active barometer (eventually altimeter) mode. void MPL3115A2_Init (void) {     I2C_WriteRegister(I2C1, MPL3115A2_I2C_ADDRESS, CTRL_REG1, 0x04);               /* Reset all registers to POR values */     Pause(0xC62);          // ~1ms delay     I2C_WriteRegister(I2C1, MPL3115A2_I2C_ADDRESS, PT_DATA_CFG_REG, 0x07);         /* Enable data flags */     I2C_WriteRegister(I2C1, MPL3115A2_I2C_ADDRESS, CTRL_REG3, 0x00);               /* Push-pull, active low interrupt */     I2C_WriteRegister(I2C1, MPL3115A2_I2C_ADDRESS, CTRL_REG4, 0x80);               /* Enable DRDY interrupt */     I2C_WriteRegister(I2C1, MPL3115A2_I2C_ADDRESS, CTRL_REG5, 0x80);               /* DRDY interrupt routed to INT1 - PTA13 */     I2C_WriteRegister(I2C1, MPL3115A2_I2C_ADDRESS, CTRL_REG1, 0x39);               /* Active barometer mode, OSR = 128 */     //I2C_WriteRegister(I2C1, MPL3115A2_I2C_ADDRESS, CTRL_REG1, 0xB9);             /* Active altimeter mode, OSR = 128 */ } 4. 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(void) {     PORT_ClearPinsInterruptFlags(PORTA, 1<<5);                /* Clear the interrupt flag */     DataReady = 1; } 5. In the main loop, the DataReady variable is periodically checked and if it is set, both pressure (eventually altitude) and temperature data are read and then calculated. if (DataReady)                  /* Is a new set of data ready? */ {     DataReady = 0;     I2C_ReadMultiRegisters(I2C1, MPL3115A2_I2C_ADDRESS, OUT_P_MSB_REG, RawData, 5);                      /* Read data output registers 0x01-0x05 */     /* 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 = (float) (((RawData[0] << 16) | (RawData[1] << 8) | (RawData[2] & 0xC0)) >> 6) + (float) ((RawData[2] & 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 = (float) ((short)((RawData[3] << 8) | (RawData[4] & 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 = (float) ((short) ((RawData[0] << 8) | RawData[1])) + (float) (RawData[2] >> 4) * 0.0625; } 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
Unibody Package with Side Port_867B-04  
View full article
Hi Folks, If you are planning to design an application where a pressure sensor is needed but you are not sure about which kind of Pressure Measurement and Level of Integration is needed, or you even doesn’t know what does that means (like me before start working with pressure sensors), then this document can be useful. First, for a better understanding about what I’m talking about in this document and how pressure sensors and measurement works I’m adding below an image that shows a cross-section of a standard pressure sensor which basically shows the Physical Internal structure of a pressure sensor: What I’m trying to show in this image is the position of the Ports P1 and P2, you will see the importance of these ports and its position for the pressure measurement. Also in this image you can see that the die and the wire bonds are protected with a Silicone Gel, this gel can get damaged leaving the die and the wire bonds exposed to the media if it’s used with different media than dry clean air. Pressure Measurements can be divided into three different categories: Absolute pressure, Gage (Gauge) pressure and Differential pressure. Let’s learn something about these categories: + Absolute pressure refers to the absolute value of the force per-unit-area exerted on a surface. Therefore the absolute pressure is the difference between the pressure at a given point and the absolute zero of pressure or a perfect vacuum. In other words: Pressure is applied on Port P1 of the sensor while the Port P2 of the sensor is a vacuum sealed reference. + Gage (Gauge) pressure is the measurement of the difference between the absolute pressure and the Local atmospheric pressure. In other words: Port P2 of the sensor is exposed to the local atmosphere while Port P1 is where pressure is applied. *Local atmospheric pressure can vary depending on ambient temperature, altitude and local weather conditions. A gage pressure by convention is always positive. A 'negative' gage pressure is defined as vacuum. Vacuum is the measurement of the amount by which the local atmospheric pressure exceeds the absolute pressure. A perfect vacuum is zero absolute pressure. + Differential pressure is simply the measurement of one unknown pressure with reference to another unknown pressure. The pressure measured is the difference between the two unknown pressures. In other words: The difference in pressure between two points is measured where pressure is applied to both sides (Port P1 and Port P2) of sensor. Since a differential pressure is a measure of one pressure referenced to another, it is not necessary to specify a pressure reference. Figure below shows the relationship between Absolute, Gage pressure and Vacuum. Freescale Pressure Sensors can also be divided into three different categories according to the Level of Integration: Uncompensated, Temperature Compensated and Integrated, now let’s learn the difference between these categories: + Uncompensated Pressure Sensors are the most basic pressure sensors according to the level of integration; this type of sensor gives a differential output in the range of millivolts, this output will need to be temperature compensated and amplified with external circuitry before sending it to the MCU’s ADC.   + Compensated Pressure Sensors is the following step according to the level of integration; although this type of sensor also gives you a differential output in the range of millivolts, the given output it’s already internally temperature compensated, so externally you only need to add the amplification circuit before sending the sensor’s signal to the MCU’s ADC. + Integrated Pressure Sensor (IPS) gives you the complete solution embedded into the same package, the output signal of the integrated pressure sensors it’s already internally temperature compensated and amplified (the output range can be from 0 to ~3V or from 0 to ~5V depending on the part number), so you do not have to worry about adding external circuitry (just probably some decoupling capacitors), the sensor signal can be sent directly to the MCU’s ADC. Additional to the mentioned types of Pressure Sensors, we also have some Digital Output Pressure Sensors which can be communicated with the MCU via SPI (MPL115A1 Digital Pressure Sensor) or I2C (MPL115A2 and MPL3115A2 Digital Pressure Sensor). Now that you know about Pressure Measurement and Level of Integration, you can jump into my Community Guideline to select the best Freescale Pressure Sensor Part Number for your application. If there are any questions regarding this document, please feel free to ask below. Your feedback or suggestions are also welcome. Regards, Jose
View full article
Here is the Installer file for the revision 4.2.0.8 of the Sensor Toolbox GUI
View full article
  LGA 8 PACKAGE 5.0 mm x 3.0 mm x 1.1 mm  
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
Our pressure sensors are designed to be used with clean, dry air only. However, most of our customers ran their own tests to determine if the response of the sensor would be appropriated for their specific applications. I personally ran a test with an MPXV5700AP directly exposed to car coolant @25°C and 100PSI, zero failure was detected for almost a month. See attached .xlsx for detailed information. The error of the sensor was calculated comparing the output of the sensor with a mechanical manometer, however this was only an approximation since the mechanical manometer was used as the "true pressure value". In this kind of applications, we would recommend to use Parker O-lube silicone grease or DMS-T46 or T51. This type of grease is used by most of our customer without problems. In fact the basic recommendations are to use a silicone oil (or preferably grease) with high viscosity and high molecular weight. In this case the size of the molecules are big enough to limit the penetration of the grease inside our protective silicone gel which is over the die. In terms of contaminants, the silicon grease must be free of halogenures (Cl content < 50 ppm) to reduce the risk of bond pad corrosion. On the other hand, don't forget that whatever the material you will use, as soon as you put something on our gel you have a high probability to see some offset drift. This is coming from additional mechanical stress and/or gel swelling. The amount of gel and global mechanical design are usually also part of the offset drift.
View full article
My friend Matt Muddiman of Freescale gave this presentation as part of the MEMS Education Series (hosted by Arizona Technology Council and MEMS Industry Group) in Scottsdale Arizona earlier this week.
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
Hello community, As continuation of the Different pin styles in pressure sensors post, I would like to add some useful information about the pin styles mentioned on the datasheets. Some pressure sensors shows the following pin style configuration: But… What do V1, V2 and VEx actually mean? How should I connect those pins? Answer: V1, V2 and VEX pins are used for factory trimming and it is recommended to leave these pins unconnected. So, in case of unibody package, you will require only pin #1 (Vout), pin #2 (Ground), and pin #3 (Vs) as follow: I hope you find useful this information. Regards, David
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
SOP Top Side Port Package_1369-01  
View full article
clicktaleID