# Slope **Repository Path**: boolean_2/Slope ## Basic Information - **Project Name**: Slope - **Description**: 坡度 - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-16 - **Last Updated**: 2026-06-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Slope - Vehicle Slope Detection System [View Chinese Version](#chinese-version) ## Project Overview Slope is a vehicle slope detection system based on the STM32F407 microcontroller. The system collects acceleration and gyroscope data from an IMU (Inertial Measurement Unit) sensor, processes it using a Kalman filter algorithm to calculate road slope in real time, and transmits the results via CAN bus to the vehicle control system. ## Hardware Platform - **MCU**: STM32F407ZETx (ARM Cortex-M4, 168MHz) - **IMU**: ASM330LHB (3-axis accelerometer + 3-axis gyroscope) - **Communication**: CAN bus - **Debug**: USART1 (serial debug output) ## Features - Real-time acquisition of raw acceleration and gyroscope data - Kalman filter algorithm for sensor data processing - Detection of uphill/downhill/flat road conditions - Calculation of road slope angle - CAN bus data communication - Flash storage for parameter retention ## Project Structure ``` Application/ ├── CODE/ │ ├── DRIVER/ # Low-level drivers │ │ ├── can_driver.c # CAN driver │ │ ├── delay.c # Delay functions │ │ ├── iic_driver.c # I2C driver │ │ ├── led_driver.c # LED driver │ │ ├── tim.c # Timer │ │ └── usart_driver.c # UART driver │ ├── MAIN/ │ │ └── main.c # Main program │ └── SERVICE/ │ ├── ASM330LHB.c # IMU sensor driver │ ├── flash_service.c # Flash storage service │ └── SLOPE/ # Slope detection algorithm │ ├── slope_new.c │ ├── slope_new_data.c │ └── rt_nonfinite.c ├── PROJECT/ │ └── MDK/ # Keil project files └── STDLIB/ ├── CORE/ # STM32 core files └── FWLIB/ # STM32 peripheral libraries ``` ## Quick Start ### Compilation Open `Application/PROJECT/MDK/Application.uvprojx` with Keil MDK and compile. ### Flashing Flash `Application/PROJECT/BIN/Application.bin` to the MCU using J-Link or ST-Link. ### Debugging The default serial baud rate is 115200. Monitor debug output via the serial port. ## CAN Communication Protocol | CAN ID | Description | |--------|-------------| | 0x01 | Accelerometer data | | 0x02 | Slope and status data | ## Dependencies - STM32F4xx HAL Library - CMSIS --- ## License This project is for learning and research purposes only.