浏览代码

[2.0.x] Multiple updates to STM32F1 HAL (#8733)

* STM32F1 HAL

Adding files for STM32F1 HAL based on libmaple/stm32duino core.
Current persistent_store uses cardreader changes to be sent in separate
commit, but could be changed to use i2c eeprom.
There is another persistent_store implementation that uses the MCU flash memory
to emulate eeprom
Adding readme with some information about the stm32 HAL.

* Switch to Timer4 to avoid a hard reset on STM32F103C6 boards

On bluepill STM32F103C6 boards, using Timer5 results in a error() vector call. Switch to 4 since these are both general purpose, 16 bit timers.

* Add support for EEPROM emulation using Flash

Some low end machines doe not have EEPROM support. Simulate it using the last two pages of flash. Flash does not allow rewrite between erases, so skip writing the working version if that's enabled.

* Basic Pins for a malyan M200

This is a work in progress to go hand in hand with the STM32 work.

* Add support for ADC with DMA. This work has exposed a problem with the pin enumerations in STM boards vs what marlin expects (i.e, try defining PA0 as a temp pin). The hack can be removed with we go to fastio completely. To see this work, set something in adc_pins to a value like PA0 and connect your pullup resistor'd thermistor.

* Missing file - change HAL_adc_init to actually do something

We have an actual ADC init function now.

* Remove pinmode hack

Remove the pin mode hack that I was using to init PA0.

Updated Readme.md

* Several changes to timers and GPIO

Faster GPIO, and faster timer functions by accesing registers and
libmaple.
Still more changes pending for the Timer's code to skip using the
HardwareTimer class altogether.

Switch all enums to be within #defines

This change allows a user to have, for instance, TEMP_4 and TEMP_BED definied but nothing else. The enums which are not defined move "out", allowing the first ones to take the slots in the enum, and since the array is sized on ADC_PIN_COUNT, we always have the right size data and in order.

* Update Malyan M200 pins

Update Malyan M200 pins with correct fan values.

* Test all pins on actual hardware, update definitions

Some of the pin definitions were from knowlege base/pdfs. Now they've been tested against actual hardware. This should be very close to final.

* Update HAL_timers_Stm32f1.cpp

* Add sample configurations for Malyan M200

Add sample configuration for Malyan M200 without bed leveling, and move fan to auto cool E0 since this printer by default has only one fan.


Choose the timer based on MCU defintion. Timer5 is not valid on C8/CB class boards, so use Timer4 for the step timer.


readme.md update

* Updates to timers, and some stm32 boards definitiions

* Correct pin toggle macro.

* Remove duplicated Malyan M200 entry from pins.h

* Update configuration_store.cpp

* Formatting, indentation

* Formatting in HAL_Stm32f1.cpp
victorpv 7 年前
父节点
当前提交
a5150c83a2

+ 65
- 1
Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.cpp 查看文件

@@ -32,6 +32,7 @@
32 32
 // --------------------------------------------------------------------------
33 33
 
34 34
 #include "../HAL.h"
35
+#include <STM32ADC.h>
35 36
 
36 37
 //#include <Wire.h>
37 38
 
@@ -60,6 +61,45 @@ uint16_t HAL_adc_result;
60 61
 // --------------------------------------------------------------------------
61 62
 // Private Variables
62 63
 // --------------------------------------------------------------------------
64
+STM32ADC adc(ADC1);
65
+
66
+uint8 adc_pins[] = {
67
+  #if HAS_TEMP_0
68
+    TEMP_0_PIN,
69
+  #endif
70
+  #if HAS_TEMP_1
71
+    TEMP_1_PIN
72
+  #endif
73
+  #if HAS_TEMP_2
74
+    TEMP_2_PIN,
75
+  #endif
76
+  #if HAS_TEMP_3
77
+    TEMP_3_PIN,
78
+  #endif
79
+  #if HAS_TEMP_4
80
+    TEMP_4_PIN,
81
+  #endif
82
+  #if HAS_TEMP_BED
83
+    TEMP_BED_PIN,
84
+  #endif
85
+  #if ENABLED(FILAMENT_WIDTH_SENSOR)
86
+    FILWIDTH_PIN,
87
+  #endif
88
+};
89
+
90
+enum TEMP_PINS {
91
+  TEMP_0,
92
+  TEMP_1,
93
+  TEMP_2,
94
+  TEMP_3,
95
+  TEMP_4,
96
+  TEMP_BED,
97
+  FILWIDTH
98
+};
99
+
100
+#define ADC_PIN_COUNT (sizeof(adc_pins)/sizeof(adc_pins[0]))
101
+uint16_t HAL_adc_results[ADC_PIN_COUNT];
102
+
63 103
 
64 104
 // --------------------------------------------------------------------------
65 105
 // Function prototypes
@@ -126,9 +166,33 @@ extern "C" {
126 166
 // --------------------------------------------------------------------------
127 167
 // ADC
128 168
 // --------------------------------------------------------------------------
169
+// Init the AD in continuous capture mode
170
+void HAL_adc_init(void) {
171
+  // configure the ADC
172
+  adc.calibrate();
173
+  adc.setSampleRate(ADC_SMPR_41_5); // ?
174
+  adc.setPins(adc_pins, ADC_PIN_COUNT);
175
+  adc.setDMA(HAL_adc_results, (uint16_t)ADC_PIN_COUNT, (uint32_t)(DMA_MINC_MODE | DMA_CIRC_MODE), (void (*)())NULL);
176
+  adc.setScanMode();
177
+  adc.setContinuous();
178
+  adc.startConversion();
179
+}
129 180
 
130 181
 void HAL_adc_start_conversion(const uint8_t adc_pin) {
131
-  HAL_adc_result = (analogRead(adc_pin) >> 2) & 0x3ff; // shift to get 10 bits only.
182
+  TEMP_PINS pin_index;
183
+  switch (adc_pin) {
184
+    default:
185
+    case TEMP_0_PIN: pin_index = TEMP_0; break;
186
+    case TEMP_1_PIN: pin_index = TEMP_1; break;
187
+    case TEMP_2_PIN: pin_index = TEMP_2; break;
188
+    case TEMP_3_PIN: pin_index = TEMP_3; break;
189
+    case TEMP_4_PIN: pin_index = TEMP_4; break;
190
+    case TEMP_BED_PIN: pin_index = TEMP_BED; break;
191
+    #if ENABLED(FILAMENT_WIDTH_SENSOR)
192
+      case FILWIDTH_PIN: pin_index = FILWIDTH; break;
193
+    #endif
194
+  }
195
+  HAL_adc_result = (HAL_adc_results[(int)pin_index] >> 2) & 0x3FF; // shift to get 10 bits only.
132 196
 }
133 197
 
134 198
 uint16_t HAL_adc_get_result(void) {

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h 查看文件

@@ -183,7 +183,7 @@ void eeprom_update_block (const void *__src, void *__dst, size_t __n);
183 183
 
184 184
 #define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT_ANALOG);
185 185
 
186
-inline void HAL_adc_init(void) {}
186
+void HAL_adc_init(void);
187 187
 
188 188
 #define HAL_START_ADC(pin)  HAL_adc_start_conversion(pin)
189 189
 #define HAL_READ_ADC        HAL_adc_result

+ 20
- 18
Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp 查看文件

@@ -96,22 +96,24 @@ Timer_clock4: Prescaler 128 -> 656.25kHz
96 96
 void HAL_timer_start(uint8_t timer_num, uint32_t frequency) {
97 97
   switch (timer_num) {
98 98
     case STEP_TIMER_NUM:
99
-      StepperTimer.pause();
100
-      StepperTimer.setCount(0);
101
-      StepperTimer.setPrescaleFactor(STEPPER_TIMER_PRESCALE);
102
-      StepperTimer.setOverflow(0xFFFF);
103
-      StepperTimer.setCompare(STEP_TIMER_CHAN, uint32_t(HAL_STEPPER_TIMER_RATE) / frequency);
104
-      StepperTimer.refresh();
105
-      StepperTimer.resume();
99
+      timer_pause(STEP_TIMER_DEV);
100
+      timer_set_count(STEP_TIMER_DEV, 0);
101
+      timer_set_prescaler(STEP_TIMER_DEV, (uint16)(STEPPER_TIMER_PRESCALE - 1));
102
+      timer_set_reload(STEP_TIMER_DEV, 0xFFFF);
103
+      timer_set_compare(STEP_TIMER_DEV, STEP_TIMER_CHAN, min(HAL_TIMER_TYPE_MAX, (HAL_STEPPER_TIMER_RATE / frequency)));
104
+      timer_attach_interrupt(STEP_TIMER_DEV, STEP_TIMER_CHAN, stepTC_Handler);
105
+      timer_generate_update(STEP_TIMER_DEV);
106
+      timer_resume(STEP_TIMER_DEV);
106 107
       break;
107 108
     case TEMP_TIMER_NUM:
108
-      TempTimer.pause();
109
-      TempTimer.setCount(0);
110
-      TempTimer.setPrescaleFactor(TEMP_TIMER_PRESCALE);
111
-      TempTimer.setOverflow(0xFFFF);
112
-      TempTimer.setCompare(TEMP_TIMER_CHAN, (F_CPU) / (TEMP_TIMER_PRESCALE) / frequency);
113
-      TempTimer.refresh();
114
-      TempTimer.resume();
109
+      timer_pause(TEMP_TIMER_DEV);
110
+      timer_set_count(TEMP_TIMER_DEV, 0);
111
+      timer_set_prescaler(TEMP_TIMER_DEV, (uint16)(TEMP_TIMER_PRESCALE - 1));
112
+      timer_set_reload(TEMP_TIMER_DEV, 0xFFFF);
113
+      timer_set_compare(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, min(HAL_TIMER_TYPE_MAX, ((F_CPU / TEMP_TIMER_PRESCALE) / frequency)));
114
+      timer_attach_interrupt(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, tempTC_Handler);
115
+      timer_generate_update(TEMP_TIMER_DEV);
116
+      timer_resume(TEMP_TIMER_DEV);
115 117
       break;
116 118
   }
117 119
 }
@@ -119,10 +121,10 @@ void HAL_timer_start(uint8_t timer_num, uint32_t frequency) {
119 121
 void HAL_timer_enable_interrupt(uint8_t timer_num) {
120 122
   switch (timer_num) {
121 123
     case STEP_TIMER_NUM:
122
-      StepperTimer.attachInterrupt(STEP_TIMER_CHAN, stepTC_Handler);
124
+      timer_enable_irq(STEP_TIMER_DEV, STEP_TIMER_CHAN);
123 125
       break;
124 126
     case TEMP_TIMER_NUM:
125
-      TempTimer.attachInterrupt(STEP_TIMER_CHAN, tempTC_Handler);
127
+      timer_enable_irq(TEMP_TIMER_DEV, TEMP_TIMER_CHAN);
126 128
       break;
127 129
     default:
128 130
       break;
@@ -132,10 +134,10 @@ void HAL_timer_enable_interrupt(uint8_t timer_num) {
132 134
 void HAL_timer_disable_interrupt(uint8_t timer_num) {
133 135
   switch (timer_num) {
134 136
     case STEP_TIMER_NUM:
135
-      StepperTimer.detachInterrupt(STEP_TIMER_CHAN);
137
+      timer_disable_irq(STEP_TIMER_DEV, STEP_TIMER_CHAN);
136 138
       break;
137 139
     case TEMP_TIMER_NUM:
138
-      TempTimer.detachInterrupt(STEP_TIMER_CHAN);
140
+      timer_disable_irq(TEMP_TIMER_DEV, TEMP_TIMER_CHAN);
139 141
       break;
140 142
     default:
141 143
       break;

+ 8
- 3
Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h 查看文件

@@ -46,7 +46,12 @@
46 46
 typedef uint16_t hal_timer_t;
47 47
 #define HAL_TIMER_TYPE_MAX 0xFFFF
48 48
 
49
-#define STEP_TIMER_NUM 5  // index of timer to use for stepper
49
+#ifdef MCU_STM32F103CB  || defined(MCU_STM32F103C8)
50
+  #define STEP_TIMER_NUM 4 // For C8/CB boards, use timer 4
51
+#else
52
+  #define STEP_TIMER_NUM 5 // for other boards, five is fine.
53
+#endif
54
+
50 55
 #define STEP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
51 56
 #define TEMP_TIMER_NUM 2  // index of timer to use for temperature
52 57
 #define TEMP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
@@ -86,10 +91,10 @@ extern "C" void stepTC_Handler(void);
86 91
 // --------------------------------------------------------------------------
87 92
 // Public Variables
88 93
 // --------------------------------------------------------------------------
89
-
94
+/*
90 95
 static HardwareTimer StepperTimer(STEP_TIMER_NUM);
91 96
 static HardwareTimer TempTimer(TEMP_TIMER_NUM);
92
-
97
+*/
93 98
 // --------------------------------------------------------------------------
94 99
 // Public functions
95 100
 // --------------------------------------------------------------------------

+ 3
- 3
Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h 查看文件

@@ -31,9 +31,9 @@
31 31
 
32 32
 #include <libmaple/gpio.h>
33 33
 
34
-#define READ(IO)              (gpio_read_bit(PIN_MAP[IO].gpio_device, PIN_MAP[IO].gpio_bit) ? HIGH : LOW)
35
-#define WRITE(IO, v)          do{ gpio_write_bit(PIN_MAP[IO].gpio_device, PIN_MAP[IO].gpio_bit, v); } while (0)
36
-#define TOGGLE(IO)            do{ gpio_toggle_bit(PIN_MAP[IO].gpio_device, PIN_MAP[IO].gpio_bit); } while (0)
34
+#define READ(IO)              (PIN_MAP[IO].gpio_device->regs->IDR & (1U << PIN_MAP[IO].gpio_bit) ? HIGH : LOW)
35
+#define WRITE(IO, v)          (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << (16 * !(bool)v))
36
+#define TOGGLE(IO)            (PIN_MAP[IO].gpio_device->regs->ODR = PIN_MAP[IO].gpio_device->regs->ODR ^ (1U << PIN_MAP[IO].gpio_bit))
37 37
 #define WRITE_VAR(IO, v)      WRITE(io, v)
38 38
 
39 39
 #define _GET_MODE(IO)         (gpio_get_mode(PIN_MAP[IO].gpio_device, PIN_MAP[IO].gpio_bit))

+ 110
- 0
Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp 查看文件

@@ -0,0 +1,110 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
6
+ * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
7
+ * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
8
+ *
9
+ * This program is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
24
+/**
25
+ * persistent_store_flash.cpp
26
+ * HAL for stm32duino and compatible (STM32F1)
27
+ * Implementation of EEPROM settings in SDCard
28
+ */
29
+
30
+#ifdef __STM32F1__
31
+
32
+#include "../../inc/MarlinConfig.h"
33
+
34
+// This is for EEPROM emulation in flash
35
+#if ENABLED(EEPROM_SETTINGS) && ENABLED(FLASH_EEPROM_EMULATION)
36
+
37
+#include "../persistent_store_api.h"
38
+
39
+#include <flash_stm32.h>
40
+#include <EEPROM.h>
41
+
42
+namespace HAL {
43
+namespace PersistentStore {
44
+
45
+// Store settings in the last two pages
46
+// Flash pages must be erased before writing, so keep track.
47
+bool firstWrite = false;
48
+uint32_t pageBase = EEPROM_START_ADDRESS;
49
+
50
+bool access_start() {
51
+  firstWrite = true;
52
+  return true;
53
+}
54
+
55
+bool access_finish(){
56
+  FLASH_Lock();
57
+  firstWrite = false;
58
+  return true;
59
+}
60
+
61
+bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
62
+  FLASH_Status status;
63
+
64
+  if (firstWrite) {
65
+    FLASH_Unlock();
66
+    status = FLASH_ErasePage(EEPROM_PAGE0_BASE);
67
+    if (status != FLASH_COMPLETE) return false;
68
+    status = FLASH_ErasePage(EEPROM_PAGE1_BASE);
69
+    if (status != FLASH_COMPLETE) return false;
70
+    firstWrite = false;
71
+  }
72
+
73
+  // First write full words
74
+  int i = 0;
75
+  int wordsToWrite = size / sizeof(uint16_t);
76
+  uint16_t* wordBuffer = (uint16_t *)value;
77
+  while (wordsToWrite) {
78
+    status = FLASH_ProgramHalfWord(pageBase + pos + (i * 2), wordBuffer[i]);
79
+    if (status != FLASH_COMPLETE) return false;
80
+    wordsToWrite--;
81
+    i++;
82
+  }
83
+
84
+  // Now, write any remaining single byte
85
+  if (size & 1) {
86
+    uint16_t temp = value[size - 1];
87
+    status = FLASH_ProgramHalfWord(pageBase + pos + i, temp);
88
+    if (status != FLASH_COMPLETE) return false;
89
+  }
90
+
91
+  crc16(crc, value, size);
92
+  pos += ((size + 1) & ~1);
93
+  return true;
94
+}
95
+
96
+void read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) {
97
+  for (uint16_t i = 0; i < size; i++) {
98
+    byte* accessPoint = (byte*)(pageBase + pos + i);
99
+    value[i] = *accessPoint;
100
+  }
101
+
102
+  crc16(crc, value, size);
103
+  pos += ((size + 1) & ~1);
104
+}
105
+
106
+} // PersistentStore
107
+} // HAL
108
+
109
+#endif // EEPROM_SETTINGS && EEPROM FLASH
110
+#endif // __STM32F1__

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/persistent_store_impl.cpp 查看文件

@@ -29,7 +29,7 @@
29 29
 
30 30
 #include "../../inc/MarlinConfig.h"
31 31
 
32
-#if ENABLED(EEPROM_SETTINGS)
32
+#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
33 33
 
34 34
 #include "../persistent_store_api.h"
35 35
 

+ 32
- 0
Marlin/src/HAL/HAL_STM32F1/readme.md 查看文件

@@ -0,0 +1,32 @@
1
+# This HAL is for STM32F103 boards used with libmaple/stm32duino Arduino core.
2
+
3
+# This HAL is in development and has not been tested with an actual printer.
4
+
5
+### The stm32 core needs a modification in the file util.h to avoid conflict with Marlin macros for Debug.
6
+Since only 1 file needs change in the stm32duino core, it's preferable over making changes to Marlin.
7
+
8
+
9
+After these lines:
10
+<>
11
+#else
12
+#define ASSERT_FAULT(exp) (void)((0))
13
+#endif
14
+<>
15
+
16
+Add the following 3 lines:
17
+<>
18
+#undef DEBUG_NONE
19
+#undef DEBUG_FAULT
20
+#undef DEBUG_ALL
21
+<>
22
+
23
+### Main developers:
24
+Victorpv
25
+
26
+
27
+### Most up to date repository for this HAL:
28
+https://github.com/victorpv/Marlin/tree/bugfix-2.0.x
29
+
30
+PRs should be first sent to that fork, and once tested merged to Marlin bugfix-2.0.x branch.
31
+
32
+

+ 1663
- 0
Marlin/src/config/examples/Malyan/M200/Configuration.h
文件差异内容过多而无法显示
查看文件


+ 1437
- 0
Marlin/src/config/examples/Malyan/M200/Configuration_adv.h
文件差异内容过多而无法显示
查看文件


+ 1643
- 0
Marlin/src/config/examples/stm32f103ret6/Configuration.h
文件差异内容过多而无法显示
查看文件


+ 3
- 0
Marlin/src/core/boards.h 查看文件

@@ -194,6 +194,9 @@
194 194
 //
195 195
 #define BOARD_TEENSY35_36       841   // Teensy3.5 and Teensy3.6
196 196
 #define BOARD_STM32F1R         1800   // STM3R Libmaple based STM32F1 controller
197
+#define BOARD_MALYAN_M200      1801   // STM32C8T6 Libmaple based stm32f1 controller
198
+#define BOARD_BEAST            1802  // STM32FxxxVxT6 Libmaple based stm32f4 controller
199
+#define BOARD_STM3R_MINI       1803  // STM32 Libmaple based stm32f1 controller
197 200
 
198 201
 #define MB(board) (MOTHERBOARD==BOARD_##board)
199 202
 

+ 5
- 2
Marlin/src/module/configuration_store.cpp 查看文件

@@ -299,8 +299,11 @@ void MarlinSettings::postprocess() {
299 299
     EEPROM_START();
300 300
 
301 301
     eeprom_error = false;
302
-
303
-    EEPROM_WRITE(ver);     // invalidate data first
302
+    #if ENABLED(FLASH_EEPROM_EMULATION)
303
+      EEPROM_SKIP(ver);   // Flash doesn't allow rewriting without erase
304
+    #else
305
+      EEPROM_WRITE(ver);  // invalidate data first
306
+    #endif
304 307
     EEPROM_SKIP(working_crc); // Skip the checksum slot
305 308
 
306 309
     working_crc = 0; // clear before first "real data"

+ 8
- 0
Marlin/src/pins/pins.h 查看文件

@@ -319,6 +319,14 @@
319 319
   #include "pins_ALLIGATOR_R2.h"
320 320
 #elif MB(STM32F1R)
321 321
   #include "pins_STM32F1R.h"
322
+#elif MB(STM3R_MINI)
323
+  #include "pins_STM3R_MINI.h"
324
+#elif MB(MALYAN_M200)
325
+  #include "pins_MALYAN_M200.h"
326
+#elif MB(BEAST)
327
+  #include "pins_BEAST.h"
328
+#elif MB(CHITU3D)
329
+  #include "pins_CHITU3D.h"
322 330
 #elif MB(MKS_SBASE)
323 331
   #include "pins_MKS_SBASE.h"
324 332
 #elif MB(AZSMZ_MINI)

+ 288
- 0
Marlin/src/pins/pins_BEAST.h 查看文件

@@ -0,0 +1,288 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#if !defined(__STM32F1__) && !defined(__STM32F4__)
24
+    #error "Oops!  Make sure you have an STM32F1/4 board selected from the 'Tools -> Boards' menu."
25
+#endif
26
+
27
+/**
28
+ * 21017 Victor Perez Marlin for stm32f1 test
29
+ */
30
+
31
+#define DEFAULT_MACHINE_NAME "STM32F103RET6"
32
+#define BOARD_NAME "Marlin for STM32"
33
+
34
+#define LARGE_FLASH true
35
+
36
+// Enable I2C_EEPROM for testing
37
+#define I2C_EEPROM
38
+
39
+// Ignore temp readings during develpment.
40
+#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
41
+
42
+//
43
+// Steppers
44
+//
45
+#define X_STEP_PIN         PE0
46
+#define X_DIR_PIN          PE1
47
+#define X_ENABLE_PIN       PC0
48
+#define X_MIN_PIN          PD5
49
+#define X_MAX_PIN          -1
50
+
51
+#define Y_STEP_PIN         PE2
52
+#define Y_DIR_PIN          PE3
53
+#define Y_ENABLE_PIN       PC1
54
+#define Y_MIN_PIN          PD6
55
+#define Y_MAX_PIN
56
+
57
+#define Z_STEP_PIN         PE4
58
+#define Z_DIR_PIN          PE5
59
+#define Z_ENABLE_PIN       PC2
60
+#define Z_MIN_PIN          PD7
61
+#define Z_MAX_PIN          -1
62
+
63
+#define Y2_STEP_PIN        -1
64
+#define Y2_DIR_PIN         -1
65
+#define Y2_ENABLE_PIN      -1
66
+
67
+#define Z2_STEP_PIN        -1
68
+#define Z2_DIR_PIN         -1
69
+#define Z2_ENABLE_PIN      -1
70
+
71
+#define E0_STEP_PIN        PE6
72
+#define E0_DIR_PIN         PE7
73
+#define E0_ENABLE_PIN      PC3
74
+
75
+/**
76
+ * TODO: Currently using same Enable pin to all steppers.
77
+ */
78
+
79
+#define E1_STEP_PIN        PE8
80
+#define E1_DIR_PIN         PE9
81
+#define E1_ENABLE_PIN      PC4
82
+
83
+#define E2_STEP_PIN        PE10
84
+#define E2_DIR_PIN         PE11
85
+#define E2_ENABLE_PIN      PC5
86
+
87
+//
88
+// Misc. Functions
89
+//
90
+#define SDPOWER            -1
91
+#define SDSS               PA15
92
+#define LED_PIN            PB2
93
+
94
+#define PS_ON_PIN          -1
95
+#define KILL_PIN           -1
96
+
97
+//
98
+// Heaters / Fans
99
+//
100
+#define HEATER_0_PIN       PD12  // EXTRUDER 1
101
+#define HEATER_1_PIN       PD13
102
+#define HEATER_2_PIN       PD14
103
+
104
+#define HEATER_BED_PIN     PB9   // BED
105
+#define HEATER_BED2_PIN    -1    // BED2
106
+#define HEATER_BED3_PIN    -1    // BED3
107
+
108
+#define FAN_PIN            PB10
109
+
110
+#define FAN_SOFT_PWM
111
+
112
+//
113
+// Temperature Sensors
114
+//
115
+#define TEMP_BED_PIN       PA0   // ANALOG NUMBERING
116
+#define TEMP_0_PIN         PA1   // ANALOG NUMBERING
117
+#define TEMP_1_PIN         PA2   // ANALOG NUMBERING
118
+#define TEMP_2_PIN         PA3   // ANALOG NUMBERING
119
+
120
+//
121
+// LCD Pins
122
+//
123
+#if ENABLED(ULTRA_LCD)
124
+
125
+  #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
126
+    #define LCD_PINS_RS         49 // CS chip select /SS chip slave select
127
+    #define LCD_PINS_ENABLE     51 // SID (MOSI)
128
+    #define LCD_PINS_D4         52 // SCK (CLK) clock
129
+  #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE)
130
+    #define LCD_PINS_RS         PB8
131
+    #define LCD_PINS_ENABLE     PD2
132
+    #define LCD_PINS_D4         PB12
133
+    #define LCD_PINS_D5         PB13
134
+    #define LCD_PINS_D6         PB14
135
+    #define LCD_PINS_D7         PB15
136
+  #else
137
+    #define LCD_PINS_RS         PB8
138
+    #define LCD_PINS_ENABLE     PD2
139
+    #define LCD_PINS_D4         PB12
140
+    #define LCD_PINS_D5         PB13
141
+    #define LCD_PINS_D6         PB14
142
+    #define LCD_PINS_D7         PB15
143
+    #if DISABLED(NEWPANEL)
144
+      #define BEEPER_PIN        33
145
+      // Buttons are attached to a shift register
146
+      // Not wired yet
147
+      //#define SHIFT_CLK 38
148
+      //#define SHIFT_LD 42
149
+      //#define SHIFT_OUT 40
150
+      //#define SHIFT_EN 17
151
+    #endif
152
+  #endif
153
+
154
+  #if ENABLED(NEWPANEL)
155
+
156
+    #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
157
+
158
+      #define BEEPER_PIN        37
159
+
160
+      #define BTN_EN1           31
161
+      #define BTN_EN2           33
162
+      #define BTN_ENC           35
163
+
164
+      #define SD_DETECT_PIN     49
165
+      #define KILL_PIN          41
166
+
167
+      #if ENABLED(BQ_LCD_SMART_CONTROLLER)
168
+        #define LCD_BACKLIGHT_PIN 39
169
+      #endif
170
+
171
+    #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
172
+
173
+      #define BTN_EN1           64
174
+      #define BTN_EN2           59
175
+      #define BTN_ENC           63
176
+      #define SD_DETECT_PIN     42
177
+
178
+    #elif ENABLED(LCD_I2C_PANELOLU2)
179
+
180
+      #define BTN_EN1           47
181
+      #define BTN_EN2           43
182
+      #define BTN_ENC           32
183
+      #define LCD_SDSS          53
184
+      #define SD_DETECT_PIN     -1
185
+      #define KILL_PIN          41
186
+
187
+    #elif ENABLED(LCD_I2C_VIKI)
188
+
189
+      #define BTN_EN1           22 // http://files.panucatt.com/datasheets/viki_wiring_diagram.pdf explains 40/42.
190
+      #define BTN_EN2            7 // 22/7 are unused on RAMPS_14. 22 is unused and 7 the SERVO0_PIN on RAMPS_13.
191
+
192
+      #define BTN_ENC           -1
193
+      #define LCD_SDSS          53
194
+      #define SD_DETECT_PIN     49
195
+
196
+    #elif ENABLED(VIKI2) || ENABLED(miniVIKI)
197
+
198
+      #define BEEPER_PIN        33
199
+
200
+      // Pins for DOGM SPI LCD Support
201
+      #define DOGLCD_A0         44
202
+      #define DOGLCD_CS         45
203
+      #define LCD_SCREEN_ROT_180
204
+
205
+      #define BTN_EN1           22
206
+      #define BTN_EN2            7
207
+      #define BTN_ENC           39
208
+
209
+      #define SDSS              53
210
+      #define SD_DETECT_PIN     -1 // Pin 49 for display sd interface, 72 for easy adapter board
211
+
212
+      #define KILL_PIN          31
213
+
214
+      #define STAT_LED_RED_PIN  32
215
+      #define STAT_LED_BLUE_PIN 35
216
+
217
+    #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
218
+      #define BTN_EN1           35
219
+      #define BTN_EN2           37
220
+      #define BTN_ENC           31
221
+      #define SD_DETECT_PIN     49
222
+      #define LCD_SDSS          53
223
+      #define KILL_PIN          41
224
+      #define BEEPER_PIN        23
225
+      #define DOGLCD_CS         29
226
+      #define DOGLCD_A0         27
227
+      #define LCD_BACKLIGHT_PIN 33
228
+    #elif ENABLED(MINIPANEL)
229
+      #define BEEPER_PIN        42
230
+      // Pins for DOGM SPI LCD Support
231
+      #define DOGLCD_A0         44
232
+      #define DOGLCD_CS         66
233
+      #define LCD_BACKLIGHT_PIN 65 // backlight LED on A11/D65
234
+      #define SDSS              53
235
+
236
+      #define KILL_PIN          64
237
+      // GLCD features
238
+      //#define LCD_CONTRAST   190
239
+      // Uncomment screen orientation
240
+      //#define LCD_SCREEN_ROT_90
241
+      //#define LCD_SCREEN_ROT_180
242
+      //#define LCD_SCREEN_ROT_270
243
+      // The encoder and click button
244
+      #define BTN_EN1           40
245
+      #define BTN_EN2           63
246
+      #define BTN_ENC           59
247
+      // not connected to a pin
248
+      #define SD_DETECT_PIN     49
249
+
250
+    #else
251
+
252
+      // Beeper on AUX-4
253
+      #define BEEPER_PIN        33
254
+
255
+      // buttons are directly attached using AUX-2
256
+      #if ENABLED(REPRAPWORLD_KEYPAD)
257
+        #define BTN_EN1         64
258
+        #define BTN_EN2         59
259
+        #define BTN_ENC         63
260
+        #define SHIFT_OUT       40
261
+        #define SHIFT_CLK       44
262
+        #define SHIFT_LD        42
263
+      #elif ENABLED(PANEL_ONE)
264
+        #define BTN_EN1         59 // AUX2 PIN 3
265
+        #define BTN_EN2         63 // AUX2 PIN 4
266
+        #define BTN_ENC         49 // AUX3 PIN 7
267
+      #else
268
+        #define BTN_EN1         37
269
+        #define BTN_EN2         35
270
+        #define BTN_ENC         31
271
+      #endif
272
+
273
+      #if ENABLED(G3D_PANEL)
274
+        #define SD_DETECT_PIN   49
275
+        #define KILL_PIN        41
276
+      #else
277
+        //#define SD_DETECT_PIN -1 // Ramps doesn't use this
278
+      #endif
279
+
280
+    #endif
281
+  #endif // NEWPANEL
282
+
283
+#endif // ULTRA_LCD
284
+
285
+#define U_MIN_PIN          -1
286
+#define V_MIN_PIN          -1
287
+#define W_MIN_PIN          -1
288
+

+ 287
- 0
Marlin/src/pins/pins_CHITU3D.h 查看文件

@@ -0,0 +1,287 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#if !defined(__STM32F1__) && !defined(__STM32F4__)
24
+    #error "Oops!  Make sure you have an STM32F1/4 board selected from the 'Tools -> Boards' menu."
25
+#endif
26
+
27
+/**
28
+ * 2017 Victor Perez Marlin for stm32f1 test
29
+ */
30
+
31
+#define DEFAULT_MACHINE_NAME "STM32F103RET6"
32
+#define BOARD_NAME "Chitu3d Marlin"
33
+
34
+#define LARGE_FLASH true
35
+
36
+// Enable I2C_EEPROM for testing
37
+//#define I2C_EEPROM
38
+
39
+// Ignore temp readings during develpment.
40
+#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
41
+
42
+//
43
+// Steppers
44
+//
45
+#define X_STEP_PIN         PE5
46
+#define X_DIR_PIN          PE6
47
+#define X_ENABLE_PIN       PC13
48
+#define X_MIN_PIN          PG10
49
+#define X_MAX_PIN          -1
50
+
51
+#define Y_STEP_PIN         PE2
52
+#define Y_DIR_PIN          PE3
53
+#define Y_ENABLE_PIN       PE4
54
+#define Y_MIN_PIN          PA12
55
+#define Y_MAX_PIN
56
+
57
+#define Z_STEP_PIN         PB9
58
+#define Z_DIR_PIN          PE0
59
+#define Z_ENABLE_PIN       PE1
60
+#define Z_MIN_PIN          PA14
61
+#define Z_MAX_PIN          -1
62
+
63
+#define Y2_STEP_PIN        -1
64
+#define Y2_DIR_PIN         -1
65
+#define Y2_ENABLE_PIN      -1
66
+
67
+#define Z2_STEP_PIN        -1
68
+#define Z2_DIR_PIN         -1
69
+#define Z2_ENABLE_PIN      -1
70
+
71
+#define E0_STEP_PIN        PB4
72
+#define E0_DIR_PIN         PB5
73
+#define E0_ENABLE_PIN      PB8
74
+
75
+
76
+
77
+#define E1_STEP_PIN        -1
78
+#define E1_DIR_PIN         -1
79
+#define E1_ENABLE_PIN      -1
80
+
81
+#define E2_STEP_PIN        -1
82
+#define E2_DIR_PIN         -1
83
+#define E2_ENABLE_PIN      -1
84
+
85
+//
86
+// Misc. Functions
87
+//
88
+#define SDPOWER            -1
89
+#define SDSS               -1
90
+#define LED_PIN            -1
91
+#define CASE_LIGHT_PIN      8
92
+
93
+#define PS_ON_PIN          -1
94
+#define KILL_PIN           PD6      // LED strip 24v
95
+
96
+//
97
+// Heaters / Fans
98
+//
99
+#define HEATER_0_PIN       PD12     // HOT-END
100
+#define HEATER_1_PIN       -1
101
+#define HEATER_2_PIN       -1
102
+
103
+#define HEATER_BED_PIN     PG11     // HOT-BED
104
+#define HEATER_BED2_PIN    -1       // BED2
105
+#define HEATER_BED3_PIN    -1       // BED3
106
+
107
+#define FAN_PIN            PG14     // MAIN BOARD FAN
108
+
109
+#define FAN_SOFT_PWM
110
+
111
+//
112
+// Temperature Sensors
113
+//
114
+#define TEMP_BED_PIN       PA0   // ANALOG NUMBERING
115
+#define TEMP_0_PIN         PA1   // ANALOG NUMBERING
116
+#define TEMP_1_PIN         -1   // ANALOG NUMBERING
117
+#define TEMP_2_PIN         -1   // ANALOG NUMBERING
118
+
119
+//
120
+// LCD Pins
121
+//
122
+#if ENABLED(ULTRA_LCD)
123
+
124
+  #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
125
+    #define LCD_PINS_RS         49 // CS chip select /SS chip slave select
126
+    #define LCD_PINS_ENABLE     51 // SID (MOSI)
127
+    #define LCD_PINS_D4         52 // SCK (CLK) clock
128
+  #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE)
129
+    #define LCD_PINS_RS         PB8
130
+    #define LCD_PINS_ENABLE     PD2
131
+    #define LCD_PINS_D4         PB12
132
+    #define LCD_PINS_D5         PB13
133
+    #define LCD_PINS_D6         PB14
134
+    #define LCD_PINS_D7         PB15
135
+  #else
136
+    #define LCD_PINS_RS         PB8
137
+    #define LCD_PINS_ENABLE     PD2
138
+    #define LCD_PINS_D4         PB12
139
+    #define LCD_PINS_D5         PB13
140
+    #define LCD_PINS_D6         PB14
141
+    #define LCD_PINS_D7         PB15
142
+    #if DISABLED(NEWPANEL)
143
+      #define BEEPER_PIN        33
144
+      // Buttons are attached to a shift register
145
+      // Not wired yet
146
+      //#define SHIFT_CLK 38
147
+      //#define SHIFT_LD 42
148
+      //#define SHIFT_OUT 40
149
+      //#define SHIFT_EN 17
150
+    #endif
151
+  #endif
152
+
153
+  #if ENABLED(NEWPANEL)
154
+
155
+    #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
156
+
157
+      #define BEEPER_PIN        37
158
+
159
+      #define BTN_EN1           31
160
+      #define BTN_EN2           33
161
+      #define BTN_ENC           35
162
+
163
+      #define SD_DETECT_PIN     49
164
+      #define KILL_PIN          41
165
+
166
+      #if ENABLED(BQ_LCD_SMART_CONTROLLER)
167
+        #define LCD_BACKLIGHT_PIN 39
168
+      #endif
169
+
170
+    #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
171
+
172
+      #define BTN_EN1           64
173
+      #define BTN_EN2           59
174
+      #define BTN_ENC           63
175
+      #define SD_DETECT_PIN     42
176
+
177
+    #elif ENABLED(LCD_I2C_PANELOLU2)
178
+
179
+      #define BTN_EN1           47
180
+      #define BTN_EN2           43
181
+      #define BTN_ENC           32
182
+      #define LCD_SDSS          53
183
+      #define SD_DETECT_PIN     -1
184
+      #define KILL_PIN          41
185
+
186
+    #elif ENABLED(LCD_I2C_VIKI)
187
+
188
+      #define BTN_EN1           22 // http://files.panucatt.com/datasheets/viki_wiring_diagram.pdf explains 40/42.
189
+      #define BTN_EN2            7 // 22/7 are unused on RAMPS_14. 22 is unused and 7 the SERVO0_PIN on RAMPS_13.
190
+
191
+      #define BTN_ENC           -1
192
+      #define LCD_SDSS          53
193
+      #define SD_DETECT_PIN     49
194
+
195
+    #elif ENABLED(VIKI2) || ENABLED(miniVIKI)
196
+
197
+      #define BEEPER_PIN        33
198
+
199
+      // Pins for DOGM SPI LCD Support
200
+      #define DOGLCD_A0         44
201
+      #define DOGLCD_CS         45
202
+      #define LCD_SCREEN_ROT_180
203
+
204
+      #define BTN_EN1           22
205
+      #define BTN_EN2            7
206
+      #define BTN_ENC           39
207
+
208
+      #define SDSS              53
209
+      #define SD_DETECT_PIN     -1 // Pin 49 for display sd interface, 72 for easy adapter board
210
+
211
+      #define KILL_PIN          31
212
+
213
+      #define STAT_LED_RED_PIN  32
214
+      #define STAT_LED_BLUE_PIN 35
215
+
216
+    #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
217
+      #define BTN_EN1           35
218
+      #define BTN_EN2           37
219
+      #define BTN_ENC           31
220
+      #define SD_DETECT_PIN     49
221
+      #define LCD_SDSS          53
222
+      #define KILL_PIN          41
223
+      #define BEEPER_PIN        23
224
+      #define DOGLCD_CS         29
225
+      #define DOGLCD_A0         27
226
+      #define LCD_BACKLIGHT_PIN 33
227
+    #elif ENABLED(MINIPANEL)
228
+      #define BEEPER_PIN        42
229
+      // Pins for DOGM SPI LCD Support
230
+      #define DOGLCD_A0         44
231
+      #define DOGLCD_CS         66
232
+      #define LCD_BACKLIGHT_PIN 65 // backlight LED on A11/D65
233
+      #define SDSS              53
234
+
235
+      #define KILL_PIN          64
236
+      // GLCD features
237
+      //#define LCD_CONTRAST   190
238
+      // Uncomment screen orientation
239
+      //#define LCD_SCREEN_ROT_90
240
+      //#define LCD_SCREEN_ROT_180
241
+      //#define LCD_SCREEN_ROT_270
242
+      // The encoder and click button
243
+      #define BTN_EN1           40
244
+      #define BTN_EN2           63
245
+      #define BTN_ENC           59
246
+      // not connected to a pin
247
+      #define SD_DETECT_PIN     49
248
+
249
+    #else
250
+
251
+      // Beeper on AUX-4
252
+      #define BEEPER_PIN        33
253
+
254
+      // buttons are directly attached using AUX-2
255
+      #if ENABLED(REPRAPWORLD_KEYPAD)
256
+        #define BTN_EN1         64
257
+        #define BTN_EN2         59
258
+        #define BTN_ENC         63
259
+        #define SHIFT_OUT       40
260
+        #define SHIFT_CLK       44
261
+        #define SHIFT_LD        42
262
+      #elif ENABLED(PANEL_ONE)
263
+        #define BTN_EN1         59 // AUX2 PIN 3
264
+        #define BTN_EN2         63 // AUX2 PIN 4
265
+        #define BTN_ENC         49 // AUX3 PIN 7
266
+      #else
267
+        #define BTN_EN1         37
268
+        #define BTN_EN2         35
269
+        #define BTN_ENC         31
270
+      #endif
271
+
272
+      #if ENABLED(G3D_PANEL)
273
+        #define SD_DETECT_PIN   49
274
+        #define KILL_PIN        41
275
+      #else
276
+        //#define SD_DETECT_PIN -1 // Ramps doesn't use this
277
+      #endif
278
+
279
+    #endif
280
+  #endif // NEWPANEL
281
+
282
+#endif // ULTRA_LCD
283
+
284
+#define U_MIN_PIN          -1
285
+#define V_MIN_PIN          -1
286
+#define W_MIN_PIN          -1
287
+

+ 86
- 0
Marlin/src/pins/pins_Malyan_M200.h 查看文件

@@ -0,0 +1,86 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * MALYAN M200 pin assignments
25
+ */
26
+
27
+#ifndef __STM32F1__
28
+  #error "Oops! You must be compiling for STM32."
29
+#endif
30
+
31
+#define BOARD_NAME "MALYANM200"
32
+
33
+// Enable EEPROM Emulation for this board
34
+// This setting should probably be in configuration.h
35
+// but it is literally the only board which uses it.
36
+#define FLASH_EEPROM_EMULATION
37
+
38
+#define SDSS SS_PIN
39
+
40
+//
41
+// Limit Switches
42
+//
43
+#define X_MIN_PIN          PB4
44
+#define Y_MIN_PIN          PA15
45
+#define Z_MIN_PIN          PB5
46
+
47
+//
48
+// Steppers
49
+//
50
+// X & Y enable are the same
51
+#define X_STEP_PIN         PB14
52
+#define X_DIR_PIN          PB15
53
+#define X_ENABLE_PIN       PA8
54
+
55
+#define Y_STEP_PIN         PB12
56
+#define Y_DIR_PIN          PB13
57
+#define Y_ENABLE_PIN       PA8
58
+
59
+#define Z_STEP_PIN         PB10
60
+#define Z_DIR_PIN          PB2
61
+#define Z_ENABLE_PIN       PB11
62
+
63
+#define E0_STEP_PIN        PB0
64
+#define E0_DIR_PIN         PC13
65
+#define E0_ENABLE_PIN      PB1
66
+
67
+//
68
+// Temperature Sensors
69
+//
70
+#define TEMP_0_PIN         PA0   // Analog Input (HOTEND0 thermistor)
71
+#define TEMP_BED_PIN       PA1   // Analog Input (BED thermistor)
72
+
73
+//
74
+// Heaters / Fans
75
+//
76
+#define HEATER_0_PIN       PB6 // HOTEND0 MOSFET
77
+#define HEATER_BED_PIN     PB7 // BED MOSFET
78
+
79
+// This board has only the controller fan and the extruder fan
80
+// If someone hacks to put a direct power fan on the controller, PB3 could
81
+// be used as a separate print cooling fan.
82
+// FAN_PIN is commented out because in configuration_adv, we have
83
+// it set to E0_AUTO_FAN_PIN
84
+// #define FAN_PIN            PB8 // FAN1 header on board - PRINT FAN
85
+#define FAN1_PIN           PB3 // FAN2 header on board - CONTROLLER FAN
86
+#define FAN2_PIN           -1 // FAN3 header on board - EXTRUDER0 FAN

+ 291
- 0
Marlin/src/pins/pins_STM3R_MINI.h 查看文件

@@ -0,0 +1,291 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#if !defined(__STM32F1__) && !defined(__STM32F4__)
24
+    #error "Oops!  Make sure you have an STM32F1/4 board selected from the 'Tools -> Boards' menu."
25
+#endif
26
+
27
+/**
28
+ * 21017 Victor Perez Marlin for stm32f1 test
29
+ */
30
+
31
+#define DEFAULT_MACHINE_NAME "STM3R Mini"
32
+#define BOARD_NAME "Marlin for STM32"
33
+
34
+#define LARGE_FLASH true
35
+
36
+// Enable I2C_EEPROM for testing
37
+#define I2C_EEPROM
38
+
39
+// Ignore temp readings during develpment.
40
+#define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
41
+
42
+//
43
+// Steppers
44
+//
45
+#define X_STEP_PIN         PE1
46
+#define X_DIR_PIN          PE0
47
+#define X_ENABLE_PIN       PC0
48
+#define X_MIN_PIN          PD0
49
+#define X_MAX_PIN          -1
50
+
51
+#define Y_STEP_PIN         PE3
52
+#define Y_DIR_PIN          PE2
53
+#define Y_ENABLE_PIN       PC1
54
+#define Y_MIN_PIN          PD1
55
+#define Y_MAX_PIN
56
+
57
+#define Z_STEP_PIN         PE5
58
+#define Z_DIR_PIN          PE4
59
+#define Z_ENABLE_PIN       PC2
60
+#define Z_MIN_PIN          PD4
61
+#define Z_MAX_PIN          -1
62
+
63
+#define Y2_STEP_PIN        -1
64
+#define Y2_DIR_PIN         -1
65
+#define Y2_ENABLE_PIN      -1
66
+
67
+#define Z2_STEP_PIN        -1
68
+#define Z2_DIR_PIN         -1
69
+#define Z2_ENABLE_PIN      -1
70
+
71
+#define E0_STEP_PIN        PE7
72
+#define E0_DIR_PIN         PE6
73
+#define E0_ENABLE_PIN      PC3
74
+
75
+#define E1_STEP_PIN        PE9
76
+#define E1_DIR_PIN         PE8
77
+#define E1_ENABLE_PIN      PC4
78
+
79
+#define E2_STEP_PIN        PE11
80
+#define E2_DIR_PIN         PE10
81
+#define E2_ENABLE_PIN      PC5
82
+
83
+//
84
+// Misc. Functions
85
+//
86
+//#define SDPOWER            -1
87
+#define SDSS               PA15
88
+#define LED_PIN            PB2
89
+
90
+//#define PS_ON_PIN          -1
91
+//#define KILL_PIN           -1
92
+
93
+//
94
+// Heaters / Fans
95
+//
96
+#define HEATER_0_PIN       PD12  // EXTRUDER 1
97
+//#define HEATER_1_PIN       PD13
98
+//#define HEATER_2_PIN       -1
99
+
100
+#define HEATER_BED_PIN     PB9   // BED
101
+//#define HEATER_BED2_PIN    -1    // BED2
102
+//#define HEATER_BED3_PIN    -1    // BED3
103
+
104
+#define FAN_PIN            PD14
105
+#define FAN1_PIN           PD13
106
+
107
+#define FAN_SOFT_PWM
108
+
109
+//
110
+// Temperature Sensors
111
+//
112
+#define TEMP_BED_PIN       PA0
113
+#define TEMP_0_PIN         PA1
114
+#define TEMP_1_PIN         PA2
115
+#define TEMP_2_PIN         PA3
116
+
117
+// Laser control
118
+#if ENABLED(SPINDLE_LASER_ENABLE)
119
+#define SPINDLE_LASER_PWM_PIN       PB8
120
+#define SPINDLE_LASER_ENABLE_PIN    PD5
121
+#endif
122
+
123
+//
124
+// LCD Pins
125
+//
126
+#if ENABLED(ULTRA_LCD)
127
+
128
+  #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
129
+    #define LCD_PINS_RS         49 // CS chip select /SS chip slave select
130
+    #define LCD_PINS_ENABLE     51 // SID (MOSI)
131
+    #define LCD_PINS_D4         52 // SCK (CLK) clock
132
+  #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE)
133
+    #define LCD_PINS_RS         PB8
134
+    #define LCD_PINS_ENABLE     PD2
135
+    #define LCD_PINS_D4         PB12
136
+    #define LCD_PINS_D5         PB13
137
+    #define LCD_PINS_D6         PB14
138
+    #define LCD_PINS_D7         PB15
139
+  #else
140
+    #define LCD_PINS_RS         PB8
141
+    #define LCD_PINS_ENABLE     PD2
142
+    #define LCD_PINS_D4         PB12
143
+    #define LCD_PINS_D5         PB13
144
+    #define LCD_PINS_D6         PB14
145
+    #define LCD_PINS_D7         PB15
146
+    #if DISABLED(NEWPANEL)
147
+      #define BEEPER_PIN        33
148
+      // Buttons are attached to a shift register
149
+      // Not wired yet
150
+      //#define SHIFT_CLK 38
151
+      //#define SHIFT_LD 42
152
+      //#define SHIFT_OUT 40
153
+      //#define SHIFT_EN 17
154
+    #endif
155
+  #endif
156
+
157
+  #if ENABLED(NEWPANEL)
158
+
159
+    #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
160
+
161
+      #define BEEPER_PIN        37
162
+
163
+      #define BTN_EN1           31
164
+      #define BTN_EN2           33
165
+      #define BTN_ENC           35
166
+
167
+      #define SD_DETECT_PIN     49
168
+      #define KILL_PIN          41
169
+
170
+      #if ENABLED(BQ_LCD_SMART_CONTROLLER)
171
+        #define LCD_BACKLIGHT_PIN 39
172
+      #endif
173
+
174
+    #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
175
+
176
+      #define BTN_EN1           64
177
+      #define BTN_EN2           59
178
+      #define BTN_ENC           63
179
+      #define SD_DETECT_PIN     42
180
+
181
+    #elif ENABLED(LCD_I2C_PANELOLU2)
182
+
183
+      #define BTN_EN1           47
184
+      #define BTN_EN2           43
185
+      #define BTN_ENC           32
186
+      #define LCD_SDSS          53
187
+      #define SD_DETECT_PIN     -1
188
+      #define KILL_PIN          41
189
+
190
+    #elif ENABLED(LCD_I2C_VIKI)
191
+
192
+      #define BTN_EN1           22 // http://files.panucatt.com/datasheets/viki_wiring_diagram.pdf explains 40/42.
193
+      #define BTN_EN2            7 // 22/7 are unused on RAMPS_14. 22 is unused and 7 the SERVO0_PIN on RAMPS_13.
194
+
195
+      #define BTN_ENC           -1
196
+      #define LCD_SDSS          53
197
+      #define SD_DETECT_PIN     49
198
+
199
+    #elif ENABLED(VIKI2) || ENABLED(miniVIKI)
200
+
201
+      #define BEEPER_PIN        33
202
+
203
+      // Pins for DOGM SPI LCD Support
204
+      #define DOGLCD_A0         44
205
+      #define DOGLCD_CS         45
206
+      #define LCD_SCREEN_ROT_180
207
+
208
+      #define BTN_EN1           22
209
+      #define BTN_EN2            7
210
+      #define BTN_ENC           39
211
+
212
+      #define SDSS              53
213
+      #define SD_DETECT_PIN     -1 // Pin 49 for display sd interface, 72 for easy adapter board
214
+
215
+      #define KILL_PIN          31
216
+
217
+      #define STAT_LED_RED_PIN  32
218
+      #define STAT_LED_BLUE_PIN 35
219
+
220
+    #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
221
+      #define BTN_EN1           35
222
+      #define BTN_EN2           37
223
+      #define BTN_ENC           31
224
+      #define SD_DETECT_PIN     49
225
+      #define LCD_SDSS          53
226
+      #define KILL_PIN          41
227
+      #define BEEPER_PIN        23
228
+      #define DOGLCD_CS         29
229
+      #define DOGLCD_A0         27
230
+      #define LCD_BACKLIGHT_PIN 33
231
+    #elif ENABLED(MINIPANEL)
232
+      #define BEEPER_PIN        42
233
+      // Pins for DOGM SPI LCD Support
234
+      #define DOGLCD_A0         44
235
+      #define DOGLCD_CS         66
236
+      #define LCD_BACKLIGHT_PIN 65 // backlight LED on A11/D65
237
+      #define SDSS              53
238
+
239
+      #define KILL_PIN          64
240
+      // GLCD features
241
+      //#define LCD_CONTRAST   190
242
+      // Uncomment screen orientation
243
+      //#define LCD_SCREEN_ROT_90
244
+      //#define LCD_SCREEN_ROT_180
245
+      //#define LCD_SCREEN_ROT_270
246
+      // The encoder and click button
247
+      #define BTN_EN1           40
248
+      #define BTN_EN2           63
249
+      #define BTN_ENC           59
250
+      // not connected to a pin
251
+      #define SD_DETECT_PIN     49
252
+
253
+    #else
254
+
255
+      // Beeper on AUX-4
256
+      #define BEEPER_PIN        33
257
+
258
+      // buttons are directly attached using AUX-2
259
+      #if ENABLED(REPRAPWORLD_KEYPAD)
260
+        #define BTN_EN1         64
261
+        #define BTN_EN2         59
262
+        #define BTN_ENC         63
263
+        #define SHIFT_OUT       40
264
+        #define SHIFT_CLK       44
265
+        #define SHIFT_LD        42
266
+      #elif ENABLED(PANEL_ONE)
267
+        #define BTN_EN1         59 // AUX2 PIN 3
268
+        #define BTN_EN2         63 // AUX2 PIN 4
269
+        #define BTN_ENC         49 // AUX3 PIN 7
270
+      #else
271
+        #define BTN_EN1         37
272
+        #define BTN_EN2         35
273
+        #define BTN_ENC         31
274
+      #endif
275
+
276
+      #if ENABLED(G3D_PANEL)
277
+        #define SD_DETECT_PIN   49
278
+        #define KILL_PIN        41
279
+      #else
280
+        //#define SD_DETECT_PIN -1 // Ramps doesn't use this
281
+      #endif
282
+
283
+    #endif
284
+  #endif // NEWPANEL
285
+
286
+#endif // ULTRA_LCD
287
+
288
+#define U_MIN_PIN          -1
289
+#define V_MIN_PIN          -1
290
+#define W_MIN_PIN          -1
291
+

正在加载...
取消
保存