terry 2 yıl önce
ebeveyn
işleme
02f400ae37

Dosya farkı çok büyük olduğundan ihmal edildi
+ 15 - 13
.mxproject


+ 52 - 0
Core/Inc/dma.h

@@ -0,0 +1,52 @@
+/* USER CODE BEGIN Header */
+/**
+  ******************************************************************************
+  * @file    dma.h
+  * @brief   This file contains all the function prototypes for
+  *          the dma.c file
+  ******************************************************************************
+  * @attention
+  *
+  * Copyright (c) 2023 STMicroelectronics.
+  * All rights reserved.
+  *
+  * This software is licensed under terms that can be found in the LICENSE file
+  * in the root directory of this software component.
+  * If no LICENSE file comes with this software, it is provided AS-IS.
+  *
+  ******************************************************************************
+  */
+/* USER CODE END Header */
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __DMA_H__
+#define __DMA_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "main.h"
+
+/* DMA memory to memory transfer handles -------------------------------------*/
+
+/* USER CODE BEGIN Includes */
+
+/* USER CODE END Includes */
+
+/* USER CODE BEGIN Private defines */
+
+/* USER CODE END Private defines */
+
+void MX_DMA_Init(void);
+
+/* USER CODE BEGIN Prototypes */
+
+/* USER CODE END Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DMA_H__ */
+

+ 6 - 4
Core/Inc/main.h

