From d8d1a3bf69f520f44bf6301d312563e85342c2a2 Mon Sep 17 00:00:00 2001 From: wangxujie Date: Tue, 25 Feb 2025 15:44:03 +0800 Subject: [PATCH] =?UTF-8?q?EC11=E6=97=8B=E8=BD=AC=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E5=99=A8=E5=A4=96=E9=83=A8=E4=B8=AD=E6=96=AD=E5=BC=95=E8=84=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Inc/main.h | 32 ++-- Core/Inc/stm32f4xx_it.h | 1 + Core/Src/freertos.c | 2 +- Core/Src/gpio.c | 9 + Core/Src/main.c | 60 +++---- Core/Src/stm32f4xx_it.c | 14 ++ Core/Src/usart.c | 174 ++++++++++--------- MDK-ARM/semi-finished_product_testing.uvoptx | 5 + semi-finished_product_testing.ioc | 112 ++++++------ 9 files changed, 228 insertions(+), 181 deletions(-) diff --git a/Core/Inc/main.h b/Core/Inc/main.h index 6e752a4..05b7a9d 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -23,8 +23,7 @@ #define __MAIN_H #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif /* Includes ------------------------------------------------------------------*/ @@ -37,10 +36,10 @@ extern "C" #include "tcpserverc.h" #include "leds.h" #include - /* USER CODE END Includes */ +/* USER CODE END Includes */ - /* Exported types ------------------------------------------------------------*/ - /* USER CODE BEGIN ET */ +/* Exported types ------------------------------------------------------------*/ +/* USER CODE BEGIN ET */ extern uint8_t tcp_echo_flags_hart1; extern uint8_t tcp_echo_flags_hart2; extern uint8_t tcp_echo_flags_ble1; @@ -74,20 +73,20 @@ extern "C" #define LOCAL_PORT 5001 - /* USER CODE END ET */ +/* USER CODE END ET */ - /* Exported constants --------------------------------------------------------*/ - /* USER CODE BEGIN EC */ +/* Exported constants --------------------------------------------------------*/ +/* USER CODE BEGIN EC */ - /* USER CODE END EC */ +/* USER CODE END EC */ - /* Exported macro ------------------------------------------------------------*/ - /* USER CODE BEGIN EM */ +/* Exported macro ------------------------------------------------------------*/ +/* USER CODE BEGIN EM */ - /* USER CODE END EM */ +/* USER CODE END EM */ - /* Exported functions prototypes ---------------------------------------------*/ - void Error_Handler(void); +/* Exported functions prototypes ---------------------------------------------*/ +void Error_Handler(void); /* USER CODE BEGIN EFP */ @@ -106,6 +105,9 @@ extern "C" #define LED3_G_GPIO_Port GPIOB #define LED3_Y_Pin GPIO_PIN_7 #define LED3_Y_GPIO_Port GPIOE +#define EC11_KEY_Pin GPIO_PIN_8 +#define EC11_KEY_GPIO_Port GPIOE +#define EC11_KEY_EXTI_IRQn EXTI9_5_IRQn #define EC11_A_Pin GPIO_PIN_9 #define EC11_A_GPIO_Port GPIOE #define EC11_B_Pin GPIO_PIN_11 @@ -186,7 +188,7 @@ extern "C" /* USER CODE BEGIN Private defines */ #define TRUE 0 #define FAIL -1 - /* USER CODE END Private defines */ +/* USER CODE END Private defines */ #ifdef __cplusplus } diff --git a/Core/Inc/stm32f4xx_it.h b/Core/Inc/stm32f4xx_it.h index c90e3ed..8573ed5 100644 --- a/Core/Inc/stm32f4xx_it.h +++ b/Core/Inc/stm32f4xx_it.h @@ -61,6 +61,7 @@ void DMA1_Stream3_IRQHandler(void); void DMA1_Stream4_IRQHandler(void); void DMA1_Stream5_IRQHandler(void); void DMA1_Stream6_IRQHandler(void); +void EXTI9_5_IRQHandler(void); void TIM3_IRQHandler(void); void TIM4_IRQHandler(void); void USART1_IRQHandler(void); diff --git a/Core/Src/freertos.c b/Core/Src/freertos.c index 9f18324..587a117 100644 --- a/Core/Src/freertos.c +++ b/Core/Src/freertos.c @@ -270,7 +270,7 @@ void start_gpio_di_do_task(void const *argument) uint8_t tx_data_len = 7 + DI_MAX; uint8_t tx_data[32] = {0}; tx_data[0] = FRAME_HEAD; // 帧头 - tx_data[1] = COM_OK; // 状态 + tx_data[1] = COM_OK; // 状态码 tx_data[2] = DEVICE_NUM; // 设备号 tx_data[3] = SEND_STATE_CMD; // 命令号 tx_data[4] = DI_MAX; // 数据长度 diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index 7501cf4..732d13e 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -99,6 +99,12 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM; HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); + /*Configure GPIO pin : PtPin */ + GPIO_InitStruct.Pin = EC11_KEY_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; + GPIO_InitStruct.Pull = GPIO_PULLUP; + HAL_GPIO_Init(EC11_KEY_GPIO_Port, &GPIO_InitStruct); + /*Configure GPIO pins : PDPin PDPin PDPin PDPin */ GPIO_InitStruct.Pin = DO_CH4_Pin|DO_CH3_Pin|DO_CH1_Pin|DO_CH2_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; @@ -166,6 +172,9 @@ void MX_GPIO_Init(void) HAL_NVIC_SetPriority(EXTI3_IRQn, 5, 0); HAL_NVIC_EnableIRQ(EXTI3_IRQn); + HAL_NVIC_SetPriority(EXTI9_5_IRQn, 5, 0); + HAL_NVIC_EnableIRQ(EXTI9_5_IRQn); + } /* USER CODE BEGIN 2 */ diff --git a/Core/Src/main.c b/Core/Src/main.c index fbf6be8..c8df600 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -82,9 +82,9 @@ uint8_t send_data_flag_cmd = 0; /* USER CODE END 0 */ /** - * @brief The application entry point. - * @retval int - */ + * @brief The application entry point. + * @retval int + */ int main(void) { /* USER CODE BEGIN 1 */ @@ -152,22 +152,22 @@ int main(void) } /** - * @brief System Clock Configuration - * @retval None - */ + * @brief System Clock Configuration + * @retval None + */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; /** Configure the main internal regulator output voltage - */ + */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); /** Initializes the RCC Oscillators according to the specified parameters - * in the RCC_OscInitTypeDef structure. - */ + * in the RCC_OscInitTypeDef structure. + */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; @@ -182,8 +182,9 @@ void SystemClock_Config(void) } /** Initializes the CPU, AHB and APB buses clocks - */ - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK + |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; @@ -282,20 +283,19 @@ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) /* USER CODE END 4 */ /** - * @brief Period elapsed callback in non blocking mode - * @note This function is called when TIM4 interrupt took place, inside - * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment - * a global variable "uwTick" used as application time base. - * @param htim : TIM handle - * @retval None - */ + * @brief Period elapsed callback in non blocking mode + * @note This function is called when TIM4 interrupt took place, inside + * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment + * a global variable "uwTick" used as application time base. + * @param htim : TIM handle + * @retval None + */ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { /* USER CODE BEGIN Callback 0 */ /* USER CODE END Callback 0 */ - if (htim->Instance == TIM4) - { + if (htim->Instance == TIM4) { HAL_IncTick(); } /* USER CODE BEGIN Callback 1 */ @@ -304,9 +304,9 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) } /** - * @brief This function is executed in case of error occurrence. - * @retval None - */ + * @brief This function is executed in case of error occurrence. + * @retval None + */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ @@ -318,14 +318,14 @@ void Error_Handler(void) /* USER CODE END Error_Handler_Debug */ } -#ifdef USE_FULL_ASSERT +#ifdef USE_FULL_ASSERT /** - * @brief Reports the name of the source file and the source line number - * where the assert_param error has occurred. - * @param file: pointer to the source file name - * @param line: assert_param error line source number - * @retval None - */ + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ diff --git a/Core/Src/stm32f4xx_it.c b/Core/Src/stm32f4xx_it.c index b553e80..2dec5fa 100644 --- a/Core/Src/stm32f4xx_it.c +++ b/Core/Src/stm32f4xx_it.c @@ -311,6 +311,20 @@ void DMA1_Stream6_IRQHandler(void) /* USER CODE END DMA1_Stream6_IRQn 1 */ } +/** + * @brief This function handles EXTI line[9:5] interrupts. + */ +void EXTI9_5_IRQHandler(void) +{ + /* USER CODE BEGIN EXTI9_5_IRQn 0 */ + + /* USER CODE END EXTI9_5_IRQn 0 */ + HAL_GPIO_EXTI_IRQHandler(EC11_KEY_Pin); + /* USER CODE BEGIN EXTI9_5_IRQn 1 */ + + /* USER CODE END EXTI9_5_IRQn 1 */ +} + /** * @brief This function handles TIM3 global interrupt. */ diff --git a/Core/Src/usart.c b/Core/Src/usart.c index 044544c..23110d6 100644 --- a/Core/Src/usart.c +++ b/Core/Src/usart.c @@ -68,6 +68,7 @@ void MX_UART4_Init(void) /* USER CODE BEGIN UART4_Init 2 */ //__HAL_UART_ENABLE_IT(&huart4, UART_IT_IDLE); // 使能IDLE中断 /* USER CODE END UART4_Init 2 */ + } /* UART5 init function */ void MX_UART5_Init(void) @@ -96,6 +97,7 @@ void MX_UART5_Init(void) // __HAL_UART_ENABLE_IT(&huart5, UART_IT_RXNE); // 接收中断 // __HAL_UART_ENABLE_IT(&huart5, UART_IT_IDLE); // 空闲中断 /* USER CODE END UART5_Init 2 */ + } /* USART1 init function */ @@ -124,6 +126,7 @@ void MX_USART1_UART_Init(void) /* USER CODE BEGIN USART1_Init 2 */ /* USER CODE END USART1_Init 2 */ + } /* USART2 init function */ @@ -153,6 +156,7 @@ void MX_USART2_UART_Init(void) // __HAL_UART_ENABLE_IT(&huart2, UART_IT_RXNE); // 接收中断 // __HAL_UART_ENABLE_IT(&huart2, UART_IT_IDLE); // 使能IDLE中断 /* USER CODE END USART2_Init 2 */ + } /* USART3 init function */ @@ -181,6 +185,7 @@ void MX_USART3_UART_Init(void) /* USER CODE BEGIN USART3_Init 2 */ /* USER CODE END USART3_Init 2 */ + } /* USART6 init function */ @@ -209,17 +214,18 @@ void MX_USART6_UART_Init(void) /* USER CODE BEGIN USART6_Init 2 */ /* USER CODE END USART6_Init 2 */ + } -void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) +void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) { GPIO_InitTypeDef GPIO_InitStruct = {0}; - if (uartHandle->Instance == UART4) + if(uartHandle->Instance==UART4) { - /* USER CODE BEGIN UART4_MspInit 0 */ + /* USER CODE BEGIN UART4_MspInit 0 */ - /* USER CODE END UART4_MspInit 0 */ + /* USER CODE END UART4_MspInit 0 */ /* UART4 clock enable */ __HAL_RCC_UART4_CLK_ENABLE(); @@ -228,7 +234,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) PC10 ------> UART4_TX PC11 ------> UART4_RX */ - GPIO_InitStruct.Pin = LCD_TX_Pin | LCD_RX_Pin; + GPIO_InitStruct.Pin = LCD_TX_Pin|LCD_RX_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; @@ -252,7 +258,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmarx, hdma_uart4_rx); + __HAL_LINKDMA(uartHandle,hdmarx,hdma_uart4_rx); /* UART4_TX Init */ hdma_uart4_tx.Instance = DMA1_Stream4; @@ -270,20 +276,20 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmatx, hdma_uart4_tx); + __HAL_LINKDMA(uartHandle,hdmatx,hdma_uart4_tx); /* UART4 interrupt Init */ HAL_NVIC_SetPriority(UART4_IRQn, 5, 0); HAL_NVIC_EnableIRQ(UART4_IRQn); - /* USER CODE BEGIN UART4_MspInit 1 */ + /* USER CODE BEGIN UART4_MspInit 1 */ - /* USER CODE END UART4_MspInit 1 */ + /* USER CODE END UART4_MspInit 1 */ } - else if (uartHandle->Instance == UART5) + else if(uartHandle->Instance==UART5) { - /* USER CODE BEGIN UART5_MspInit 0 */ + /* USER CODE BEGIN UART5_MspInit 0 */ - /* USER CODE END UART5_MspInit 0 */ + /* USER CODE END UART5_MspInit 0 */ /* UART5 clock enable */ __HAL_RCC_UART5_CLK_ENABLE(); @@ -324,7 +330,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmatx, hdma_uart5_tx); + __HAL_LINKDMA(uartHandle,hdmatx,hdma_uart5_tx); /* UART5_RX Init */ hdma_uart5_rx.Instance = DMA1_Stream0; @@ -342,20 +348,20 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmarx, hdma_uart5_rx); + __HAL_LINKDMA(uartHandle,hdmarx,hdma_uart5_rx); /* UART5 interrupt Init */ HAL_NVIC_SetPriority(UART5_IRQn, 5, 0); HAL_NVIC_EnableIRQ(UART5_IRQn); - /* USER CODE BEGIN UART5_MspInit 1 */ + /* USER CODE BEGIN UART5_MspInit 1 */ - /* USER CODE END UART5_MspInit 1 */ + /* USER CODE END UART5_MspInit 1 */ } - else if (uartHandle->Instance == USART1) + else if(uartHandle->Instance==USART1) { - /* USER CODE BEGIN USART1_MspInit 0 */ + /* USER CODE BEGIN USART1_MspInit 0 */ - /* USER CODE END USART1_MspInit 0 */ + /* USER CODE END USART1_MspInit 0 */ /* USART1 clock enable */ __HAL_RCC_USART1_CLK_ENABLE(); @@ -364,7 +370,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) PA9 ------> USART1_TX PA10 ------> USART1_RX */ - GPIO_InitStruct.Pin = USB_TX_Pin | USB_RX_Pin; + GPIO_InitStruct.Pin = USB_TX_Pin|USB_RX_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; @@ -388,7 +394,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmarx, hdma_usart1_rx); + __HAL_LINKDMA(uartHandle,hdmarx,hdma_usart1_rx); /* USART1_TX Init */ hdma_usart1_tx.Instance = DMA2_Stream7; @@ -406,20 +412,20 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmatx, hdma_usart1_tx); + __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart1_tx); /* USART1 interrupt Init */ HAL_NVIC_SetPriority(USART1_IRQn, 5, 0); HAL_NVIC_EnableIRQ(USART1_IRQn); - /* USER CODE BEGIN USART1_MspInit 1 */ + /* USER CODE BEGIN USART1_MspInit 1 */ - /* USER CODE END USART1_MspInit 1 */ + /* USER CODE END USART1_MspInit 1 */ } - else if (uartHandle->Instance == USART2) + else if(uartHandle->Instance==USART2) { - /* USER CODE BEGIN USART2_MspInit 0 */ + /* USER CODE BEGIN USART2_MspInit 0 */ - /* USER CODE END USART2_MspInit 0 */ + /* USER CODE END USART2_MspInit 0 */ /* USART2 clock enable */ __HAL_RCC_USART2_CLK_ENABLE(); @@ -428,7 +434,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) PD5 ------> USART2_TX PD6 ------> USART2_RX */ - GPIO_InitStruct.Pin = HART2_TX_Pin | HART2_RX_Pin; + GPIO_InitStruct.Pin = HART2_TX_Pin|HART2_RX_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; @@ -452,7 +458,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmarx, hdma_usart2_rx); + __HAL_LINKDMA(uartHandle,hdmarx,hdma_usart2_rx); /* USART2_TX Init */ hdma_usart2_tx.Instance = DMA1_Stream6; @@ -470,20 +476,20 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmatx, hdma_usart2_tx); + __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart2_tx); /* USART2 interrupt Init */ HAL_NVIC_SetPriority(USART2_IRQn, 5, 0); HAL_NVIC_EnableIRQ(USART2_IRQn); - /* USER CODE BEGIN USART2_MspInit 1 */ + /* USER CODE BEGIN USART2_MspInit 1 */ - /* USER CODE END USART2_MspInit 1 */ + /* USER CODE END USART2_MspInit 1 */ } - else if (uartHandle->Instance == USART3) + else if(uartHandle->Instance==USART3) { - /* USER CODE BEGIN USART3_MspInit 0 */ + /* USER CODE BEGIN USART3_MspInit 0 */ - /* USER CODE END USART3_MspInit 0 */ + /* USER CODE END USART3_MspInit 0 */ /* USART3 clock enable */ __HAL_RCC_USART3_CLK_ENABLE(); @@ -492,7 +498,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) PD8 ------> USART3_TX PD9 ------> USART3_RX */ - GPIO_InitStruct.Pin = BLE2_TX_Pin | BLE2_RX_Pin; + GPIO_InitStruct.Pin = BLE2_TX_Pin|BLE2_RX_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; @@ -516,7 +522,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmarx, hdma_usart3_rx); + __HAL_LINKDMA(uartHandle,hdmarx,hdma_usart3_rx); /* USART3_TX Init */ hdma_usart3_tx.Instance = DMA1_Stream3; @@ -534,20 +540,20 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmatx, hdma_usart3_tx); + __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart3_tx); /* USART3 interrupt Init */ HAL_NVIC_SetPriority(USART3_IRQn, 5, 0); HAL_NVIC_EnableIRQ(USART3_IRQn); - /* USER CODE BEGIN USART3_MspInit 1 */ + /* USER CODE BEGIN USART3_MspInit 1 */ - /* USER CODE END USART3_MspInit 1 */ + /* USER CODE END USART3_MspInit 1 */ } - else if (uartHandle->Instance == USART6) + else if(uartHandle->Instance==USART6) { - /* USER CODE BEGIN USART6_MspInit 0 */ + /* USER CODE BEGIN USART6_MspInit 0 */ - /* USER CODE END USART6_MspInit 0 */ + /* USER CODE END USART6_MspInit 0 */ /* USART6 clock enable */ __HAL_RCC_USART6_CLK_ENABLE(); @@ -556,7 +562,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) PC6 ------> USART6_TX PC7 ------> USART6_RX */ - GPIO_InitStruct.Pin = BLE1_TX_Pin | BLE1_RX_Pin; + GPIO_InitStruct.Pin = BLE1_TX_Pin|BLE1_RX_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; @@ -580,7 +586,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmarx, hdma_usart6_rx); + __HAL_LINKDMA(uartHandle,hdmarx,hdma_usart6_rx); /* USART6_TX Init */ hdma_usart6_tx.Instance = DMA2_Stream6; @@ -598,25 +604,25 @@ void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) Error_Handler(); } - __HAL_LINKDMA(uartHandle, hdmatx, hdma_usart6_tx); + __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart6_tx); /* USART6 interrupt Init */ HAL_NVIC_SetPriority(USART6_IRQn, 5, 0); HAL_NVIC_EnableIRQ(USART6_IRQn); - /* USER CODE BEGIN USART6_MspInit 1 */ + /* USER CODE BEGIN USART6_MspInit 1 */ - /* USER CODE END USART6_MspInit 1 */ + /* USER CODE END USART6_MspInit 1 */ } } -void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) +void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle) { - if (uartHandle->Instance == UART4) + if(uartHandle->Instance==UART4) { - /* USER CODE BEGIN UART4_MspDeInit 0 */ + /* USER CODE BEGIN UART4_MspDeInit 0 */ - /* USER CODE END UART4_MspDeInit 0 */ + /* USER CODE END UART4_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_UART4_CLK_DISABLE(); @@ -624,7 +630,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) PC10 ------> UART4_TX PC11 ------> UART4_RX */ - HAL_GPIO_DeInit(GPIOC, LCD_TX_Pin | LCD_RX_Pin); + HAL_GPIO_DeInit(GPIOC, LCD_TX_Pin|LCD_RX_Pin); /* UART4 DMA DeInit */ HAL_DMA_DeInit(uartHandle->hdmarx); @@ -632,15 +638,15 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) /* UART4 interrupt Deinit */ HAL_NVIC_DisableIRQ(UART4_IRQn); - /* USER CODE BEGIN UART4_MspDeInit 1 */ + /* USER CODE BEGIN UART4_MspDeInit 1 */ - /* USER CODE END UART4_MspDeInit 1 */ + /* USER CODE END UART4_MspDeInit 1 */ } - else if (uartHandle->Instance == UART5) + else if(uartHandle->Instance==UART5) { - /* USER CODE BEGIN UART5_MspDeInit 0 */ + /* USER CODE BEGIN UART5_MspDeInit 0 */ - /* USER CODE END UART5_MspDeInit 0 */ + /* USER CODE END UART5_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_UART5_CLK_DISABLE(); @@ -658,15 +664,15 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) /* UART5 interrupt Deinit */ HAL_NVIC_DisableIRQ(UART5_IRQn); - /* USER CODE BEGIN UART5_MspDeInit 1 */ + /* USER CODE BEGIN UART5_MspDeInit 1 */ - /* USER CODE END UART5_MspDeInit 1 */ + /* USER CODE END UART5_MspDeInit 1 */ } - else if (uartHandle->Instance == USART1) + else if(uartHandle->Instance==USART1) { - /* USER CODE BEGIN USART1_MspDeInit 0 */ + /* USER CODE BEGIN USART1_MspDeInit 0 */ - /* USER CODE END USART1_MspDeInit 0 */ + /* USER CODE END USART1_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_USART1_CLK_DISABLE(); @@ -674,7 +680,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) PA9 ------> USART1_TX PA10 ------> USART1_RX */ - HAL_GPIO_DeInit(GPIOA, USB_TX_Pin | USB_RX_Pin); + HAL_GPIO_DeInit(GPIOA, USB_TX_Pin|USB_RX_Pin); /* USART1 DMA DeInit */ HAL_DMA_DeInit(uartHandle->hdmarx); @@ -682,15 +688,15 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) /* USART1 interrupt Deinit */ HAL_NVIC_DisableIRQ(USART1_IRQn); - /* USER CODE BEGIN USART1_MspDeInit 1 */ + /* USER CODE BEGIN USART1_MspDeInit 1 */ - /* USER CODE END USART1_MspDeInit 1 */ + /* USER CODE END USART1_MspDeInit 1 */ } - else if (uartHandle->Instance == USART2) + else if(uartHandle->Instance==USART2) { - /* USER CODE BEGIN USART2_MspDeInit 0 */ + /* USER CODE BEGIN USART2_MspDeInit 0 */ - /* USER CODE END USART2_MspDeInit 0 */ + /* USER CODE END USART2_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_USART2_CLK_DISABLE(); @@ -698,7 +704,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) PD5 ------> USART2_TX PD6 ------> USART2_RX */ - HAL_GPIO_DeInit(GPIOD, HART2_TX_Pin | HART2_RX_Pin); + HAL_GPIO_DeInit(GPIOD, HART2_TX_Pin|HART2_RX_Pin); /* USART2 DMA DeInit */ HAL_DMA_DeInit(uartHandle->hdmarx); @@ -706,15 +712,15 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) /* USART2 interrupt Deinit */ HAL_NVIC_DisableIRQ(USART2_IRQn); - /* USER CODE BEGIN USART2_MspDeInit 1 */ + /* USER CODE BEGIN USART2_MspDeInit 1 */ - /* USER CODE END USART2_MspDeInit 1 */ + /* USER CODE END USART2_MspDeInit 1 */ } - else if (uartHandle->Instance == USART3) + else if(uartHandle->Instance==USART3) { - /* USER CODE BEGIN USART3_MspDeInit 0 */ + /* USER CODE BEGIN USART3_MspDeInit 0 */ - /* USER CODE END USART3_MspDeInit 0 */ + /* USER CODE END USART3_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_USART3_CLK_DISABLE(); @@ -722,7 +728,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) PD8 ------> USART3_TX PD9 ------> USART3_RX */ - HAL_GPIO_DeInit(GPIOD, BLE2_TX_Pin | BLE2_RX_Pin); + HAL_GPIO_DeInit(GPIOD, BLE2_TX_Pin|BLE2_RX_Pin); /* USART3 DMA DeInit */ HAL_DMA_DeInit(uartHandle->hdmarx); @@ -730,15 +736,15 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) /* USART3 interrupt Deinit */ HAL_NVIC_DisableIRQ(USART3_IRQn); - /* USER CODE BEGIN USART3_MspDeInit 1 */ + /* USER CODE BEGIN USART3_MspDeInit 1 */ - /* USER CODE END USART3_MspDeInit 1 */ + /* USER CODE END USART3_MspDeInit 1 */ } - else if (uartHandle->Instance == USART6) + else if(uartHandle->Instance==USART6) { - /* USER CODE BEGIN USART6_MspDeInit 0 */ + /* USER CODE BEGIN USART6_MspDeInit 0 */ - /* USER CODE END USART6_MspDeInit 0 */ + /* USER CODE END USART6_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_USART6_CLK_DISABLE(); @@ -746,7 +752,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) PC6 ------> USART6_TX PC7 ------> USART6_RX */ - HAL_GPIO_DeInit(GPIOC, BLE1_TX_Pin | BLE1_RX_Pin); + HAL_GPIO_DeInit(GPIOC, BLE1_TX_Pin|BLE1_RX_Pin); /* USART6 DMA DeInit */ HAL_DMA_DeInit(uartHandle->hdmarx); @@ -754,9 +760,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef *uartHandle) /* USART6 interrupt Deinit */ HAL_NVIC_DisableIRQ(USART6_IRQn); - /* USER CODE BEGIN USART6_MspDeInit 1 */ + /* USER CODE BEGIN USART6_MspDeInit 1 */ - /* USER CODE END USART6_MspDeInit 1 */ + /* USER CODE END USART6_MspDeInit 1 */ } } diff --git a/MDK-ARM/semi-finished_product_testing.uvoptx b/MDK-ARM/semi-finished_product_testing.uvoptx index a18ada5..4f443c2 100644 --- a/MDK-ARM/semi-finished_product_testing.uvoptx +++ b/MDK-ARM/semi-finished_product_testing.uvoptx @@ -225,6 +225,11 @@ 1 tcp_echo_flags_control + + 15 + 1 + state + 0 diff --git a/semi-finished_product_testing.ioc b/semi-finished_product_testing.ioc index 04fcdaa..aa32443 100644 --- a/semi-finished_product_testing.ioc +++ b/semi-finished_product_testing.ioc @@ -193,65 +193,66 @@ Mcu.Pin10=PC5 Mcu.Pin11=PB1 Mcu.Pin12=PB2 Mcu.Pin13=PE7 -Mcu.Pin14=PE9 -Mcu.Pin15=PE11 -Mcu.Pin16=PE12 -Mcu.Pin17=PE13 -Mcu.Pin18=PE14 -Mcu.Pin19=PB11 +Mcu.Pin14=PE8 +Mcu.Pin15=PE9 +Mcu.Pin16=PE11 +Mcu.Pin17=PE12 +Mcu.Pin18=PE13 +Mcu.Pin19=PE14 Mcu.Pin2=PH0-OSC_IN -Mcu.Pin20=PB12 -Mcu.Pin21=PB13 -Mcu.Pin22=PD8 -Mcu.Pin23=PD9 -Mcu.Pin24=PD11 -Mcu.Pin25=PD12 -Mcu.Pin26=PD13 -Mcu.Pin27=PD14 -Mcu.Pin28=PD15 -Mcu.Pin29=PC6 +Mcu.Pin20=PB11 +Mcu.Pin21=PB12 +Mcu.Pin22=PB13 +Mcu.Pin23=PD8 +Mcu.Pin24=PD9 +Mcu.Pin25=PD11 +Mcu.Pin26=PD12 +Mcu.Pin27=PD13 +Mcu.Pin28=PD14 +Mcu.Pin29=PD15 Mcu.Pin3=PH1-OSC_OUT -Mcu.Pin30=PC7 -Mcu.Pin31=PC8 -Mcu.Pin32=PC9 -Mcu.Pin33=PA8 -Mcu.Pin34=PA9 -Mcu.Pin35=PA10 -Mcu.Pin36=PA11 -Mcu.Pin37=PA12 -Mcu.Pin38=PA13 -Mcu.Pin39=PA14 +Mcu.Pin30=PC6 +Mcu.Pin31=PC7 +Mcu.Pin32=PC8 +Mcu.Pin33=PC9 +Mcu.Pin34=PA8 +Mcu.Pin35=PA9 +Mcu.Pin36=PA10 +Mcu.Pin37=PA11 +Mcu.Pin38=PA12 +Mcu.Pin39=PA13 Mcu.Pin4=PC0 -Mcu.Pin40=PA15 -Mcu.Pin41=PC10 -Mcu.Pin42=PC11 -Mcu.Pin43=PC12 -Mcu.Pin44=PD0 -Mcu.Pin45=PD1 -Mcu.Pin46=PD2 -Mcu.Pin47=PD3 -Mcu.Pin48=PD4 -Mcu.Pin49=PD5 +Mcu.Pin40=PA14 +Mcu.Pin41=PA15 +Mcu.Pin42=PC10 +Mcu.Pin43=PC11 +Mcu.Pin44=PC12 +Mcu.Pin45=PD0 +Mcu.Pin46=PD1 +Mcu.Pin47=PD2 +Mcu.Pin48=PD3 +Mcu.Pin49=PD4 Mcu.Pin5=PC1 -Mcu.Pin50=PD6 -Mcu.Pin51=PD7 -Mcu.Pin52=PB3 -Mcu.Pin53=PB4 -Mcu.Pin54=PB5 -Mcu.Pin55=PB6 -Mcu.Pin56=PB7 -Mcu.Pin57=PE0 -Mcu.Pin58=PE1 -Mcu.Pin59=VP_FREERTOS_VS_CMSIS_V1 +Mcu.Pin50=PD5 +Mcu.Pin51=PD6 +Mcu.Pin52=PD7 +Mcu.Pin53=PB3 +Mcu.Pin54=PB4 +Mcu.Pin55=PB5 +Mcu.Pin56=PB6 +Mcu.Pin57=PB7 +Mcu.Pin58=PE0 +Mcu.Pin59=PE1 Mcu.Pin6=PA1 -Mcu.Pin60=VP_LWIP_VS_Enabled -Mcu.Pin61=VP_SYS_VS_tim4 -Mcu.Pin62=VP_TIM2_VS_ClockSourceINT -Mcu.Pin63=VP_TIM3_VS_ClockSourceINT +Mcu.Pin60=VP_FREERTOS_VS_CMSIS_V1 +Mcu.Pin61=VP_LWIP_VS_Enabled +Mcu.Pin62=VP_SYS_VS_tim4 +Mcu.Pin63=VP_TIM2_VS_ClockSourceINT +Mcu.Pin64=VP_TIM3_VS_ClockSourceINT Mcu.Pin7=PA2 Mcu.Pin8=PA7 Mcu.Pin9=PC4 -Mcu.PinsNb=64 +Mcu.PinsNb=65 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F407VGTx @@ -274,6 +275,7 @@ NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:fals NVIC.ETH_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.EXTI1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.EXTI3_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true +NVIC.EXTI9_5_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.ForceEnableDMAVector=true NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false @@ -571,6 +573,12 @@ PE7.GPIO_Speed=GPIO_SPEED_FREQ_MEDIUM PE7.Locked=true PE7.PinState=GPIO_PIN_SET PE7.Signal=GPIO_Output +PE8.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI +PE8.GPIO_Label=EC11_KEY +PE8.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING +PE8.GPIO_PuPd=GPIO_PULLUP +PE8.Locked=true +PE8.Signal=GPXTI8 PE9.GPIOParameters=GPIO_PuPd,GPIO_Label PE9.GPIO_Label=EC11_A PE9.GPIO_PuPd=GPIO_PULLUP @@ -647,6 +655,8 @@ SH.GPXTI1.0=GPIO_EXTI1 SH.GPXTI1.ConfNb=1 SH.GPXTI3.0=GPIO_EXTI3 SH.GPXTI3.ConfNb=1 +SH.GPXTI8.0=GPIO_EXTI8 +SH.GPXTI8.ConfNb=1 SH.S_TIM1_CH1.0=TIM1_CH1,Encoder_Interface SH.S_TIM1_CH1.ConfNb=1 SH.S_TIM1_CH2.0=TIM1_CH2,Encoder_Interface