This commit is contained in:
Supper Thomas 2023-12-18 08:40:14 +08:00 committed by Meco Man
parent 0a1566661f
commit 6d1fdde1ff
4 changed files with 42 additions and 10 deletions

View File

@ -571,6 +571,16 @@ void TIM7_IRQHandler(void)
rt_interrupt_leave(); rt_interrupt_leave();
} }
#endif #endif
#ifdef BSP_USING_TIM8
void TIM8_UP_IRQHandler(void)
{
/* enter interrupt */
rt_interrupt_enter();
HAL_TIM_IRQHandler(&stm32_hwtimer_obj[TIM8_INDEX].tim_handle);
/* leave interrupt */
rt_interrupt_leave();
}
#endif
#ifdef BSP_USING_TIM11 #ifdef BSP_USING_TIM11
void TIM1_TRG_COM_TIM11_IRQHandler(void) void TIM1_TRG_COM_TIM11_IRQHandler(void)
{ {
@ -682,6 +692,12 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
rt_device_hwtimer_isr(&stm32_hwtimer_obj[TIM7_INDEX].time_device); rt_device_hwtimer_isr(&stm32_hwtimer_obj[TIM7_INDEX].time_device);
} }
#endif #endif
#ifdef BSP_USING_TIM8
if (htim->Instance == TIM8)
{
rt_device_hwtimer_isr(&stm32_hwtimer_obj[TIM8_INDEX].time_device);
}
#endif
#ifdef BSP_USING_TIM11 #ifdef BSP_USING_TIM11
if (htim->Instance == TIM11) if (htim->Instance == TIM11)
{ {

View File

@ -11,15 +11,16 @@ Mcu.CPN=STM32G491RET6
Mcu.Family=STM32G4 Mcu.Family=STM32G4
Mcu.IP0=IWDG Mcu.IP0=IWDG
Mcu.IP1=LPUART1 Mcu.IP1=LPUART1
Mcu.IP10=TIM17
Mcu.IP2=NVIC Mcu.IP2=NVIC
Mcu.IP3=RCC Mcu.IP3=RCC
Mcu.IP4=RTC Mcu.IP4=RTC
Mcu.IP5=SYS Mcu.IP5=SYS
Mcu.IP6=TIM7 Mcu.IP6=TIM7
Mcu.IP7=TIM15 Mcu.IP7=TIM8
Mcu.IP8=TIM16 Mcu.IP8=TIM15
Mcu.IP9=TIM17 Mcu.IP9=TIM16
Mcu.IPNb=10 Mcu.IPNb=11
Mcu.Name=STM32G491R(C-E)Tx Mcu.Name=STM32G491R(C-E)Tx
Mcu.Package=LQFP64 Mcu.Package=LQFP64
Mcu.Pin0=PC13 Mcu.Pin0=PC13
@ -30,9 +31,10 @@ Mcu.Pin12=VP_RTC_VS_RTC_Activate
Mcu.Pin13=VP_SYS_VS_Systick Mcu.Pin13=VP_SYS_VS_Systick
Mcu.Pin14=VP_SYS_VS_DBSignals Mcu.Pin14=VP_SYS_VS_DBSignals
Mcu.Pin15=VP_TIM7_VS_ClockSourceINT Mcu.Pin15=VP_TIM7_VS_ClockSourceINT
Mcu.Pin16=VP_TIM15_VS_ClockSourceINT Mcu.Pin16=VP_TIM8_VS_ClockSourceINT
Mcu.Pin17=VP_TIM16_VS_ClockSourceINT Mcu.Pin17=VP_TIM15_VS_ClockSourceINT
Mcu.Pin18=VP_TIM17_VS_ClockSourceINT Mcu.Pin18=VP_TIM16_VS_ClockSourceINT
Mcu.Pin19=VP_TIM17_VS_ClockSourceINT
Mcu.Pin2=PC15-OSC32_OUT Mcu.Pin2=PC15-OSC32_OUT
Mcu.Pin3=PF0-OSC_IN Mcu.Pin3=PF0-OSC_IN
Mcu.Pin4=PF1-OSC_OUT Mcu.Pin4=PF1-OSC_OUT
@ -41,7 +43,7 @@ Mcu.Pin6=PA3
Mcu.Pin7=PA5 Mcu.Pin7=PA5
Mcu.Pin8=PA13 Mcu.Pin8=PA13
Mcu.Pin9=PA14 Mcu.Pin9=PA14
Mcu.PinsNb=19 Mcu.PinsNb=20
Mcu.ThirdPartyNb=0 Mcu.ThirdPartyNb=0
Mcu.UserConstants= Mcu.UserConstants=
Mcu.UserName=STM32G491RETx Mcu.UserName=STM32G491RETx
@ -187,6 +189,9 @@ RCC.VCOInputFreq_Value=4000000
RCC.VCOOutputFreq_Value=340000000 RCC.VCOOutputFreq_Value=340000000
SH.GPXTI13.0=GPIO_EXTI13 SH.GPXTI13.0=GPIO_EXTI13
SH.GPXTI13.ConfNb=1 SH.GPXTI13.ConfNb=1
TIM8.IPParameters=Prescaler,PeriodNoDither
TIM8.PeriodNoDither=10625-1
TIM8.Prescaler=16-1
VP_IWDG_VS_IWDG.Mode=IWDG_Activate VP_IWDG_VS_IWDG.Mode=IWDG_Activate
VP_IWDG_VS_IWDG.Signal=IWDG_VS_IWDG VP_IWDG_VS_IWDG.Signal=IWDG_VS_IWDG
VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled
@ -203,5 +208,7 @@ VP_TIM17_VS_ClockSourceINT.Mode=Enable_Timer
VP_TIM17_VS_ClockSourceINT.Signal=TIM17_VS_ClockSourceINT VP_TIM17_VS_ClockSourceINT.Signal=TIM17_VS_ClockSourceINT
VP_TIM7_VS_ClockSourceINT.Mode=Enable_Timer VP_TIM7_VS_ClockSourceINT.Mode=Enable_Timer
VP_TIM7_VS_ClockSourceINT.Signal=TIM7_VS_ClockSourceINT VP_TIM7_VS_ClockSourceINT.Signal=TIM7_VS_ClockSourceINT
VP_TIM8_VS_ClockSourceINT.Mode=Internal
VP_TIM8_VS_ClockSourceINT.Signal=TIM8_VS_ClockSourceINT
board=NUCLEO-G491RE board=NUCLEO-G491RE
boardIOC=true boardIOC=true

View File

@ -163,7 +163,9 @@ menu "On-chip Peripheral Drivers"
config BSP_USING_TIM7 config BSP_USING_TIM7
bool "Enable TIM7" bool "Enable TIM7"
default n default n
config BSP_USING_TIM8
bool "Enable TIM8"
default n
config BSP_USING_TIM15 config BSP_USING_TIM15
bool "Enable TIM15" bool "Enable TIM15"
default n default n

View File

@ -20,10 +20,17 @@ void SystemClock_Config(void)
*/ */
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST); HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST);
/** Configure LSE Drive Capability
*/
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
/** Initializes the RCC Oscillators according to the specified parameters /** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure. * in the RCC_OscInitTypeDef structure.
*/ */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI; RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI
|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.LSIState = RCC_LSI_ON; RCC_OscInitStruct.LSIState = RCC_LSI_ON;