From f0ef8ada33833942684a6280314160de8c355302 Mon Sep 17 00:00:00 2001 From: Stanley Lwin <98496195+byte-me-stan@users.noreply.github.com> Date: Mon, 19 Dec 2022 22:20:20 -0800 Subject: [PATCH] [bsp] [stm32F401] Enable PA11 for TIM1_CH4 (#6756) --- .../board/CubeMX_Config/CubeMX_Config.ioc | 38 +++++++++++-------- .../CubeMX_Config/Src/stm32f4xx_hal_msp.c | 3 +- bsp/stm32/stm32f401-st-nucleo/board/Kconfig | 3 ++ 3 files changed, 27 insertions(+), 17 deletions(-) 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 fe0d72c771..9d721495b0 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 @@ -30,20 +30,21 @@ Mcu.Pin12=PB0 Mcu.Pin13=PB10 Mcu.Pin14=PC7 Mcu.Pin15=PA8 -Mcu.Pin16=PA13 -Mcu.Pin17=PA14 -Mcu.Pin18=PB3 -Mcu.Pin19=PB4 +Mcu.Pin16=PA11 +Mcu.Pin17=PA13 +Mcu.Pin18=PA14 +Mcu.Pin19=PB3 Mcu.Pin2=PH0 - OSC_IN -Mcu.Pin20=PB6 -Mcu.Pin21=VP_ADC1_TempSens_Input -Mcu.Pin22=VP_ADC1_Vref_Input -Mcu.Pin23=VP_SYS_VS_Systick -Mcu.Pin24=VP_TIM1_VS_ClockSourceINT -Mcu.Pin25=VP_TIM2_VS_ClockSourceINT -Mcu.Pin26=VP_TIM3_VS_ClockSourceINT -Mcu.Pin27=VP_TIM4_VS_ClockSourceINT -Mcu.Pin28=VP_TIM11_VS_ClockSourceINT +Mcu.Pin20=PB4 +Mcu.Pin21=PB6 +Mcu.Pin22=VP_ADC1_TempSens_Input +Mcu.Pin23=VP_ADC1_Vref_Input +Mcu.Pin24=VP_SYS_VS_Systick +Mcu.Pin25=VP_TIM1_VS_ClockSourceINT +Mcu.Pin26=VP_TIM2_VS_ClockSourceINT +Mcu.Pin27=VP_TIM3_VS_ClockSourceINT +Mcu.Pin28=VP_TIM4_VS_ClockSourceINT +Mcu.Pin29=VP_TIM11_VS_ClockSourceINT Mcu.Pin3=PH1 - OSC_OUT Mcu.Pin4=PC0 Mcu.Pin5=PC1 @@ -51,7 +52,7 @@ Mcu.Pin6=PA0-WKUP Mcu.Pin7=PA1 Mcu.Pin8=PA2 Mcu.Pin9=PA3 -Mcu.PinsNb=29 +Mcu.PinsNb=30 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F401RETx @@ -72,6 +73,8 @@ PA0-WKUP.Locked=true PA0-WKUP.Signal=ADCx_IN0 PA1.Locked=true PA1.Signal=ADCx_IN1 +PA11.Locked=true +PA11.Signal=S_TIM1_CH4 PA13.Mode=Serial_Wire PA13.Signal=SYS_JTMS-SWDIO PA14.Mode=Serial_Wire @@ -142,7 +145,7 @@ ProjectManager.StackSize=0x400 ProjectManager.TargetToolchain=MDK-ARM V5 ProjectManager.ToolChainLocation= ProjectManager.UnderRoot=false -ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_SPI1_Init-SPI1-false-HAL-true,5-MX_ADC1_Init-ADC1-false-HAL-true,6-MX_TIM2_Init-TIM2-false-HAL-true,7-MX_TIM3_Init-TIM3-false-HAL-true,8-MX_TIM11_Init-TIM11-false-HAL-true +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_TIM2_Init-TIM2-false-HAL-true,6-MX_TIM3_Init-TIM3-false-HAL-true,7-MX_TIM11_Init-TIM11-false-HAL-true,8-MX_TIM1_Init-TIM1-false-HAL-true,9-MX_TIM4_Init-TIM4-false-HAL-true RCC.48MHZClocksFreq_Value=84000000 RCC.AHBFreq_Value=84000000 RCC.APB1CLKDivider=RCC_HCLK_DIV2 @@ -185,6 +188,8 @@ SH.ADCx_IN8.0=ADC1_IN8,IN8 SH.ADCx_IN8.ConfNb=1 SH.S_TIM1_CH1.0=TIM1_CH1,Output Compare1 CH1 CH1N SH.S_TIM1_CH1.ConfNb=1 +SH.S_TIM1_CH4.0=TIM1_CH4,PWM Generation4 CH4 +SH.S_TIM1_CH4.ConfNb=1 SH.S_TIM2_CH2.0=TIM2_CH2,PWM Generation2 CH2 SH.S_TIM2_CH2.ConfNb=1 SH.S_TIM2_CH3.0=TIM2_CH3,PWM Generation3 CH3 @@ -196,7 +201,8 @@ SH.S_TIM3_CH2.ConfNb=1 SH.S_TIM4_CH1.0=TIM4_CH1,PWM Generation1 CH1 SH.S_TIM4_CH1.ConfNb=1 TIM1.Channel-Output\ Compare1\ CH1\ CH1N=TIM_CHANNEL_1 -TIM1.IPParameters=Channel-Output Compare1 CH1 CH1N +TIM1.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4 +TIM1.IPParameters=Channel-Output Compare1 CH1 CH1N,Channel-PWM Generation4 CH4 TIM2.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2 TIM2.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3 TIM2.IPParameters=Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3 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 0874be6c8e..f8ec72f6f6 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 @@ -264,8 +264,9 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim) /**TIM1 GPIO Configuration PA7 ------> TIM1_CH1N PA8 ------> TIM1_CH1 + PA11 ------> TIM1_CH4 */ - GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8; + GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_11; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; diff --git a/bsp/stm32/stm32f401-st-nucleo/board/Kconfig b/bsp/stm32/stm32f401-st-nucleo/board/Kconfig index f65701c5c8..915d47b653 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/Kconfig +++ b/bsp/stm32/stm32f401-st-nucleo/board/Kconfig @@ -95,6 +95,9 @@ menu "On-chip Peripheral Drivers" config BSP_USING_PWM1_CH1 bool "Enable PWM1 channel1" default n + config BSP_USING_PWM1_CH4 + bool "Enable PWM1 channel4" + default n endif menuconfig BSP_USING_PWM2