Browse Source

SAMD51: More reliable Servo/BLTouch PWM (#18710)

Giuliano Zaro 5 years ago
parent
commit
c6233b1ea8
No account linked to committer's email address
2 changed files with 6 additions and 3 deletions
  1. 3
    1
      Marlin/src/HAL/SAMD51/timers.cpp
  2. 3
    2
      Marlin/src/HAL/SAMD51/timers.h

+ 3
- 1
Marlin/src/HAL/SAMD51/timers.cpp View File

23
 // --------------------------------------------------------------------------
23
 // --------------------------------------------------------------------------
24
 // Includes
24
 // Includes
25
 // --------------------------------------------------------------------------
25
 // --------------------------------------------------------------------------
26
+
26
 #include "../../inc/MarlinConfig.h"
27
 #include "../../inc/MarlinConfig.h"
28
+#include "ServoTimers.h" // for SERVO_TC
27
 
29
 
28
 // --------------------------------------------------------------------------
30
 // --------------------------------------------------------------------------
29
 // Local defines
31
 // Local defines
39
   { {.pTc=TC0},  TC0_IRQn, TC_PRIORITY(0) },  // 0 - stepper (assigned priority 2)
41
   { {.pTc=TC0},  TC0_IRQn, TC_PRIORITY(0) },  // 0 - stepper (assigned priority 2)
40
   { {.pTc=TC1},  TC1_IRQn, TC_PRIORITY(1) },  // 1 - stepper (needed by 32 bit timers)
42
   { {.pTc=TC1},  TC1_IRQn, TC_PRIORITY(1) },  // 1 - stepper (needed by 32 bit timers)
41
   { {.pTc=TC2},  TC2_IRQn, 5              },  // 2 - tone (reserved by framework and fixed assigned priority 5)
43
   { {.pTc=TC2},  TC2_IRQn, 5              },  // 2 - tone (reserved by framework and fixed assigned priority 5)
42
-  { {.pTc=TC3},  TC3_IRQn, TC_PRIORITY(3) },  // 3 - servo (no interrupts used)
44
+  { {.pTc=TC3},  TC3_IRQn, TC_PRIORITY(3) },  // 3 - servo (assigned priority 1)
43
   { {.pTc=TC4},  TC4_IRQn, TC_PRIORITY(4) },  // 4 - software serial (no interrupts used)
45
   { {.pTc=TC4},  TC4_IRQn, TC_PRIORITY(4) },  // 4 - software serial (no interrupts used)
44
   { {.pTc=TC5},  TC5_IRQn, TC_PRIORITY(5) },
46
   { {.pTc=TC5},  TC5_IRQn, TC_PRIORITY(5) },
45
   { {.pTc=TC6},  TC6_IRQn, TC_PRIORITY(6) },
47
   { {.pTc=TC6},  TC6_IRQn, TC_PRIORITY(6) },

+ 3
- 2
Marlin/src/HAL/SAMD51/timers.h View File

59
 #define ENABLE_TEMPERATURE_INTERRUPT()  HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
59
 #define ENABLE_TEMPERATURE_INTERRUPT()  HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
60
 #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
60
 #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
61
 
61
 
62
-#define TC_PRIORITY(t)        (t == STEP_TIMER_NUM || t == PULSE_TIMER_NUM) ? 2   \
63
-                               : (t == TEMP_TIMER_NUM) ? 6                        \
62
+#define TC_PRIORITY(t)        t == SERVO_TC ? 1                                     \
63
+                               : (t == STEP_TIMER_NUM || t == PULSE_TIMER_NUM) ? 2  \
64
+                               : (t == TEMP_TIMER_NUM) ? 6                          \
64
                                : 7
65
                                : 7
65
 
66
 
66
 #define _TC_HANDLER(t)          void TC##t##_Handler()
67
 #define _TC_HANDLER(t)          void TC##t##_Handler()

Loading…
Cancel
Save