# 硬件模块包管理器:uart006读取BMP390压强 **Repository Path**: zhiOS/uart006 ## Basic Information - **Project Name**: 硬件模块包管理器:uart006读取BMP390压强 - **Description**: 创建stm32f103工程,使用PB6-SCL,PB7-SDA读取BMP390芯片压强信息; - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-26 - **Last Updated**: 2026-07-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # BMP3XX Pressure Sensor Driver A BMP390 pressure sensor driver project based on the STM32F103, supporting both I2C and SPI communication interfaces. ## Project Overview This project implements a driver for the Bosch BMP390 digital pressure sensor running on the STM32F103 microcontroller. The BMP390 is a high-precision, low-power digital pressure sensor widely used in applications such as drone altitude control, weather stations, and indoor navigation. ## Hardware Requirements - **MCU**: STM32F103xE (ARM Cortex-M3) - **Sensor**: BMP390 - **Communication Interface**: I2C or SPI (selectable via code) ## Features - Supports both I2C and SPI communication interfaces - Reads pressure and temperature data - Supports FIFO data buffering - Configurable sample rate (ODR) and filter settings - Supports interrupts and power consumption control ## Project Structure ``` ├── Core/ │ ├── Inc/ # Header files │ │ ├── bmp3.h # BMP3 driver header │ │ ├── bmp3_defs.h # BMP3 definitions │ │ └── main.h # Main program header │ └── Src/ # Source code │ ├── bmp3.c # BMP3 driver implementation │ ├── common.c # Communication interface (I2C/SPI) │ └── main.c # Main program ├── Drivers/ # STM32 HAL driver library └── MDK-ARM/ # Keil MDK project files ``` ## Quick Start ### 1. Hardware Connections **I2C Interface:** - I2C1_SCL -> PC5 - I2C1_SDA -> PC4 **SPI Interface:** - SPI1_SCK -> PA5 - SPI1_MISO -> PA6 - SPI1_MOSI -> PA7 ### 2. Compilation and Download Open the `MDK-ARM/BMP3XX.uvprojx` project file using Keil MDK, compile, and download to the development board. ### 3. Usage Example ```c // Initialize BMP390 struct bmp3_dev bmp3; bmp3_interface_init(&bmp3, BMP3_I2C_INTF); // or BMP3_SPI_INTF bmp3_init(&bmp3); // Read sensor data struct bmp3_data comp_data; bmp3_get_sensor_data(BMP3_PRESS | BMP3_TEMP, &comp_data, &bmp3); // Output results printf("Pressure: %.2f Pa\r\n", comp_data.pressure); printf("Temperature: %.2f C\r\n", comp_data.temperature); ``` ## API Reference ### Initialization - `bmp3_init()` - Initialize the BMP390 sensor - `bmp3_interface_init()` - Initialize the communication interface ### Data Reading - `bmp3_get_sensor_data()` - Read compensated pressure and temperature data - `bmp3_get_fifo_data()` - Read data from the FIFO buffer ### Configuration - `bmp3_set_sensor_settings()` - Configure sensor parameters - `bmp3_set_op_mode()` - Set operating mode (sleep/forced/normal) ## Notes 1. Ensure the BMP390 power supply voltage is between 1.65V and 3.6V. 2. The default I2C address is 0x76 or 0x77 (selectable via the SDO pin). 3. Calibration data must be read during first-time use. 4. It is recommended to configure ODR and oversampling rates appropriately based on application requirements to balance power consumption and accuracy. ## License This project is intended solely for learning and research purposes.