1. Introduction to SPL06
SPL06 is the latest new air pressure sensor launched by Goertek. The latest new air pressure sensor SPL06-001 is launched. Goertek is a world-leading MEMS manufacturer. SPL06 uses Goertek's MEMS development technology accumulated over many years. By carrying high-precision detection MEMS (MicroElectroMechanicalSystems) and low-power integrated circuits, it has achieved the industry's highest level of accuracy of ±5cm. SPL06 is a miniaturized digital air pressure sensor with high precision and low current consumption, combining pressure and temperature measurement. The pressure sensor element is based on the principle of capacitive sensors to ensure high-precision measurement during temperature changes. The small package structure is suitable for mobile applications and wearable devices. The internal signal processor of SPL06 converts the output of the pressure and temperature sensor elements into 24-bit data. Each pressure sensor has been individually calibrated and contains calibration coefficients. The coefficients are used in the application to convert the measurement results into real pressure and temperature values.
The actual picture of SPL06 is shown below.
2. Barometer Data Acquisition Experiment
The barometer data acquisition experiment uses the hardware SPI of STM32 to connect to the barometer SPL06. Serial port 1 is UART1, and the computer is connected through the USB to serial port module. The original pressure value and original temperature value data of SPL06 obtained by SPI are transmitted to the serial port debugging assistant on the computer through serial port 1 for display. When doing this experiment, you need to temporarily remove the visual module and connect the USB to serial port line to the visual module interface. The barometer SPL06 is in the white RGB light box on the top of the drone. The SPI and power supply ports are connected through the soft row, as shown in the figure below.
According to the schematic diagram, we can see that the SPI interfaces of SPL06 are: PB15, PA5, PA6, and PA7, as shown in the figure below.
For the configuration of serial port 1, please refer to "Serial port (basic transmission and reception), configuration code (by calling the official library)".
The idea of writing code to obtain SPL06 data is as follows:
1
|
Pin Configuration
|
1. Define the structure
2. Enable the clock
3. Filling the structure
4. Loading structure
|
2
|
SPI Configuration
|
1. Define the structure
2. Enable the clock
3. Filling the structure
4. Loading structure
5. Enable SPI
|
3
|
SPI read and write logic
|
1. Read a byte
2. Write a byte
|
4
|
SPL06 Driver
|
1. Read from the sensor
2. Write from sensor
3. ICM20602 initialization
|
The SPI initialization code is as follows:
The SPI read and write codes are as follows.
The initialization code of SPL06 is as follows.
The read and write codes of SPL06 are as follows.
After checking the manual, I found that the 24-bit original values of pressure and temperature are at addresses 0x00~0x05.
Read the register data and send it to the serial port. The code is as follows.
Here, please note that the serial port transmission must also be configured so that the data can be sent to the computer. Serial port 1 is connected to the computer through the USB to serial port module, save, compile, and download the code. You can see that the USB to serial port module is constantly printing the 3-byte original pressure value data and 3-byte original temperature data of SPL06. The data is shown in the figure below: