From 1ec4ef0be6a7fbdbc06baf705eb29337f948d181 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Tue, 16 Jun 2026 08:12:55 +0000 Subject: [PATCH] Add README.md --- README.en.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 README.en.md create mode 100644 README.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..4c1cf14 --- /dev/null +++ b/README.en.md @@ -0,0 +1,80 @@ +# Slope + +Vehicle slope detection system based on STM32F407ZETx. + +## Project Overview + +Slope is an embedded slope detection system running on the STM32F407ZETx microcontroller (ARM Cortex-M4), designed to detect the slope angle in real time during vehicle motion. The system integrates the ASM330LHB six-axis inertial measurement unit (IMU), communicates with the vehicle network via CAN bus, and outputs slope data through the CAN bus. + +## Hardware Platform + +- **Microcontroller**: STM32F407ZETx +- **Clock Frequency**: 168 MHz (Cortex-M4 with FPU) +- **IMU Sensor**: ASM330LHB (3-axis accelerometer + 3-axis gyroscope) + +## Module Structure + +### Driver Layer (DRIVER) + +| Module | Function | +|--------|----------| +| `can_driver` | CAN bus communication, supports standard frame transmission/reception with FIFO receive buffer | +| `iic_driver` | I2C bus communication for reading IMU sensor data | +| `usart_driver` | Serial debugging output (printf redirection) | +| `led_driver` | LED status indication | +| `delay` | System delay functions (based on SysTick) | +| `TIM` | Timer driver for periodic task scheduling | + +### Service Layer (SERVICE) + +| Module | Function | +|--------|----------| +| `ASM330LHB` | IMU sensor driver supporting acceleration and angular rate data acquisition, zero-offset compensation, and angle calculation | +| `SLOPE` | Slope detection algorithm (generated by MATLAB/Simulink), including Kalman filtering, slope calculation, and state machine | +| `flash_service` | Flash parameter storage service supporting parameter saving and loading | + +## Communication Protocol + +### CAN Bus + +- **Received Data Frames**: + - `IMU_ACC_CAN_ID`: Accelerometer data (0x101) + - `IMU_GA_AND_SLOPE_CAN_ID`: Gear position and slope data (0x102) + +- **Transmitted Data Frames**: + - Slope results are output via CAN bus + +## Usage Instructions + +### Compilation Environment + +- Keil MDK (open via `Application/PROJECT/MDK/Application.uvprojx`) + +### Configuration Parameters + +The system supports storing configuration parameters in Flash, including: +- Accelerometer zero-offset calibration values +- Gyroscope zero-offset calibration values +- Slope algorithm parameters + +### Debug Information + +The default serial baud rate can be configured via `USART1_Debug_Init()`. System runtime information can be viewed via printf output. + +## Directory Structure + +``` +Application/ +├── CODE/ +│ ├── DRIVER/ # Low-level drivers +│ ├── SERVICE/ # Business services +│ ├── MAIN/ # Main program +│ └── PROJECT/ # Keil project files +└── STDLIB/ + ├── CORE/ # STM32 core peripherals + └── FWLIB/ # STM32 HAL library +``` + +## License + +This project is for internal use only. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9ad0bf1 --- /dev/null +++ b/README.md @@ -0,0 +1,82 @@ + + +# Slope + +基于 STM32F407ZETx 的车辆坡度检测系统。 + +## 项目简介 + +Slope 是一个嵌入式坡度检测系统,运行于 STM32F407ZETx 微控制器(ARM Cortex-M4),用于实时检测车辆行驶过程中的坡度角度。系统集成了 ASM330LHB 六轴惯性测量单元(IMU),通过 CAN 总线与车辆网络通信,并将坡度数据通过 CAN 总线输出。 + +## 硬件平台 + +- **微控制器**: STM32F407ZETx +- **主频**: 168 MHz (Cortex-M4 with FPU) +- **IMU 传感器**: ASM330LHB (3-axis accelerometer + 3-axis gyroscope) + +## 模块结构 + +### 驱动层 (DRIVER) + +| 模块 | 功能 | +|------|------| +| `can_driver` | CAN 总线通信,支持标准帧收发,带 FIFO 接收缓冲 | +| `iic_driver` | I2C 总线通信,用于 IMU 传感器数据读取 | +| `usart_driver` | 串口调试输出(重定向 printf) | +| `led_driver` | LED 状态指示 | +| `delay` | 系统延时函数(基于 SysTick) | +| `TIM` | 定时器驱动,用于周期性任务调度 | + +### 服务层 (SERVICE) + +| 模块 | 功能 | +|------|------| +| `ASM330LHB` | IMU 传感器驱动,支持加速度和角速度数据读取,零偏补偿,角度计算 | +| `SLOPE` | 坡度检测算法(MATLAB/Simulink 生成),包含卡尔曼滤波、坡度计算、状态机 | +| `flash_service` | Flash 参数存储服务,支持参数保存和加载 | + +## 通信协议 + +### CAN 总线 + +- **接收数据帧**: + - `IMU_ACC_CAN_ID`: 加速度计数据 (0x101) + - `IMU_GA_AND_SLOPE_CAN_ID`: 档位和坡度数据 (0x102) + +- **发送数据帧**: + - 坡度结果通过 CAN 总线输出 + +## 使用说明 + +### 编译环境 + +- Keil MDK (通过 `Application/PROJECT/MDK/Application.uvprojx` 打开) + +### 配置参数 + +系统支持通过 Flash 存储配置参数,包括: +- 加速度计零偏校准值 +- 陀螺仪零偏校准值 +- 坡度算法参数 + +### 调试信息 + +串口默认波特率可通过 `USART1_Debug_Init()` 配置,系统运行信息可通过 printf 输出查看。 + +## 目录结构 + +``` +Application/ +├── CODE/ +│ ├── DRIVER/ # 底层驱动 +│ ├── SERVICE/ # 业务服务 +│ ├── MAIN/ # 主程序 +│ └── PROJECT/ # Keil 工程文件 +└── STDLIB/ + ├── CORE/ # STM32 核心外设 + └── FWLIB/ # STM32 HAL 库 +``` + +## 许可证 + +本项目为内部使用项目。 \ No newline at end of file -- Gitee