@@ -47,15 +47,17 @@ extern "C" {
 
 /* Exported macro ------------------------------------------------------------*/
 /* USER CODE BEGIN EM */
+#define Rx_Max 1024  	
+#define Version_sys 0x23051700  	
 extern uint8_t receive_buffer[30];  // 定义接收缓存,这里假设最多可以接收100个字节
 extern uint8_t flag ;
-
 extern uint16_t Adc2_CalibrationValue ;
 extern uint16_t Adc3_CalibrationValue ;
-
 extern uint8_t gpioaStatus ;
-extern uint8_t gpiobStatus ;
-
+extern uint8_t gpiobStatus ; 
+extern uint8_t		Rx_Flag;
+extern uint16_t		Rx_Len;
+extern uint8_t		Rx_Buf[Rx_Max];
 /* USER CODE END EM */
 
 /* Exported functions prototypes ---------------------------------------------*/

+ 1 - 1
Core/Inc/stm32f1xx_hal_conf.h

@@ -42,7 +42,7 @@
 /*#define HAL_CORTEX_MODULE_ENABLED   */
 /*#define HAL_CRC_MODULE_ENABLED   */
 /*#define HAL_DAC_MODULE_ENABLED   */
-/*#define HAL_DMA_MODULE_ENABLED   */
+#define HAL_DMA_MODULE_ENABLED
 /*#define HAL_ETH_MODULE_ENABLED   */
 /*#define HAL_FLASH_MODULE_ENABLED   */
 #define HAL_GPIO_MODULE_ENABLED

+ 1 - 0
Core/Inc/stm32f1xx_it.h

@@ -55,6 +55,7 @@ void SVC_Handler(void);
 void DebugMon_Handler(void);
 void PendSV_Handler(void);
 void SysTick_Handler(void);
+void DMA1_Channel5_IRQHandler(void);
 void TIM2_IRQHandler(void);
 void USART1_IRQHandler(void);
 void USART3_IRQHandler(void);

+ 55 - 0
Core/Src/dma.c

@@ -0,0 +1,55 @@
+/* USER CODE BEGIN Header */
+/**
+  ******************************************************************************
+  * @file    dma.c
+  * @brief   This file provides code for the configuration
+  *          of all the requested memory to memory DMA transfers.
+  ******************************************************************************
+  * @attention
+  *
+  * Copyright (c) 2023 STMicroelectronics.
+  * All rights reserved.
+  *
+  * This software is licensed under terms that can be found in the LICENSE file
+  * in the root directory of this software component.
+  * If no LICENSE file comes with this software, it is provided AS-IS.
+  *
+  ******************************************************************************
+  */
+/* USER CODE END Header */
+
+/* Includes ------------------------------------------------------------------*/
+#include "dma.h"
+
+/* USER CODE BEGIN 0 */
+
+/* USER CODE END 0 */
+
+/*----------------------------------------------------------------------------*/
+/* Configure DMA                                                              */
+/*----------------------------------------------------------------------------*/
+
+/* USER CODE BEGIN 1 */
+
+/* USER CODE END 1 */
+
+/**
+  * Enable DMA controller clock
+  */
+void MX_DMA_Init(void)
+{
+
+  /* DMA controller clock enable */
+  __HAL_RCC_DMA1_CLK_ENABLE();
+
+  /* DMA interrupt init */
+  /* DMA1_Channel5_IRQn interrupt configuration */
+  HAL_NVIC_SetPriority(DMA1_Channel5_IRQn, 0, 0);
+  HAL_NVIC_EnableIRQ(DMA1_Channel5_IRQn);
+
+}
+
+/* USER CODE BEGIN 2 */
+
+/* USER CODE END 2 */
+

+ 136 - 178
Core/Src/main.c

@@ -19,6 +19,7 @@
 /* Includes ------------------------------------------------------------------*/
 #include "main.h"
 #include "adc.h"
+#include "dma.h"
 #include "tim.h"
 #include "usart.h"
 #include "gpio.h"
@@ -38,8 +39,8 @@
 int fputc(int ch, FILE *f)
 {
     uint8_t temp[10] = {ch};
-    HAL_UART_Transmit(&huart1, temp,10, 50);
-    HAL_UART_Transmit(&huart3, temp,10, 50);
+    HAL_UART_Transmit(&huart1, temp,1, 2);
+    HAL_UART_Transmit(&huart3, temp,1, 2);
     return ch;
 }
 /* USER CODE END PD */
@@ -55,10 +56,14 @@ int fputc(int ch, FILE *f)
 uint8_t data_to_send[50];
 uint16_t CRC_value = 0;
 uint16_t initial_address = 0x00C1;
-uint32_t System_version  = 0x23051700;
+uint32_t System_version  = Version_sys;
 uint16_t BaudrateValue = 0x0000;
 uint16_t Adc2_CalibrationValue ;
 uint16_t Adc3_CalibrationValue ;
+
+uint8_t		Rx_Flag = 0;
+uint16_t	Rx_Len = 0;
+uint8_t		Rx_Buf[Rx_Max] = {0};	
 /* USER CODE END PV */
 
 /* Private function prototypes -----------------------------------------------*/
@@ -100,6 +105,7 @@ int main(void)
 
   /* Initialize all configured peripherals */
   MX_GPIO_Init();
+  MX_DMA_Init();
   MX_USART1_UART_Init();
   MX_ADC1_Init();
   MX_TIM2_Init();
@@ -110,323 +116,287 @@ int main(void)
   updatePbStatus(read_flash_16(ADDR_FLASH_PAGE_62));
   update_baudrate(read_flash_16(ADDR_FLASH_PAGE_63));
   AdcCalibration_init();
+	HAL_UART_Receive_DMA(&huart1, Rx_Buf, Rx_Max);  
+	__HAL_UART_ENABLE_IT(&huart1, UART_IT_IDLE); 
   /* USER CODE END 2 */
 
   /* Infinite loop */
   /* USER CODE BEGIN WHILE */
   while (1)
   {
-#if Modbus
-		if(flag == 1 && (calculate_crc(receive_buffer,6) == (receive_buffer[7] << 8 | receive_buffer[6]))) {	
-			
-			if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x01 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x01){
+		if(Rx_Flag == 1 && (calculate_crc(Rx_Buf,6) == (Rx_Buf[7] << 8 | Rx_Buf[6]))) {	
+			if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x01 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x01){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x02, 0x00, gpioaStatus, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 5);
 					data_to_send[5] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[6] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 7, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max); 
 			}
 
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x02 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x01){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x02 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x01){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x02, 0x00, gpiobStatus, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 5);
 					data_to_send[5] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[6] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 7, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}
 					
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x03 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x01){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x03 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x01){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x02, adc2_byte1, adc2_byte2, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 5);
 					data_to_send[5] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[6] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 7, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}
 					
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x04 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x01){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x04 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x01){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x02, adc3_byte1, adc3_byte2, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 5);
 					data_to_send[5] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[6] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 7, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}
 					
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x05 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x01){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x05 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x01){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x02, adc1_byte1, adc1_byte2, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 5);
 					data_to_send[5] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[6] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 7, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}
 			
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0xBB && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x02){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0xBB && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x02){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x04, (uint8_t)(System_version >> 24), (uint8_t)(System_version >> 16), (uint8_t)(System_version >> 8), (uint8_t)(System_version ), 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 7);
 					data_to_send[7] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[8] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 9, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}
 
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x01 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x02){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x01 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x02){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x04, 0x00, gpioaStatus, 0x00, gpiobStatus, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 7);
 					data_to_send[7] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[8] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 9, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}
 			
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x01 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x03){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x01 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x03){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x06, 0x00, gpioaStatus, 0x00, gpiobStatus, adc2_byte1, adc2_byte2, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 9);
 					data_to_send[9] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[10] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 11, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}
 
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x01 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x04){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x01 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x04){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x08, 0x00, gpioaStatus, 0x00, gpiobStatus, adc2_byte1, adc2_byte2, adc3_byte1, adc3_byte2, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 11);
 					data_to_send[11] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[12] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 13, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}
 					
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x01 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x05){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x01 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x05){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x08, 0x00, gpioaStatus, 0x00, gpiobStatus, adc2_byte1, adc2_byte2, adc3_byte1, adc3_byte2, adc1_byte1, adc1_byte2, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 13);
 					data_to_send[13] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[14] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 15, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}  
 			
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x02 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x02){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x02 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x02){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x04, 0x00, gpiobStatus, adc2_byte1, adc2_byte2, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 7);
 					data_to_send[7] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[8] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 9, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}  
 
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x02 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x03){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x02 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x03){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x06, 0x00, gpiobStatus, adc2_byte1, adc2_byte2, adc3_byte1, adc3_byte2, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 9);
 					data_to_send[9] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[10] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 11, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}  
 			
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x02 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x04){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x02 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x04){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x08, 0x00, gpiobStatus, adc2_byte1, adc2_byte2, adc3_byte1, adc3_byte2, adc1_byte1, adc1_byte2, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 11);
 					data_to_send[11] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[12] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 13, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}       
 					
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x03 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x02){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x03 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x02){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x04, adc2_byte1, adc2_byte2, adc3_byte1, adc3_byte2, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 7);
 					data_to_send[7] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[8] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 9, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}  
 			
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x03 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x03){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x03 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x03){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x06, adc2_byte1, adc2_byte2, adc3_byte1, adc3_byte2, adc1_byte1, adc1_byte1, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 9);
 					data_to_send[9] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[10] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 11, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			} 
 
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x04 && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x02){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x04 && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x02){
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x03, 0x04, adc3_byte1, adc3_byte2, adc1_byte1, adc1_byte1, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 7);
 					data_to_send[7] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[8] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 9, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}   
 			
