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.
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.
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.
Once the coefficients are obtained, they are computed inside the MPL115A1_Read_Preassure function.
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.
[CS=0], [0x24], [0x00], [CS=1], [13 ms Delay]
This is the MPL115A2 SPI commands to read raw temperature and pressure data.