diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h index ca37509e02..82255b76db 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h @@ -27,6 +27,17 @@ extern "C" { } #endif /* TIM_DEV_INFO_CONFIG */ +#ifdef BSP_USING_TIM7 +#ifndef TIM7_CONFIG +#define TIM7_CONFIG \ + { \ + .tim_handle.Instance = TIM7, \ + .tim_irqn = TIM7_IRQn, \ + .name = "timer7", \ + } +#endif /* TIM7_CONFIG */ +#endif /* BSP_USING_TIM7 */ + #ifdef BSP_USING_TIM14 #ifndef TIM14_CONFIG #define TIM14_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c index 7153540505..c8167995fb 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c @@ -599,7 +599,8 @@ static int stm32_hwtimer_init(void) { stm32_hwtimer_obj[i].time_device.info = &_info; stm32_hwtimer_obj[i].time_device.ops = &_ops; - if (rt_device_hwtimer_register(&stm32_hwtimer_obj[i].time_device, stm32_hwtimer_obj[i].name, &stm32_hwtimer_obj[i].tim_handle) == RT_EOK) + if (rt_device_hwtimer_register(&stm32_hwtimer_obj[i].time_device, + stm32_hwtimer_obj[i].name, &stm32_hwtimer_obj[i].tim_handle) == RT_EOK) { LOG_D("%s register success", stm32_hwtimer_obj[i].name); } diff --git a/bsp/stm32/stm32f072-st-nucleo/applications/arduino_pinout/pins_arduino.h b/bsp/stm32/stm32f072-st-nucleo/applications/arduino_pinout/pins_arduino.h index 1d0856ce4d..ba42bf14f6 100644 --- a/bsp/stm32/stm32f072-st-nucleo/applications/arduino_pinout/pins_arduino.h +++ b/bsp/stm32/stm32f072-st-nucleo/applications/arduino_pinout/pins_arduino.h @@ -40,6 +40,7 @@ #define LED_BUILTIN D13 /* Default Built-in LED */ -#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" +#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" +#define RTDUINO_DEFAULT_HWTIMER_DEVICE_NAME "timer7" #endif /* Pins_Arduino_h */ diff --git a/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/.mxproject b/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/.mxproject index 9f73a77b6d..99d425b5c3 100644 --- a/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/.mxproject +++ b/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/.mxproject @@ -1,5 +1,5 @@ [PreviousLibFiles] -LibFiles=Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_adc.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_adc_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_rcc.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_rcc_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_def.h;Drivers\STM32F0xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_i2c.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_i2c_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_gpio.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_gpio_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_dma_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_dma.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_cortex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_pwr.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_pwr_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_flash.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_flash_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_exti.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_tim.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_tim_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_uart.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_uart_ex.h;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_adc.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_adc_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_rcc.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_rcc_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_i2c.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_i2c_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_gpio.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_dma.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_cortex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_pwr.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_pwr_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_flash.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_flash_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_exti.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_tim.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_tim_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_uart.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_uart_ex.c;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_adc.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_adc_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_rcc.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_rcc_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_def.h;Drivers\STM32F0xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_i2c.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_i2c_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_gpio.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_gpio_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_dma_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_dma.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_cortex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_pwr.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_pwr_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_flash.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_flash_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_exti.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_tim.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_tim_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_uart.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_uart_ex.h;Drivers\CMSIS\Device\ST\STM32F0xx\Include\stm32f072xb.h;Drivers\CMSIS\Device\ST\STM32F0xx\Include\stm32f0xx.h;Drivers\CMSIS\Device\ST\STM32F0xx\Include\system_stm32f0xx.h;Drivers\CMSIS\Device\ST\STM32F0xx\Source\Templates\system_stm32f0xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h; +LibFiles=Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_adc.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_adc_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_rcc.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_rcc_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_def.h;Drivers\STM32F0xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_i2c.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_i2c_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_gpio.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_gpio_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_dma_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_dma.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_cortex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_pwr.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_pwr_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_flash.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_flash_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_exti.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_tim.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_tim_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_uart.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_uart_ex.h;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_adc.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_adc_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_rcc.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_rcc_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_i2c.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_i2c_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_gpio.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_dma.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_cortex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_pwr.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_pwr_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_flash.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_flash_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_exti.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_tim.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_tim_ex.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_uart.c;Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_uart_ex.c;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_adc.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_adc_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_rcc.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_rcc_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_def.h;Drivers\STM32F0xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_i2c.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_i2c_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_gpio.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_gpio_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_dma_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_dma.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_cortex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_pwr.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_pwr_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_flash.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_flash_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_exti.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_tim.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_tim_ex.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_uart.h;Drivers\STM32F0xx_HAL_Driver\Inc\stm32f0xx_hal_uart_ex.h;Drivers\CMSIS\Device\ST\STM32F0xx\Include\stm32f072xb.h;Drivers\CMSIS\Device\ST\STM32F0xx\Include\stm32f0xx.h;Drivers\CMSIS\Device\ST\STM32F0xx\Include\system_stm32f0xx.h;Drivers\CMSIS\Device\ST\STM32F0xx\Source\Templates\system_stm32f0xx.c; [PreviousUsedKeilFiles] SourceFiles=..\Src\main.c;..\Src\stm32f0xx_it.c;..\Src\stm32f0xx_hal_msp.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_adc.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_adc_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_rcc.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_rcc_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_i2c.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_i2c_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_gpio.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_dma.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_cortex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_pwr.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_pwr_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_flash.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_flash_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_exti.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_tim.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_tim_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_uart.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_uart_ex.c;..\Drivers\CMSIS\Device\ST\STM32F0xx\Source\Templates\system_stm32f0xx.c;..\\Src\system_stm32f0xx.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_adc.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_adc_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_rcc.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_rcc_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_i2c.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_i2c_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_gpio.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_dma.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_cortex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_pwr.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_pwr_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_flash.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_flash_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_exti.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_tim.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_tim_ex.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_uart.c;..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_uart_ex.c;..\Drivers\CMSIS\Device\ST\STM32F0xx\Source\Templates\system_stm32f0xx.c;..\\Src\system_stm32f0xx.c;;; diff --git a/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc b/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc index 40351fd5c6..e9d95f9f77 100644 --- a/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc +++ b/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc @@ -9,10 +9,11 @@ Mcu.IP2=RCC Mcu.IP3=SYS Mcu.IP4=TIM2 Mcu.IP5=TIM3 -Mcu.IP6=TIM16 -Mcu.IP7=TIM17 -Mcu.IP8=USART2 -Mcu.IPNb=9 +Mcu.IP6=TIM7 +Mcu.IP7=TIM16 +Mcu.IP8=TIM17 +Mcu.IP9=USART2 +Mcu.IPNb=10 Mcu.Name=STM32F072R(8-B)Tx Mcu.Package=LQFP64 Mcu.Pin0=PC13 @@ -35,8 +36,9 @@ Mcu.Pin23=VP_ADC_Vref_Input Mcu.Pin24=VP_SYS_VS_Systick Mcu.Pin25=VP_TIM2_VS_ClockSourceINT Mcu.Pin26=VP_TIM3_VS_ClockSourceINT -Mcu.Pin27=VP_TIM16_VS_ClockSourceINT -Mcu.Pin28=VP_TIM17_VS_ClockSourceINT +Mcu.Pin27=VP_TIM7_VS_ClockSourceINT +Mcu.Pin28=VP_TIM16_VS_ClockSourceINT +Mcu.Pin29=VP_TIM17_VS_ClockSourceINT Mcu.Pin3=PF0-OSC_IN Mcu.Pin4=PF1-OSC_OUT Mcu.Pin5=PC0 @@ -44,7 +46,7 @@ Mcu.Pin6=PC1 Mcu.Pin7=PA0 Mcu.Pin8=PA1 Mcu.Pin9=PA2 -Mcu.PinsNb=29 +Mcu.PinsNb=30 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F072RBTx @@ -225,5 +227,7 @@ VP_TIM2_VS_ClockSourceINT.Mode=Internal VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT VP_TIM3_VS_ClockSourceINT.Mode=Internal VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT +VP_TIM7_VS_ClockSourceINT.Mode=Enable_Timer +VP_TIM7_VS_ClockSourceINT.Signal=TIM7_VS_ClockSourceINT board=NUCLEO-F072RB boardIOC=true diff --git a/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/Src/main.c b/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/Src/main.c index 9b95fb83a3..a9e9cdbbed 100644 --- a/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/Src/main.c +++ b/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/Src/main.c @@ -65,6 +65,7 @@ TIM_HandleTypeDef htim2; TIM_HandleTypeDef htim3; +TIM_HandleTypeDef htim7; TIM_HandleTypeDef htim16; TIM_HandleTypeDef htim17; @@ -84,6 +85,7 @@ static void MX_TIM2_Init(void); static void MX_TIM3_Init(void); static void MX_TIM16_Init(void); static void MX_TIM17_Init(void); +static void MX_TIM7_Init(void); /* USER CODE BEGIN PFP */ /* Private function prototypes -----------------------------------------------*/ @@ -128,6 +130,7 @@ int main(void) MX_TIM3_Init(); MX_TIM16_Init(); MX_TIM17_Init(); + MX_TIM7_Init(); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ @@ -422,6 +425,44 @@ static void MX_TIM3_Init(void) } +/** + * @brief TIM7 Initialization Function + * @param None + * @retval None + */ +static void MX_TIM7_Init(void) +{ + + /* USER CODE BEGIN TIM7_Init 0 */ + + /* USER CODE END TIM7_Init 0 */ + + TIM_MasterConfigTypeDef sMasterConfig = {0}; + + /* USER CODE BEGIN TIM7_Init 1 */ + + /* USER CODE END TIM7_Init 1 */ + htim7.Instance = TIM7; + htim7.Init.Prescaler = 0; + htim7.Init.CounterMode = TIM_COUNTERMODE_UP; + htim7.Init.Period = 65535; + htim7.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; + if (HAL_TIM_Base_Init(&htim7) != HAL_OK) + { + Error_Handler(); + } + sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; + sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; + if (HAL_TIMEx_MasterConfigSynchronization(&htim7, &sMasterConfig) != HAL_OK) + { + Error_Handler(); + } + /* USER CODE BEGIN TIM7_Init 2 */ + + /* USER CODE END TIM7_Init 2 */ + +} + /** * @brief TIM16 Initialization Function * @param None diff --git a/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/Src/stm32f0xx_hal_msp.c b/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/Src/stm32f0xx_hal_msp.c index e2b729d572..70e35c7ac3 100644 --- a/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/Src/stm32f0xx_hal_msp.c +++ b/bsp/stm32/stm32f072-st-nucleo/board/CubeMX_Config/Src/stm32f0xx_hal_msp.c @@ -216,6 +216,17 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base) /* USER CODE END TIM3_MspInit 1 */ } + else if(htim_base->Instance==TIM7) + { + /* USER CODE BEGIN TIM7_MspInit 0 */ + + /* USER CODE END TIM7_MspInit 0 */ + /* Peripheral clock enable */ + __HAL_RCC_TIM7_CLK_ENABLE(); + /* USER CODE BEGIN TIM7_MspInit 1 */ + + /* USER CODE END TIM7_MspInit 1 */ + } else if(htim_base->Instance==TIM16) { /* USER CODE BEGIN TIM16_MspInit 0 */ @@ -369,6 +380,17 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base) /* USER CODE END TIM3_MspDeInit 1 */ } + else if(htim_base->Instance==TIM7) + { + /* USER CODE BEGIN TIM7_MspDeInit 0 */ + + /* USER CODE END TIM7_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_TIM7_CLK_DISABLE(); + /* USER CODE BEGIN TIM7_MspDeInit 1 */ + + /* USER CODE END TIM7_MspDeInit 1 */ + } else if(htim_base->Instance==TIM16) { /* USER CODE BEGIN TIM16_MspDeInit 0 */ diff --git a/bsp/stm32/stm32f072-st-nucleo/board/Kconfig b/bsp/stm32/stm32f072-st-nucleo/board/Kconfig index b8b46f478a..bfe82a027a 100644 --- a/bsp/stm32/stm32f072-st-nucleo/board/Kconfig +++ b/bsp/stm32/stm32f072-st-nucleo/board/Kconfig @@ -19,6 +19,8 @@ menu "Onboard Peripheral Drivers" select PKG_USING_RTDUINO select BSP_USING_STLINK_TO_USART select BSP_USING_GPIO + select BSP_USING_TIM + select BSP_USING_TIM7 select BSP_USING_ADC select BSP_USING_ADC1 select BSP_USING_PWM @@ -82,6 +84,16 @@ menu "On-chip Peripheral Drivers" default n endif + menuconfig BSP_USING_TIM + bool "Enable timer" + default n + select RT_USING_HWTIMER + if BSP_USING_TIM + config BSP_USING_TIM7 + bool "Enable TIM7" + default n + endif + menuconfig BSP_USING_PWM bool "Enable PWM" default n diff --git a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.h b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.h index aa996f203a..bd0938aede 100644 --- a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.h +++ b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.h @@ -40,7 +40,8 @@ #define LED_BUILTIN D13 /* Default Built-in LED */ -#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" -#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi1" +#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" +#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi1" +#define RTDUINO_DEFAULT_HWTIMER_DEVICE_NAME "timer11" #endif /* Pins_Arduino_h */ diff --git a/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/.mxproject b/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/.mxproject index 93f27eb78d..069e265317 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/.mxproject +++ b/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/.mxproject @@ -1,5 +1,5 @@ [PreviousLibFiles] -LibFiles=Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f401xe.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h; +LibFiles=Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_adc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_adc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_adc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_adc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f401xe.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c; [PreviousUsedIarFiles] SourceFiles=..\Src\main.c;..\Src\stm32f4xx_it.c;..\Src\stm32f4xx_hal_msp.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;../\Src/system_stm32f4xx.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c;../\Src/system_stm32f4xx.c;../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;D:/rt-thread/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config//EWARM/startup_stm32f401xe.s; @@ -16,3 +16,6 @@ HeaderFiles=stm32f4xx_it.h;stm32f4xx_hal_conf.h;main.h; SourcePath=..\Src SourceFiles=stm32f4xx_it.c;stm32f4xx_hal_msp.c;main.c; +[] +SourceFiles=;; + diff --git a/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc b/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc index 5b2e15a921..3f7dba6389 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc +++ b/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/CubeMX_Config.ioc @@ -16,8 +16,9 @@ Mcu.IP3=SPI1 Mcu.IP4=SYS Mcu.IP5=TIM2 Mcu.IP6=TIM3 -Mcu.IP7=USART2 -Mcu.IPNb=8 +Mcu.IP7=TIM11 +Mcu.IP8=USART2 +Mcu.IPNb=9 Mcu.Name=STM32F401R(D-E)Tx Mcu.Package=LQFP64 Mcu.Pin0=PC14-OSC32_IN @@ -37,6 +38,7 @@ Mcu.Pin20=PB4 Mcu.Pin21=VP_ADC1_TempSens_Input Mcu.Pin22=VP_ADC1_Vref_Input Mcu.Pin23=VP_SYS_VS_Systick +Mcu.Pin24=VP_TIM11_VS_ClockSourceINT Mcu.Pin3=PH1 - OSC_OUT Mcu.Pin4=PC0 Mcu.Pin5=PC1 @@ -44,7 +46,7 @@ Mcu.Pin6=PA0-WKUP Mcu.Pin7=PA1 Mcu.Pin8=PA2 Mcu.Pin9=PA3 -Mcu.PinsNb=24 +Mcu.PinsNb=25 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F401RETx @@ -205,4 +207,6 @@ VP_ADC1_Vref_Input.Mode=IN-Vrefint VP_ADC1_Vref_Input.Signal=ADC1_Vref_Input VP_SYS_VS_Systick.Mode=SysTick VP_SYS_VS_Systick.Signal=SYS_VS_Systick +VP_TIM11_VS_ClockSourceINT.Mode=Enable_Timer +VP_TIM11_VS_ClockSourceINT.Signal=TIM11_VS_ClockSourceINT board=custom diff --git a/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/Src/main.c b/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/Src/main.c index 7c39472167..f917faa3a7 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/Src/main.c +++ b/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/Src/main.c @@ -67,6 +67,7 @@ SPI_HandleTypeDef hspi1; TIM_HandleTypeDef htim2; TIM_HandleTypeDef htim3; +TIM_HandleTypeDef htim11; UART_HandleTypeDef huart2; @@ -82,6 +83,7 @@ static void MX_SPI1_Init(void); static void MX_ADC1_Init(void); static void MX_TIM2_Init(void); static void MX_TIM3_Init(void); +static void MX_TIM11_Init(void); /* USER CODE BEGIN PFP */ /* USER CODE END PFP */ @@ -124,6 +126,7 @@ int main(void) MX_ADC1_Init(); MX_TIM2_Init(); MX_TIM3_Init(); + MX_TIM11_Init(); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ @@ -385,6 +388,37 @@ static void MX_TIM3_Init(void) } +/** + * @brief TIM11 Initialization Function + * @param None + * @retval None + */ +static void MX_TIM11_Init(void) +{ + + /* USER CODE BEGIN TIM11_Init 0 */ + + /* USER CODE END TIM11_Init 0 */ + + /* USER CODE BEGIN TIM11_Init 1 */ + + /* USER CODE END TIM11_Init 1 */ + htim11.Instance = TIM11; + htim11.Init.Prescaler = 0; + htim11.Init.CounterMode = TIM_COUNTERMODE_UP; + htim11.Init.Period = 65535; + htim11.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; + htim11.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; + if (HAL_TIM_Base_Init(&htim11) != HAL_OK) + { + Error_Handler(); + } + /* USER CODE BEGIN TIM11_Init 2 */ + + /* USER CODE END TIM11_Init 2 */ + +} + /** * @brief USART2 Initialization Function * @param None diff --git a/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/Src/stm32f4xx_hal_msp.c b/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/Src/stm32f4xx_hal_msp.c index 9eaf17539c..0f5c9ccf7b 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/Src/stm32f4xx_hal_msp.c +++ b/bsp/stm32/stm32f401-st-nucleo/board/CubeMX_Config/Src/stm32f4xx_hal_msp.c @@ -286,6 +286,28 @@ void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* htim_pwm) } +/** +* @brief TIM_Base MSP Initialization +* This function configures the hardware resources used in this example +* @param htim_base: TIM_Base handle pointer +* @retval None +*/ +void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base) +{ + if(htim_base->Instance==TIM11) + { + /* USER CODE BEGIN TIM11_MspInit 0 */ + + /* USER CODE END TIM11_MspInit 0 */ + /* Peripheral clock enable */ + __HAL_RCC_TIM11_CLK_ENABLE(); + /* USER CODE BEGIN TIM11_MspInit 1 */ + + /* USER CODE END TIM11_MspInit 1 */ + } + +} + void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim) { GPIO_InitTypeDef GPIO_InitStruct = {0}; @@ -375,6 +397,28 @@ void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* htim_pwm) } +/** +* @brief TIM_Base MSP De-Initialization +* This function freeze the hardware resources used in this example +* @param htim_base: TIM_Base handle pointer +* @retval None +*/ +void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base) +{ + if(htim_base->Instance==TIM11) + { + /* USER CODE BEGIN TIM11_MspDeInit 0 */ + + /* USER CODE END TIM11_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_TIM11_CLK_DISABLE(); + /* USER CODE BEGIN TIM11_MspDeInit 1 */ + + /* USER CODE END TIM11_MspDeInit 1 */ + } + +} + /** * @brief UART MSP Initialization * This function configures the hardware resources used in this example diff --git a/bsp/stm32/stm32f401-st-nucleo/board/Kconfig b/bsp/stm32/stm32f401-st-nucleo/board/Kconfig index bc1f2d76e7..01bf63c483 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/Kconfig +++ b/bsp/stm32/stm32f401-st-nucleo/board/Kconfig @@ -19,6 +19,8 @@ menu "Onboard Peripheral Drivers" select PKG_USING_RTDUINO select BSP_USING_STLINK_TO_USART select BSP_USING_GPIO + select BSP_USING_TIM + select BSP_USING_TIM11 select BSP_USING_ADC select BSP_USING_ADC1 select BSP_USING_PWM @@ -72,6 +74,16 @@ menu "On-chip Peripheral Drivers" default n endif + menuconfig BSP_USING_TIM + bool "Enable timer" + default n + select RT_USING_HWTIMER + if BSP_USING_TIM + config BSP_USING_TIM11 + bool "Enable TIM11" + default n + endif + menuconfig BSP_USING_PWM bool "Enable PWM" default n diff --git a/bsp/stm32/stm32l475-atk-pandora/board/Kconfig b/bsp/stm32/stm32l475-atk-pandora/board/Kconfig index 74a083a0fa..271a804219 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/Kconfig +++ b/bsp/stm32/stm32l475-atk-pandora/board/Kconfig @@ -24,6 +24,8 @@ menu "Onboard Peripheral Drivers" select PKG_USING_RTDUINO select BSP_USING_STLINK_TO_USART select BSP_USING_GPIO + select BSP_USING_TIM + select BSP_USING_TIM7 select BSP_USING_PWM select BSP_USING_PWM1 select BSP_USING_PWM1_CH1 @@ -44,8 +46,6 @@ menu "Onboard Peripheral Drivers" select BSP_USING_DAC1 select BSP_USING_SPI select BSP_USING_SPI2 - select BSP_USING_TIM - select BSP_USING_TIM7 imply BSP_SPI2_TX_USING_DMA imply BSP_SPI2_RX_USING_DMA imply RTDUINO_USING_SERVO