-			else if((receive_buffer[0] == (uint8_t)initial_address || receive_buffer[0] == 0xFA) && receive_buffer[1] == 0x03 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0xAA && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x01){
+			else if((Rx_Buf[0] == (uint8_t)initial_address || Rx_Buf[0] == 0xFA) && Rx_Buf[1] == 0x03 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0xAA && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x01){
 					uint8_t data_to_send[] = {0xFA, 0x03, 0x02, 0x00, (uint8_t)initial_address, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 5);
 					data_to_send[5] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[6] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 7, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			} 
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x06 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x02 && receive_buffer[4] == 0x00){
-					updatePbStatus(receive_buffer[5]);
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x06 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x02 && Rx_Buf[4] == 0x00){
+					updatePbStatus(Rx_Buf[5]);
 					erase_flash(ADDR_FLASH_PAGE_62);
-					write_flash_PbStatus(receive_buffer);  // 写入Flash
-					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x06, 0x02, 0x00, receive_buffer[5], 0x00, 0x00};
+					write_flash_PbStatus(Rx_Buf);  // 写入Flash
+					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x06, 0x02, 0x00, Rx_Buf[5], 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 5);
 					data_to_send[5] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[6] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 7, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			} 
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x06 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x0A && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x01){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x06 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x0A && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x01){
 					erase_flash(ADDR_FLASH_PAGE_64);
 					write_flash_autoAdc(ADDR_FLASH_PAGE_64);
 					uint16_t now_calibrationValue = Adc2_CalibrationValue;
@@ -437,17 +407,15 @@ int main(void)
 					data_to_send[6] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 7, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}    
 					
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x06 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x0B && receive_buffer[4] == 0x00 && receive_buffer[5] == 0x01){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x06 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x0B && Rx_Buf[4] == 0x00 && Rx_Buf[5] == 0x01){
 					erase_flash(ADDR_FLASH_PAGE_65);
 					write_flash_autoAdc(ADDR_FLASH_PAGE_65);
 					uint16_t now_calibrationValue = Adc3_CalibrationValue;
@@ -458,77 +426,67 @@ int main(void)
 					data_to_send[6] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 7, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}   
 			
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x06 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0x0C && receive_buffer[4] == 0x00){
-					update_baudrate(receive_buffer[5]);
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x06 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0x0C && Rx_Buf[4] == 0x00){
+					update_baudrate(Rx_Buf[5]);
 					erase_flash(ADDR_FLASH_PAGE_63);
-					write_flash_Baudrate(receive_buffer);  // 写入Flash
-					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x06, 0x00, 0x0C, 0x00, receive_buffer[5], 0x00, 0x00};
+					write_flash_Baudrate(Rx_Buf);  // 写入Flash
+					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x06, 0x00, 0x0C, 0x00, Rx_Buf[5], 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 6);
 					data_to_send[6] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[7] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 8, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}  
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x06 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0xAA && receive_buffer[4] == 0x00){
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x06 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0xAA && Rx_Buf[4] == 0x00){
 					erase_flash(ADDR_FLASH_PAGE_61);
-					write_flash_address(receive_buffer);  // 写入Flash
+					write_flash_address(Rx_Buf);  // 写入Flash
 					uint8_t data_to_send[] = {(uint8_t)initial_address, 0x06, 0x02, 0x00, (uint8_t)initial_address, 0x00, 0x00};
 					uint16_t CRC_value = calculate_crc(data_to_send, 5);
 					data_to_send[5] = (uint8_t)(CRC_value & 0xFF);
 					data_to_send[6] = (uint8_t)(CRC_value >> 8);
 					HAL_StatusTypeDef status = HAL_UART_Transmit(&huart1, data_to_send, 7, 15);
 					if(status == HAL_OK) {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							flag = 0;
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+							Rx_Flag = 0;
 					} else {
-							memset(receive_buffer, 0, sizeof(receive_buffer)); 
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE);
-							__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE);
+							memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
 					}
