From f956b1bd4a3a12fe957d64c2a3f60952eebe8033 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 29 May 2016 20:05:58 +0200 Subject: [PATCH] clear out unused tim CC4 interrupt --- CubeMX2Makefile | 2 +- Inc/stm32f4xx_it.h | 1 - Makefile | 6 +++--- Odrive.ioc | 1 - Src/main.c | 3 --- Src/stm32f4xx_it.c | 15 --------------- Src/test.c | 15 ++++++++------- Src/tim.c | 4 ---- 8 files changed, 12 insertions(+), 35 deletions(-) diff --git a/CubeMX2Makefile b/CubeMX2Makefile index 11edeb84..6a64be82 160000 --- a/CubeMX2Makefile +++ b/CubeMX2Makefile @@ -1 +1 @@ -Subproject commit 11edeb84241d5ec0a5a117a40c11c67fdc772d20 +Subproject commit 6a64be8246d87e701644063db499208e08c320fb diff --git a/Inc/stm32f4xx_it.h b/Inc/stm32f4xx_it.h index 5673c80c..d90711ca 100644 --- a/Inc/stm32f4xx_it.h +++ b/Inc/stm32f4xx_it.h @@ -53,7 +53,6 @@ void UsageFault_Handler(void); void DebugMon_Handler(void); void SysTick_Handler(void); void ADC_IRQHandler(void); -void TIM1_CC_IRQHandler(void); void OTG_FS_IRQHandler(void); #ifdef __cplusplus diff --git a/Makefile b/Makefile index 0e24cb94..4fa3d7d8 100644 --- a/Makefile +++ b/Makefile @@ -108,8 +108,8 @@ C_INCLUDES += -IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS C_INCLUDES += -IMiddlewares/Third_Party/FreeRTOS/Source/include C_INCLUDES += -IMiddlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F # compile gcc flags -ASFLAGS = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections -CFLAGS = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections +ASFLAGS = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections +CFLAGS = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections ifeq ($(DEBUG), 1) CFLAGS += -g -gdwarf-2 endif @@ -124,7 +124,7 @@ LDSCRIPT = STM32F405RGTx_FLASH.ld # libraries LIBS = -lc -lm -lnosys LIBDIR = -LDFLAGS = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections +LDFLAGS = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections # default action: build all all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin diff --git a/Odrive.ioc b/Odrive.ioc index 236c1ce8..43385026 100755 --- a/Odrive.ioc +++ b/Odrive.ioc @@ -171,7 +171,6 @@ NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true NVIC.OTG_FS_IRQn=true\:5\:0\:false\:false\:true NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true -NVIC.TIM1_CC_IRQn=true\:5\:0\:false\:true\:true\:2 NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true PA0-WKUP.GPIOParameters=GPIO_Label PA0-WKUP.GPIO_Label=VBUS_S diff --git a/Src/main.c b/Src/main.c index b9b71613..58e19960 100644 --- a/Src/main.c +++ b/Src/main.c @@ -169,9 +169,6 @@ void MX_NVIC_Init(void) /* ADC_IRQn interrupt configuration */ HAL_NVIC_SetPriority(ADC_IRQn, 5, 0); HAL_NVIC_EnableIRQ(ADC_IRQn); - /* TIM1_CC_IRQn interrupt configuration */ - HAL_NVIC_SetPriority(TIM1_CC_IRQn, 5, 0); - HAL_NVIC_EnableIRQ(TIM1_CC_IRQn); } /* USER CODE BEGIN 4 */ diff --git a/Src/stm32f4xx_it.c b/Src/stm32f4xx_it.c index 52879a9b..614e4560 100644 --- a/Src/stm32f4xx_it.c +++ b/Src/stm32f4xx_it.c @@ -45,7 +45,6 @@ extern PCD_HandleTypeDef hpcd_USB_OTG_FS; extern ADC_HandleTypeDef hadc1; extern ADC_HandleTypeDef hadc2; extern ADC_HandleTypeDef hadc3; -extern TIM_HandleTypeDef htim1; /******************************************************************************/ /* Cortex-M4 Processor Interruption and Exception Handlers */ @@ -183,20 +182,6 @@ void ADC_IRQHandler(void) /* USER CODE END ADC_IRQn 1 */ } -/** -* @brief This function handles TIM1 capture compare interrupt. -*/ -void TIM1_CC_IRQHandler(void) -{ - /* USER CODE BEGIN TIM1_CC_IRQn 0 */ - - /* USER CODE END TIM1_CC_IRQn 0 */ - HAL_TIM_IRQHandler(&htim1); - /* USER CODE BEGIN TIM1_CC_IRQn 1 */ - - /* USER CODE END TIM1_CC_IRQn 1 */ -} - /** * @brief This function handles USB On The Go FS global interrupt. */ diff --git a/Src/test.c b/Src/test.c index b35011cb..16aa5fad 100644 --- a/Src/test.c +++ b/Src/test.c @@ -11,6 +11,8 @@ #include "adc.h" #include "tim.h" +#include "math.h" + static void test_read_ADC(void); static int test_base = 0; @@ -46,6 +48,9 @@ static void test_read_ADC(void) { } } +static uint32_t testcnt[16]; +static int tcidx = 0; + void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc) { assert(hadc == &hadc2); @@ -56,13 +61,9 @@ void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc) { test++; } else { test2++; + testcnt[tcidx] = cnt - 2048; + if(++tcidx == 16) + tcidx = 0; } } -void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim) { - - //We only expect the timing driving channel to trigger an interrupt. - assert(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4); - test_base++; - -} diff --git a/Src/tim.c b/Src/tim.c index 0dac5dda..61e559c8 100644 --- a/Src/tim.c +++ b/Src/tim.c @@ -394,10 +394,6 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base) /* USER CODE END TIM1_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_TIM1_CLK_DISABLE(); - - /* Peripheral interrupt Deinit*/ - HAL_NVIC_DisableIRQ(TIM1_CC_IRQn); - /* USER CODE BEGIN TIM1_MspDeInit 1 */ /* USER CODE END TIM1_MspDeInit 1 */