Browse Source

[2.0.x] Correct step pulse width on LPC1768, DUE & Teensy35_36 (#10016)

Bob-the-Kuhn 6 years ago
parent
commit
3c58ca181c

+ 1
- 1
Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h View File

48
 #define TONE_TIMER_NUM 6  // index of timer to use for beeper tones
48
 #define TONE_TIMER_NUM 6  // index of timer to use for beeper tones
49
 
49
 
50
 #define HAL_TIMER_RATE         ((F_CPU) / 2)    // frequency of timers peripherals
50
 #define HAL_TIMER_RATE         ((F_CPU) / 2)    // frequency of timers peripherals
51
-#define STEPPER_TIMER_PRESCALE 1.0              // prescaler for setting stepper frequency
51
+#define STEPPER_TIMER_PRESCALE (CYCLES_PER_MICROSECOND / HAL_TICKS_PER_US)
52
 #define HAL_STEPPER_TIMER_RATE HAL_TIMER_RATE   // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
52
 #define HAL_STEPPER_TIMER_RATE HAL_TIMER_RATE   // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
53
 #define HAL_TICKS_PER_US       ((HAL_STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
53
 #define HAL_TICKS_PER_US       ((HAL_STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
54
 
54
 

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/HAL_timers.h View File

47
 #define TEMP_TIMER_NUM 1  // index of timer to use for temperature
47
 #define TEMP_TIMER_NUM 1  // index of timer to use for temperature
48
 
48
 
49
 #define HAL_TIMER_RATE         ((SystemCoreClock) / 4)  // frequency of timers peripherals
49
 #define HAL_TIMER_RATE         ((SystemCoreClock) / 4)  // frequency of timers peripherals
50
-#define STEPPER_TIMER_PRESCALE 1.0              // prescaler for setting stepper frequency
50
+#define STEPPER_TIMER_PRESCALE (CYCLES_PER_MICROSECOND / HAL_TICKS_PER_US)
51
 #define HAL_STEPPER_TIMER_RATE HAL_TIMER_RATE   // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
51
 #define HAL_STEPPER_TIMER_RATE HAL_TIMER_RATE   // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
52
 #define HAL_TICKS_PER_US       ((HAL_STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
52
 #define HAL_TICKS_PER_US       ((HAL_STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
53
 #define HAL_TEMP_TIMER_RATE    1000000
53
 #define HAL_TEMP_TIMER_RATE    1000000

+ 1
- 1
Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h View File

55
 #define FTM1_TIMER_RATE (F_BUS / FTM1_TIMER_PRESCALE) // 60MHz / 4 = 15MHz
55
 #define FTM1_TIMER_RATE (F_BUS / FTM1_TIMER_PRESCALE) // 60MHz / 4 = 15MHz
56
 
56
 
57
 #define STEPPER_TIMER STEP_TIMER_NUM // Alias?
57
 #define STEPPER_TIMER STEP_TIMER_NUM // Alias?
58
-#define STEPPER_TIMER_PRESCALE 0 // Not defined anywhere else!
58
+#define STEPPER_TIMER_PRESCALE (CYCLES_PER_MICROSECOND / HAL_TICKS_PER_US)
59
 
59
 
60
 #define PULSE_TIMER_NUM STEP_TIMER_NUM
60
 #define PULSE_TIMER_NUM STEP_TIMER_NUM
61
 #define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
61
 #define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE

Loading…
Cancel
Save