-					HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+					HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}   
 
-			else if(receive_buffer[0] == (uint8_t)initial_address && receive_buffer[1] == 0x06 && receive_buffer[2] == 0x00 && receive_buffer[3] == 0xCC && receive_buffer[4] == 0xA5 && receive_buffer[5] == 0x5A){
-					flag = 0; // 将标志位重新置为0
-					memset(receive_buffer,0,sizeof(receive_buffer));
+			else if(Rx_Buf[0] == (uint8_t)initial_address && Rx_Buf[1] == 0x06 && Rx_Buf[2] == 0x00 && Rx_Buf[3] == 0xCC && Rx_Buf[4] == 0xA5 && Rx_Buf[5] == 0x5A){
+					Rx_Flag = 0; // 将标志位重新置为0
+					memset(Rx_Buf,0,sizeof(Rx_Buf));
 					HAL_NVIC_SystemReset();
 			}	
 			else {
-				memset(receive_buffer, 0, sizeof(receive_buffer)); 
-				__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE); // 清除接收溢出标志位
-				__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE); // 清除接收中断标志位
-				HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
+				memset(Rx_Buf, 0, sizeof(Rx_Buf)); 
+				HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
 			}
 			
     }
 		gpioaStatus = GetPaInputStatus();
     gpiobStatus = GetPbOutputStatus();
     GetADCResults(&hadc1);
-		__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE); // 清除接收溢出标志位
-		__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE); // 清除接收中断标志位
 		HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_SET);
 		HAL_Delay(1);  
 		HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET);
-		HAL_UART_Receive_IT(&huart1, &receive_buffer[0], 8);
-		#endif
+		HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);
+
     /* USER CODE END WHILE */
 
     /* USER CODE BEGIN 3 */

+ 36 - 21
Core/Src/stm32f1xx_it.c

@@ -63,6 +63,7 @@ uint8_t gpiobStatus = 0;
 
 /* External variables --------------------------------------------------------*/
 extern TIM_HandleTypeDef htim2;
+extern DMA_HandleTypeDef hdma_usart1_rx;
 extern UART_HandleTypeDef huart1;
 extern UART_HandleTypeDef huart3;
 /* USER CODE BEGIN EV */
