From 7fc6083879d47a99b5549a0e74a5b7e553dc0317 Mon Sep 17 00:00:00 2001 From: NeoZeng Date: Wed, 23 Nov 2022 22:19:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcan=20FIFO1=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HAL_N_Middlewares/Inc/stm32f4xx_it.h | 3 ++ HAL_N_Middlewares/Src/can.c | 6 ++++ HAL_N_Middlewares/Src/stm32f4xx_it.c | 43 ++++++++++++++++++++++++++++ HAL_N_Middlewares/Src/tim.c | 2 +- HAL_N_Middlewares/Src/usart.c | 6 ++++ basic_framework.ioc | 7 +++-- 6 files changed, 64 insertions(+), 3 deletions(-) diff --git a/HAL_N_Middlewares/Inc/stm32f4xx_it.h b/HAL_N_Middlewares/Inc/stm32f4xx_it.h index 2e8066c..74bce60 100644 --- a/HAL_N_Middlewares/Inc/stm32f4xx_it.h +++ b/HAL_N_Middlewares/Inc/stm32f4xx_it.h @@ -55,10 +55,13 @@ void DebugMon_Handler(void); void SysTick_Handler(void); void DMA1_Stream1_IRQHandler(void); void CAN1_RX0_IRQHandler(void); +void CAN1_RX1_IRQHandler(void); void USART1_IRQHandler(void); +void USART3_IRQHandler(void); void DMA2_Stream1_IRQHandler(void); void DMA2_Stream2_IRQHandler(void); void CAN2_RX0_IRQHandler(void); +void CAN2_RX1_IRQHandler(void); void OTG_FS_IRQHandler(void); void DMA2_Stream6_IRQHandler(void); void DMA2_Stream7_IRQHandler(void); diff --git a/HAL_N_Middlewares/Src/can.c b/HAL_N_Middlewares/Src/can.c index 30561c6..e56dd5c 100644 --- a/HAL_N_Middlewares/Src/can.c +++ b/HAL_N_Middlewares/Src/can.c @@ -124,6 +124,8 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle) /* CAN1 interrupt Init */ HAL_NVIC_SetPriority(CAN1_RX0_IRQn, 6, 0); HAL_NVIC_EnableIRQ(CAN1_RX0_IRQn); + HAL_NVIC_SetPriority(CAN1_RX1_IRQn, 5, 0); + HAL_NVIC_EnableIRQ(CAN1_RX1_IRQn); /* USER CODE BEGIN CAN1_MspInit 1 */ /* USER CODE END CAN1_MspInit 1 */ @@ -155,6 +157,8 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle) /* CAN2 interrupt Init */ HAL_NVIC_SetPriority(CAN2_RX0_IRQn, 6, 0); HAL_NVIC_EnableIRQ(CAN2_RX0_IRQn); + HAL_NVIC_SetPriority(CAN2_RX1_IRQn, 5, 0); + HAL_NVIC_EnableIRQ(CAN2_RX1_IRQn); /* USER CODE BEGIN CAN2_MspInit 1 */ /* USER CODE END CAN2_MspInit 1 */ @@ -183,6 +187,7 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* canHandle) /* CAN1 interrupt Deinit */ HAL_NVIC_DisableIRQ(CAN1_RX0_IRQn); + HAL_NVIC_DisableIRQ(CAN1_RX1_IRQn); /* USER CODE BEGIN CAN1_MspDeInit 1 */ /* USER CODE END CAN1_MspDeInit 1 */ @@ -207,6 +212,7 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* canHandle) /* CAN2 interrupt Deinit */ HAL_NVIC_DisableIRQ(CAN2_RX0_IRQn); + HAL_NVIC_DisableIRQ(CAN2_RX1_IRQn); /* USER CODE BEGIN CAN2_MspDeInit 1 */ /* USER CODE END CAN2_MspDeInit 1 */ diff --git a/HAL_N_Middlewares/Src/stm32f4xx_it.c b/HAL_N_Middlewares/Src/stm32f4xx_it.c index 758bf37..46fafde 100644 --- a/HAL_N_Middlewares/Src/stm32f4xx_it.c +++ b/HAL_N_Middlewares/Src/stm32f4xx_it.c @@ -66,6 +66,7 @@ extern DMA_HandleTypeDef hdma_usart3_rx; extern DMA_HandleTypeDef hdma_usart6_rx; extern DMA_HandleTypeDef hdma_usart6_tx; extern UART_HandleTypeDef huart1; +extern UART_HandleTypeDef huart3; extern UART_HandleTypeDef huart6; /* USER CODE BEGIN EV */ @@ -219,6 +220,20 @@ void CAN1_RX0_IRQHandler(void) /* USER CODE END CAN1_RX0_IRQn 1 */ } +/** + * @brief This function handles CAN1 RX1 interrupt. + */ +void CAN1_RX1_IRQHandler(void) +{ + /* USER CODE BEGIN CAN1_RX1_IRQn 0 */ + + /* USER CODE END CAN1_RX1_IRQn 0 */ + HAL_CAN_IRQHandler(&hcan1); + /* USER CODE BEGIN CAN1_RX1_IRQn 1 */ + + /* USER CODE END CAN1_RX1_IRQn 1 */ +} + /** * @brief This function handles USART1 global interrupt. */ @@ -233,6 +248,20 @@ void USART1_IRQHandler(void) /* USER CODE END USART1_IRQn 1 */ } +/** + * @brief This function handles USART3 global interrupt. + */ +void USART3_IRQHandler(void) +{ + /* USER CODE BEGIN USART3_IRQn 0 */ + + /* USER CODE END USART3_IRQn 0 */ + HAL_UART_IRQHandler(&huart3); + /* USER CODE BEGIN USART3_IRQn 1 */ + + /* USER CODE END USART3_IRQn 1 */ +} + /** * @brief This function handles DMA2 stream1 global interrupt. */ @@ -275,6 +304,20 @@ void CAN2_RX0_IRQHandler(void) /* USER CODE END CAN2_RX0_IRQn 1 */ } +/** + * @brief This function handles CAN2 RX1 interrupt. + */ +void CAN2_RX1_IRQHandler(void) +{ + /* USER CODE BEGIN CAN2_RX1_IRQn 0 */ + + /* USER CODE END CAN2_RX1_IRQn 0 */ + HAL_CAN_IRQHandler(&hcan2); + /* USER CODE BEGIN CAN2_RX1_IRQn 1 */ + + /* USER CODE END CAN2_RX1_IRQn 1 */ +} + /** * @brief This function handles USB On The Go FS global interrupt. */ diff --git a/HAL_N_Middlewares/Src/tim.c b/HAL_N_Middlewares/Src/tim.c index 79d130d..c665bb8 100644 --- a/HAL_N_Middlewares/Src/tim.c +++ b/HAL_N_Middlewares/Src/tim.c @@ -156,7 +156,7 @@ void MX_TIM5_Init(void) TIM_OC_InitTypeDef sConfigOC = {0}; /* USER CODE BEGIN TIM5_Init 1 */ - + /* USER CODE END TIM5_Init 1 */ htim5.Instance = TIM5; htim5.Init.Prescaler = 0; diff --git a/HAL_N_Middlewares/Src/usart.c b/HAL_N_Middlewares/Src/usart.c index 9506852..31895f5 100644 --- a/HAL_N_Middlewares/Src/usart.c +++ b/HAL_N_Middlewares/Src/usart.c @@ -236,6 +236,9 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) __HAL_LINKDMA(uartHandle,hdmarx,hdma_usart3_rx); + /* USART3 interrupt Init */ + HAL_NVIC_SetPriority(USART3_IRQn, 5, 0); + HAL_NVIC_EnableIRQ(USART3_IRQn); /* USER CODE BEGIN USART3_MspInit 1 */ /* USER CODE END USART3_MspInit 1 */ @@ -351,6 +354,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle) /* USART3 DMA DeInit */ HAL_DMA_DeInit(uartHandle->hdmarx); + + /* USART3 interrupt Deinit */ + HAL_NVIC_DisableIRQ(USART3_IRQn); /* USER CODE BEGIN USART3_MspDeInit 1 */ /* USER CODE END USART3_MspDeInit 1 */ diff --git a/basic_framework.ioc b/basic_framework.ioc index eac91c8..1e38b76 100644 --- a/basic_framework.ioc +++ b/basic_framework.ioc @@ -153,7 +153,9 @@ MxCube.Version=6.6.1 MxDb.Version=DB.6.0.60 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.CAN1_RX0_IRQn=true\:6\:0\:true\:false\:true\:true\:true\:true\:true +NVIC.CAN1_RX1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.CAN2_RX0_IRQn=true\:6\:0\:true\:false\:true\:true\:true\:true\:true +NVIC.CAN2_RX1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.DMA1_Stream1_IRQn=true\:5\:0\:true\:false\:true\:true\:false\:true\:true NVIC.DMA2_Stream1_IRQn=true\:5\:0\:true\:false\:true\:true\:false\:true\:true NVIC.DMA2_Stream2_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true @@ -171,8 +173,9 @@ NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false\:false NVIC.SavedPendsvIrqHandlerGenerated=true NVIC.SavedSvcallIrqHandlerGenerated=true NVIC.SavedSystickIrqHandlerGenerated=true -NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true\:false\:true\:false +NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:true\:false\:false\:false NVIC.USART1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true +NVIC.USART3_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.USART6_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.UsageFault_IRQn=true\:0\:0\:true\:false\:true\:false\:false\:false\:false PA0-WKUP.GPIOParameters=GPIO_PuPd,GPIO_Label @@ -290,7 +293,7 @@ PH12.Signal=S_TIM5_CH3 PinOutPanel.CurrentBGAView=Top PinOutPanel.RotationAngle=0 ProjectManager.AskForMigrate=true -ProjectManager.BackupPrevious=false +ProjectManager.BackupPrevious=true ProjectManager.CompilerOptimize=6 ProjectManager.ComputerToolchain=false ProjectManager.CoupleFile=true