Browse Source

Allow STM32 HAL_TIMER_RATE override (#18374)

vanilla_fb_2.0.x
Chris Barr 4 years ago
committed by GitHub
parent
commit
900d4cf8e7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      Marlin/src/HAL/STM32/timers.cpp
  2. 1
      Marlin/src/pins/stm32f4/pins_RUMBA32_common.h

11
Marlin/src/HAL/STM32/timers.cpp

@ -44,23 +44,26 @@
#endif #endif
#ifdef STM32F0xx #ifdef STM32F0xx
#define HAL_TIMER_RATE (F_CPU) // Frequency of timer peripherals #define MCU_TIMER_RATE (F_CPU) // Frequency of timer peripherals
#define MCU_STEP_TIMER 16 #define MCU_STEP_TIMER 16
#define MCU_TEMP_TIMER 17 #define MCU_TEMP_TIMER 17
#elif defined(STM32F1xx) #elif defined(STM32F1xx)
#define HAL_TIMER_RATE (F_CPU) #define MCU_TIMER_RATE (F_CPU)
#define MCU_STEP_TIMER 4 #define MCU_STEP_TIMER 4
#define MCU_TEMP_TIMER 2 #define MCU_TEMP_TIMER 2
#elif defined(STM32F401xC) || defined(STM32F401xE) #elif defined(STM32F401xC) || defined(STM32F401xE)
#define HAL_TIMER_RATE (F_CPU / 2) #define MCU_TIMER_RATE (F_CPU / 2)
#define MCU_STEP_TIMER 9 #define MCU_STEP_TIMER 9
#define MCU_TEMP_TIMER 10 #define MCU_TEMP_TIMER 10
#elif defined(STM32F4xx) || defined(STM32F7xx) #elif defined(STM32F4xx) || defined(STM32F7xx)
#define HAL_TIMER_RATE (F_CPU / 2) #define MCU_TIMER_RATE (F_CPU / 2)
#define MCU_STEP_TIMER 6 // STM32F401 has no TIM6, TIM7, or TIM8 #define MCU_STEP_TIMER 6 // STM32F401 has no TIM6, TIM7, or TIM8
#define MCU_TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used. #define MCU_TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used.
#endif #endif
#ifndef HAL_TIMER_RATE
#define HAL_TIMER_RATE MCU_TIMER_RATE
#endif
#ifndef STEP_TIMER #ifndef STEP_TIMER
#define STEP_TIMER MCU_STEP_TIMER #define STEP_TIMER MCU_STEP_TIMER
#endif #endif

1
Marlin/src/pins/stm32f4/pins_RUMBA32_common.h

@ -47,6 +47,7 @@
#define STEP_TIMER 10 #define STEP_TIMER 10
#define TEMP_TIMER 14 #define TEMP_TIMER 14
#define TIMER_SERIAL TIM9 #define TIMER_SERIAL TIM9
#define HAL_TIMER_RATE F_CPU
// //
// Limit Switches // Limit Switches

Loading…
Cancel
Save