@@ -207,6 +208,20 @@ void SysTick_Handler(void)
 /* please refer to the startup file (startup_stm32f1xx.s).                    */
 /******************************************************************************/
 
+/**
+  * @brief This function handles DMA1 channel5 global interrupt.
+  */
+void DMA1_Channel5_IRQHandler(void)
+{
+  /* USER CODE BEGIN DMA1_Channel5_IRQn 0 */
+
+  /* USER CODE END DMA1_Channel5_IRQn 0 */
+  HAL_DMA_IRQHandler(&hdma_usart1_rx);
+  /* USER CODE BEGIN DMA1_Channel5_IRQn 1 */
+
+  /* USER CODE END DMA1_Channel5_IRQn 1 */
+}
+
 /**
   * @brief This function handles TIM2 global interrupt.
   */
@@ -228,30 +243,30 @@ void TIM2_IRQHandler(void)
 void USART1_IRQHandler(void)
 {
   /* USER CODE BEGIN USART1_IRQn 0 */
-		static uint8_t index = 0; // 用于记录存储到数组中的位置
-    HAL_UART_Receive(&huart1, &receive_buffer[index], 1, 1); // 读取接收到的数据
-    if (index < 8) // 如果还没有接收到全部数据
-    {
-        index++; // 将记录位置的变量加1
-    }
-    if (index == 8) // 如果已经接收到了全部数据
-    {
-        index = 0; // 将记录位置的变量重新置为0
-        flag = 1; // 将标志位置为1
-    }
+
+	uint32_t temp;
+	if((__HAL_UART_GET_FLAG(&huart1,UART_FLAG_IDLE) != RESET))  
+	{   
+		/*清除状态寄存器和串口数据寄存器*/
+		__HAL_UART_CLEAR_IDLEFLAG(&huart1); 
+
+		/*失能DMA接收*/
+		HAL_UART_DMAStop(&huart1);  
+
+		/*读取接收长度,总大小-剩余大小*/
+		temp = huart1.hdmarx->Instance->CNDTR; 
+		Rx_Len = Rx_Max - temp; 
+
+		/*接收标志位置1*/
+		Rx_Flag=1;  
+
+		/*使能接收DMA接收*/
+		HAL_UART_Receive_DMA(&huart1,Rx_Buf,Rx_Max);  
+	}
   /* USER CODE END USART1_IRQn 0 */
   HAL_UART_IRQHandler(&huart1);
   /* USER CODE BEGIN USART1_IRQn 1 */
-    if (__HAL_UART_GET_FLAG(&huart1, UART_FLAG_ORE) == SET) // 如果发生了接收溢出
-    {
-        __HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_RXNE); // 清除接收中断标志位
-        __HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_ORE); // 清除接收溢出标志位
-				memset(receive_buffer,0,sizeof(receive_buffer));
-        index = 0; // 重新开始接收数据
-			
-			  read_new_address_from_flash(ADDR_FLASH_PAGE_61); 
-        HAL_UART_Receive_IT(&huart1, receive_buffer, 1); // 重新开启串口接收中断
-    }
+
 
   /* USER CODE END USART1_IRQn 1 */
 }

+ 21 - 0
Core/Src/usart.c

@@ -26,6 +26,7 @@
 
 UART_HandleTypeDef huart1;
 UART_HandleTypeDef huart3;
+DMA_HandleTypeDef hdma_usart1_rx;
 
 /* USART1 init function */
 
@@ -114,6 +115,23 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
     GPIO_InitStruct.Pull = GPIO_NOPULL;
     HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
+    /* USART1 DMA Init */
+    /* USART1_RX Init */
+    hdma_usart1_rx.Instance = DMA1_Channel5;
+    hdma_usart1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
+    hdma_usart1_rx.Init.PeriphInc = DMA_PINC_DISABLE;
+    hdma_usart1_rx.Init.MemInc = DMA_MINC_ENABLE;
+    hdma_usart1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
+    hdma_usart1_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
+    hdma_usart1_rx.Init.Mode = DMA_NORMAL;
+    hdma_usart1_rx.Init.Priority = DMA_PRIORITY_LOW;
+    if (HAL_DMA_Init(&hdma_usart1_rx) != HAL_OK)
+    {
+      Error_Handler();
+    }
+
+    __HAL_LINKDMA(uartHandle,hdmarx,hdma_usart1_rx);
+
     /* USART1 interrupt Init */
     HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
     HAL_NVIC_EnableIRQ(USART1_IRQn);
