Browse Source

Fix STM401/4xx/STM32F7xx timers, STEVAL_3DP001V1 warning (#16621)

Bob Kuhn 4 years ago
parent
commit
1a5cbc9052

+ 29
- 5
Marlin/src/HAL/HAL_STM32/timers.h View File

@@ -57,9 +57,9 @@
57 57
     #define TEMP_TIMER 2
58 58
   #endif
59 59
 
60
-#elif defined(STM32F4xx) || defined(STM32F7xx)
60
+#elif defined(STM32F401xC) || defined(STM32F401xE)
61 61
 
62
-  #define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals
62
+  #define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals
63 63
 
64 64
   // STM32F401 only has timers 1-5 & 9-11 with timers 4 & 5 usually assigned to TIMER_SERVO and TIMER_TONE
65 65
 
@@ -71,6 +71,30 @@
71 71
     #define TEMP_TIMER 10
72 72
   #endif
73 73
 
74
+#elif defined(STM32F4xx)
75
+
76
+  #define HAL_TIMER_RATE (F_CPU / 2) // frequency of timer peripherals
77
+
78
+  #ifndef STEP_TIMER
79
+    #define STEP_TIMER 6
80
+  #endif
81
+
82
+  #ifndef TEMP_TIMER
83
+    #define TEMP_TIMER 14
84
+  #endif
85
+
86
+#elif defined(STM32F7xx)
87
+
88
+  #define HAL_TIMER_RATE (F_CPU/2) // frequency of timer peripherals
89
+
90
+  #ifndef STEP_TIMER
91
+    #define STEP_TIMER 6
92
+  #endif
93
+
94
+  #ifndef TEMP_TIMER
95
+    #define TEMP_TIMER 14
96
+  #endif
97
+
74 98
 #endif
75 99
 
76 100
 #ifndef SWSERIAL_TIMER_IRQ_PRIO
@@ -82,16 +106,16 @@
82 106
 #endif
83 107
 
84 108
 #ifndef TEMP_TIMER_IRQ_PRIO
85
-  #define TEMP_TIMER_IRQ_PRIO 14 //14 = after hardware ISRs
109
+  #define TEMP_TIMER_IRQ_PRIO 14   // 14 = after hardware ISRs
86 110
 #endif
87 111
 
88 112
 #define STEP_TIMER_NUM 0  // index of timer to use for stepper
89 113
 #define TEMP_TIMER_NUM 1  // index of timer to use for temperature
90 114
 #define PULSE_TIMER_NUM STEP_TIMER_NUM
91 115
 
92
-#define TEMP_TIMER_FREQUENCY 1000 //Temperature::isr() is expected to be called at around 1kHz
116
+#define TEMP_TIMER_FREQUENCY 1000   // Temperature::isr() is expected to be called at around 1kHz
93 117
 
94
-//TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
118
+// TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
95 119
 #define STEPPER_TIMER_RATE 2000000 // 2 Mhz
96 120
 #define STEPPER_TIMER_PRESCALE ((HAL_TIMER_RATE)/(STEPPER_TIMER_RATE))
97 121
 #define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs

+ 0
- 2
Marlin/src/pins/stm32/pins_STEVAL_3DP001V1.h View File

@@ -48,8 +48,6 @@
48 48
   #define MACHINE_NAME "STEVAL-3DP001V1"
49 49
 #endif
50 50
 
51
-#define TIMER_TONE  5
52
-
53 51
 //
54 52
 // Limit Switches
55 53
 //

+ 1
- 0
buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h View File

@@ -200,6 +200,7 @@ extern "C" {
200 200
 
201 201
 // Timer Definitions
202 202
 #define TIMER_SERVO             TIM4  // TIMER_SERVO must be defined in this file
203
+#define TIMER_TONE              TIM5  // TIMER_TONE must be defined in this file
203 204
 
204 205
 /* SD detect signal */
205 206
 /*

Loading…
Cancel
Save