diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig index 26b36d0a..37e07443 100644 --- a/src/stm32/Kconfig +++ b/src/stm32/Kconfig @@ -34,21 +34,26 @@ choice config MACH_STM32F401 bool "STM32F401" select MACH_STM32F4 + select HAVE_GPIO_HARD_PWM config MACH_STM32F405 bool "STM32F405" select MACH_STM32F4 select MACH_STM32F4x5 + select HAVE_GPIO_HARD_PWM config MACH_STM32F407 bool "STM32F407" select MACH_STM32F4 select MACH_STM32F4x5 + select HAVE_GPIO_HARD_PWM config MACH_STM32F429 bool "STM32F429" select MACH_STM32F4 select MACH_STM32F4x5 + select HAVE_GPIO_HARD_PWM config MACH_STM32F446 bool "STM32F446" select MACH_STM32F4 + select HAVE_GPIO_HARD_PWM config MACH_STM32F031 bool "STM32F031" select MACH_STM32F0 diff --git a/src/stm32/hard_pwm.c b/src/stm32/hard_pwm.c index d61ba5ce..bc52e3ac 100644 --- a/src/stm32/hard_pwm.c +++ b/src/stm32/hard_pwm.c @@ -62,7 +62,8 @@ static const struct gpio_pwm_info pwm_regs[] = { {TIM16, GPIO('B', 8), 1, GPIO_FUNCTION(1)}, {TIM17, GPIO('F', 7), 1, GPIO_FUNCTION(1)}, {TIM17, GPIO('B', 9), 1, GPIO_FUNCTION(1)} -#else +#endif +#if CONFIG_MACH_STM32F103 {TIM2, GPIO('A', 0), 1, GPIO_FUNCTION(2)}, {TIM2, GPIO('A', 1), 2, GPIO_FUNCTION(2)}, {TIM2, GPIO('A', 2), 3, GPIO_FUNCTION(2)}, @@ -88,6 +89,66 @@ static const struct gpio_pwm_info pwm_regs[] = { {TIM4, GPIO('B', 8), 3, GPIO_FUNCTION(2)}, {TIM4, GPIO('B', 9), 4, GPIO_FUNCTION(2)} #endif +#if CONFIG_MACH_STM32F401 + {TIM3, GPIO('A', 6), 1, GPIO_FUNCTION(2)}, + {TIM3, GPIO('C', 6), 1, GPIO_FUNCTION(3)}, + {TIM3, GPIO('A', 7), 2, GPIO_FUNCTION(2)}, + {TIM3, GPIO('C', 7), 2, GPIO_FUNCTION(3)}, + {TIM3, GPIO('C', 8), 3, GPIO_FUNCTION(3)}, + {TIM3, GPIO('C', 9), 4, GPIO_FUNCTION(3)}, +#endif +#if CONFIG_MACH_STM32F446 + {TIM2, GPIO('B', 2), 4, GPIO_FUNCTION(1)}, +#endif +#if CONFIG_MACH_STM32F405 || \ + CONFIG_MACH_STM32F407 || \ + CONFIG_MACH_STM32F429 || \ + CONFIG_MACH_STM32F446 + {TIM8, GPIO('C', 6), 1, GPIO_FUNCTION(3)}, + {TIM8, GPIO('C', 7), 2, GPIO_FUNCTION(3)}, + {TIM8, GPIO('C', 8), 3, GPIO_FUNCTION(3)}, + {TIM8, GPIO('C', 9), 4, GPIO_FUNCTION(3)}, + {TIM11, GPIO('F', 7), 1, GPIO_FUNCTION(3)}, + {TIM12, GPIO('B', 14), 1, GPIO_FUNCTION(9)}, + {TIM12, GPIO('B', 15), 2, GPIO_FUNCTION(9)}, + {TIM13, GPIO('A', 6), 1, GPIO_FUNCTION(9)}, + {TIM13, GPIO('F', 8), 1, GPIO_FUNCTION(9)}, + {TIM14, GPIO('A', 7), 1, GPIO_FUNCTION(9)}, + {TIM14, GPIO('F', 9), 1, GPIO_FUNCTION(9)}, +#endif +#if CONFIG_MACH_STM32F4 // Pins that map to all klipper defined STM32F4 procs + {TIM1, GPIO('A', 8), 1, GPIO_FUNCTION(1)}, + {TIM1, GPIO('E', 9), 1, GPIO_FUNCTION(1)}, + {TIM1, GPIO('A', 9), 2, GPIO_FUNCTION(1)}, + {TIM1, GPIO('E', 11), 2, GPIO_FUNCTION(1)}, + {TIM1, GPIO('A', 10), 3, GPIO_FUNCTION(1)}, + {TIM1, GPIO('E', 13), 3, GPIO_FUNCTION(1)}, + {TIM1, GPIO('A', 11), 4, GPIO_FUNCTION(1)}, + {TIM1, GPIO('E', 14), 4, GPIO_FUNCTION(1)}, + {TIM2, GPIO('A', 5), 1, GPIO_FUNCTION(1)}, + {TIM2, GPIO('A', 15), 1, GPIO_FUNCTION(1)}, + {TIM2, GPIO('B', 3), 2, GPIO_FUNCTION(1)}, + {TIM2, GPIO('B', 10), 3, GPIO_FUNCTION(1)}, + {TIM2, GPIO('B', 11), 4, GPIO_FUNCTION(1)}, + {TIM3, GPIO('B', 4), 1, GPIO_FUNCTION(2)}, + {TIM3, GPIO('B', 5), 2, GPIO_FUNCTION(2)}, + {TIM3, GPIO('B', 0), 3, GPIO_FUNCTION(2)}, + {TIM3, GPIO('B', 1), 4, GPIO_FUNCTION(2)}, + {TIM4, GPIO('B', 6), 1, GPIO_FUNCTION(2)}, + {TIM4, GPIO('D', 12), 1, GPIO_FUNCTION(2)}, + {TIM4, GPIO('B', 7), 2, GPIO_FUNCTION(2)}, + {TIM4, GPIO('D', 13), 2, GPIO_FUNCTION(2)}, + {TIM4, GPIO('D', 14), 3, GPIO_FUNCTION(2)}, + {TIM4, GPIO('D', 15), 4, GPIO_FUNCTION(2)}, + {TIM5, GPIO('A', 0), 1, GPIO_FUNCTION(2)}, + {TIM5, GPIO('A', 1), 2, GPIO_FUNCTION(2)}, + {TIM5, GPIO('A', 2), 3, GPIO_FUNCTION(2)}, + {TIM5, GPIO('A', 3), 4, GPIO_FUNCTION(2)}, + {TIM9, GPIO('E', 5), 1, GPIO_FUNCTION(3)}, + {TIM9, GPIO('E', 6), 2, GPIO_FUNCTION(3)}, + {TIM10, GPIO('B', 8), 1, GPIO_FUNCTION(3)}, + {TIM11, GPIO('B', 9), 1, GPIO_FUNCTION(3)} +#endif }; struct gpio_pwm