@@ -170,6 +188,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
     */
     HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
 
+    /* USART1 DMA DeInit */
+    HAL_DMA_DeInit(uartHandle->hdmarx);
+
     /* USART1 interrupt Deinit */
     HAL_NVIC_DisableIRQ(USART1_IRQn);
   /* USER CODE BEGIN USART1_MspDeInit 1 */

+ 0 - 36
MDK-ARM/DebugConfig/iocollect_STM32F103RE_1.0.0.dbgconf

@@ -1,36 +0,0 @@
-// File: STM32F101_102_103_105_107.dbgconf
-// Version: 1.0.0
-// Note: refer to STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx Reference manual (RM0008)
-//                STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx datasheets
-
-// <<< Use Configuration Wizard in Context Menu >>>
-
-// <h> Debug MCU configuration register (DBGMCU_CR)
-//                                   <i> Reserved bits must be kept at reset value
-//   <o.30> DBG_TIM11_STOP           <i> TIM11 counter stopped when core is halted
-//   <o.29> DBG_TIM10_STOP           <i> TIM10 counter stopped when core is halted
-//   <o.28> DBG_TIM9_STOP            <i> TIM9 counter stopped when core is halted
-//   <o.27> DBG_TIM14_STOP           <i> TIM14 counter stopped when core is halted
-//   <o.26> DBG_TIM13_STOP           <i> TIM13 counter stopped when core is halted
-//   <o.25> DBG_TIM12_STOP           <i> TIM12 counter stopped when core is halted
-//   <o.21> DBG_CAN2_STOP            <i> Debug CAN2 stopped when core is halted
-//   <o.20> DBG_TIM7_STOP            <i> TIM7 counter stopped when core is halted
-//   <o.19> DBG_TIM6_STOP            <i> TIM6 counter stopped when core is halted
-//   <o.18> DBG_TIM5_STOP            <i> TIM5 counter stopped when core is halted
-//   <o.17> DBG_TIM8_STOP            <i> TIM8 counter stopped when core is halted
-//   <o.16> DBG_I2C2_SMBUS_TIMEOUT   <i> SMBUS timeout mode stopped when core is halted
-//   <o.15> DBG_I2C1_SMBUS_TIMEOUT   <i> SMBUS timeout mode stopped when core is halted
-//   <o.14> DBG_CAN1_STOP            <i> Debug CAN1 stopped when Core is halted
-//   <o.13> DBG_TIM4_STOP            <i> TIM4 counter stopped when core is halted
-//   <o.12> DBG_TIM3_STOP            <i> TIM3 counter stopped when core is halted
-//   <o.11> DBG_TIM2_STOP            <i> TIM2 counter stopped when core is halted
-//   <o.10> DBG_TIM1_STOP            <i> TIM1 counter stopped when core is halted
-//   <o.9>  DBG_WWDG_STOP            <i> Debug window watchdog stopped when core is halted
-//   <o.8>  DBG_IWDG_STOP            <i> Debug independent watchdog stopped when core is halted
-//   <o.2>  DBG_STANDBY              <i> Debug standby mode
-//   <o.1>  DBG_STOP                 <i> Debug stop mode
-//   <o.0>  DBG_SLEEP                <i> Debug sleep mode
-// </h>
-DbgMCU_CR = 0x00000007;
-
-// <<< end of configuration section >>>

+ 64 - 20
MDK-ARM/iocollect.uvoptx

@@ -157,6 +157,38 @@
         <Bp>
           <Number>0</Number>
           <Type>0</Type>
+          <LineNumber>135</LineNumber>
+          <EnabledFlag>1</EnabledFlag>
+          <Address>0</Address>
+          <ByteObject>0</ByteObject>
+          <HtxType>0</HtxType>
+          <ManyObjects>0</ManyObjects>
+          <SizeOfObject>0</SizeOfObject>
+          <BreakByAccess>0</BreakByAccess>
+          <BreakIfRCount>0</BreakIfRCount>
+          <Filename>../Core/Src/main.c</Filename>
+          <ExecCommand></ExecCommand>
+          <Expression></Expression>
+        </Bp>
+        <Bp>
+          <Number>1</Number>
+          <Type>0</Type>
+          <LineNumber>155</LineNumber>
+          <EnabledFlag>1</EnabledFlag>
+          <Address>0</Address>
+          <ByteObject>0</ByteObject>
+          <HtxType>0</HtxType>
+          <ManyObjects>0</ManyObjects>
+          <SizeOfObject>0</SizeOfObject>
+          <BreakByAccess>0</BreakByAccess>
+          <BreakIfRCount>0</BreakIfRCount>
+          <Filename>../Core/Src/main.c</Filename>
+          <ExecCommand></ExecCommand>
+          <Expression></Expression>
+        </Bp>
+        <Bp>
+          <Number>2</Number>
+          <Type>0</Type>
           <LineNumber>153</LineNumber>
           <EnabledFlag>1</EnabledFlag>
           <Address>0</Address>
@@ -381,6 +413,18 @@
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
+      <PathWithFileName>../Core/Src/dma.c</PathWithFileName>
+      <FilenameWithoutPath>dma.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>2</GroupNumber>
+      <FileNumber>6</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
       <PathWithFileName>../Core/Src/tim.c</PathWithFileName>
       <FilenameWithoutPath>tim.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
@@ -388,7 +432,7 @@
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
-      <FileNumber>6</FileNumber>
+      <FileNumber>7</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -400,7 +444,7 @@
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
-      <FileNumber>7</FileNumber>
+      <FileNumber>8</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -412,7 +456,7 @@
     </File>
     <File>
       <GroupNumber>2</GroupNumber>
-      <FileNumber>8</FileNumber>
+      <FileNumber>9</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -432,7 +476,7 @@
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>9</FileNumber>
+      <FileNumber>10</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -444,7 +488,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>10</FileNumber>
+      <FileNumber>11</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -456,7 +500,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>11</FileNumber>
+      <FileNumber>12</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -468,7 +512,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>12</FileNumber>
+      <FileNumber>13</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -480,7 +524,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>13</FileNumber>
+      <FileNumber>14</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -492,7 +536,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>14</FileNumber>
+      <FileNumber>15</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -504,7 +548,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>15</FileNumber>
+      <FileNumber>16</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -516,7 +560,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>16</FileNumber>
+      <FileNumber>17</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -528,7 +572,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>17</FileNumber>
+      <FileNumber>18</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -540,7 +584,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>18</FileNumber>
+      <FileNumber>19</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -552,7 +596,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>19</FileNumber>
+      <FileNumber>20</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -564,7 +608,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>20</FileNumber>
+      <FileNumber>21</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -576,7 +620,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>21</FileNumber>
+      <FileNumber>22</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -588,7 +632,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>22</FileNumber>
+      <FileNumber>23</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -600,7 +644,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>23</FileNumber>
+      <FileNumber>24</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -612,7 +656,7 @@
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>24</FileNumber>
+      <FileNumber>25</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
@@ -632,7 +676,7 @@
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>4</GroupNumber>
-      <FileNumber>25</FileNumber>
+      <FileNumber>26</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>

+ 56 - 0
MDK-ARM/iocollect.uvprojx

@@ -460,6 +460,62 @@
                 </FileArmAds>
               </FileOption>
             </File>
+            <File>
+              <FileName>dma.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../Core/Src/dma.c</FilePath>
+              <FileOption>
+                <CommonProperty>
+                  <UseCPPCompiler>2</UseCPPCompiler>
+                  <RVCTCodeConst>0</RVCTCodeConst>
+                  <RVCTZI>0</RVCTZI>
+                  <RVCTOtherData>0</RVCTOtherData>
+                  <ModuleSelection>0</ModuleSelection>
+                  <IncludeInBuild>1</IncludeInBuild>
+                  <AlwaysBuild>2</AlwaysBuild>
+                  <GenerateAssemblyFile>2</GenerateAssemblyFile>
+                  <AssembleAssemblyFile>2</AssembleAssemblyFile>
+                  <PublicsOnly>2</PublicsOnly>
+                  <StopOnExitCode>11</StopOnExitCode>
+                  <CustomArgument></CustomArgument>
+                  <IncludeLibraryModules></IncludeLibraryModules>
+                  <ComprImg>1</ComprImg>
+                </CommonProperty>
+                <FileArmAds>
+                  <Cads>
+                    <interw>2</interw>
+                    <Optim>0</Optim>
+                    <oTime>2</oTime>
+                    <SplitLS>2</SplitLS>
+                    <OneElfS>2</OneElfS>
+                    <Strict>2</Strict>
+                    <EnumInt>2</EnumInt>
+                    <PlainCh>2</PlainCh>
+                    <Ropi>2</Ropi>
+                    <Rwpi>2</Rwpi>
+                    <wLevel>0</wLevel>
+                    <uThumb>2</uThumb>
+                    <uSurpInc>2</uSurpInc>
+                    <uC99>2</uC99>
+                    <uGnu>2</uGnu>
+                    <useXO>2</useXO>
+                    <v6Lang>0</v6Lang>
+                    <v6LangP>0</v6LangP>
+                    <vShortEn>2</vShortEn>
+                    <vShortWch>2</vShortWch>
+                    <v6Lto>2</v6Lto>
+                    <v6WtE>2</v6WtE>
+                    <v6Rtti>2</v6Rtti>
+                    <VariousControls>
+                      <MiscControls></MiscControls>
+                      <Define></Define>
+                      <Undefine></Undefine>
+                      <IncludePath></IncludePath>
+                    </VariousControls>
+                  </Cads>
+                </FileArmAds>
+              </FileOption>
+            </File>
             <File>
               <FileName>tim.c</FileName>
               <FileType>1</FileType>

+ 21 - 8
iocollect.ioc

@@ -17,19 +17,31 @@ ADC1.master=1
 CAD.formats=
 CAD.pinconfig=
 CAD.provider=
+Dma.Request0=USART1_RX
+Dma.RequestsNb=1
+Dma.USART1_RX.0.Direction=DMA_PERIPH_TO_MEMORY
+Dma.USART1_RX.0.Instance=DMA1_Channel5
+Dma.USART1_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
+Dma.USART1_RX.0.MemInc=DMA_MINC_ENABLE
+Dma.USART1_RX.0.Mode=DMA_NORMAL
+Dma.USART1_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
+Dma.USART1_RX.0.PeriphInc=DMA_PINC_DISABLE
+Dma.USART1_RX.0.Priority=DMA_PRIORITY_LOW
+Dma.USART1_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
 File.Version=6
 GPIO.groupedBy=Group By Peripherals
 KeepUserPlacement=true
 Mcu.CPN=STM32F103RET6
 Mcu.Family=STM32F1
 Mcu.IP0=ADC1
-Mcu.IP1=NVIC
-Mcu.IP2=RCC
-Mcu.IP3=SYS
-Mcu.IP4=TIM2
-Mcu.IP5=USART1
-Mcu.IP6=USART3
-Mcu.IPNb=7
+Mcu.IP1=DMA
+Mcu.IP2=NVIC
+Mcu.IP3=RCC
+Mcu.IP4=SYS
+Mcu.IP5=TIM2
+Mcu.IP6=USART1
+Mcu.IP7=USART3
+Mcu.IPNb=8
 Mcu.Name=STM32F103R(C-D-E)Tx
 Mcu.Package=LQFP64
 Mcu.Pin0=PD0-OSC_IN
@@ -66,6 +78,7 @@ Mcu.UserName=STM32F103RETx
 MxCube.Version=6.8.1
 MxDb.Version=DB.6.0.81
 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
+NVIC.DMA1_Channel5_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
 NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
 NVIC.ForceEnableDMAVector=true
 NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
@@ -155,7 +168,7 @@ ProjectManager.StackSize=0x400
 ProjectManager.TargetToolchain=MDK-ARM V5.32
 ProjectManager.ToolChainLocation=
 ProjectManager.UnderRoot=false
-ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_TIM2_Init-TIM2-false-HAL-true,6-MX_USART3_UART_Init-USART3-false-HAL-true,7-MX_TIM3_Init-TIM3-false-HAL-true
+ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_ADC1_Init-ADC1-false-HAL-true,6-MX_TIM2_Init-TIM2-false-HAL-true,7-MX_USART3_UART_Init-USART3-false-HAL-true
 RCC.ADCFreqValue=12000000
 RCC.ADCPresc=RCC_ADCPCLK2_DIV6
 RCC.AHBFreq_Value=72000000

+ 0 - 4
readme.md

@@ -18,9 +18,5 @@
 > #####Add View Device Address; 
 > #####Software modification baud rate; 
 
----
-**Functional improvements**
-> ######<u>Updated on 2023/5/17 15:41:37 </u>
-> #####Increase the stable response time for sending and receiving to 35ms