Sfoglia il codice sorgente

✨ "Rutilea" ESP32 board (#22880)

Scott Lahteine 2 anni fa
parent
commit
aa4e32555d
Nessun account collegato all'indirizzo email del committer

+ 14
- 16
Marlin/src/HAL/ESP32/i2s.cpp Vedi File

@@ -64,12 +64,9 @@ uint32_t i2s_port_data = 0;
64 64
 #define I2S_EXIT_CRITICAL()   portEXIT_CRITICAL(&i2s_spinlock[i2s_num])
65 65
 
66 66
 static inline void gpio_matrix_out_check(uint32_t gpio, uint32_t signal_idx, bool out_inv, bool oen_inv) {
67
-  //if pin = -1, do not need to configure
68
-  if (gpio != -1) {
69
-    PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio], PIN_FUNC_GPIO);
70
-    gpio_set_direction((gpio_num_t)gpio, (gpio_mode_t)GPIO_MODE_DEF_OUTPUT);
71
-    gpio_matrix_out(gpio, signal_idx, out_inv, oen_inv);
72
-  }
67
+  PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio], PIN_FUNC_GPIO);
68
+  gpio_set_direction((gpio_num_t)gpio, (gpio_mode_t)GPIO_MODE_DEF_OUTPUT);
69
+  gpio_matrix_out(gpio, signal_idx, out_inv, oen_inv);
73 70
 }
74 71
 
75 72
 static esp_err_t i2s_reset_fifo(i2s_port_t i2s_num) {
@@ -256,13 +253,7 @@ int i2s_init() {
256 253
 
257 254
   I2S0.fifo_conf.dscr_en = 0;
258 255
 
259
-  I2S0.conf_chan.tx_chan_mod = (
260
-    #if ENABLED(I2S_STEPPER_SPLIT_STREAM)
261
-      4
262
-    #else
263
-      0
264
-    #endif
265
-  );
256
+  I2S0.conf_chan.tx_chan_mod = TERN(I2S_STEPPER_SPLIT_STREAM, 4, 0);
266 257
   I2S0.fifo_conf.tx_fifo_mod = 0;
267 258
   I2S0.conf.tx_mono = 0;
268 259
 
@@ -313,9 +304,16 @@ int i2s_init() {
313 304
   xTaskCreatePinnedToCore(stepperTask, "StepperTask", 10000, nullptr, 1, nullptr, CONFIG_ARDUINO_RUNNING_CORE); // run I2S stepper task on same core as rest of Marlin
314 305
 
315 306
   // Route the i2s pins to the appropriate GPIO
316
-  gpio_matrix_out_check(I2S_DATA, I2S0O_DATA_OUT23_IDX, 0, 0);
317
-  gpio_matrix_out_check(I2S_BCK, I2S0O_BCK_OUT_IDX, 0, 0);
318
-  gpio_matrix_out_check(I2S_WS, I2S0O_WS_OUT_IDX, 0, 0);
307
+  // If a pin is not defined, no need to configure
308
+  #if defined(I2S_DATA) && I2S_DATA >= 0
309
+    gpio_matrix_out_check(I2S_DATA, I2S0O_DATA_OUT23_IDX, 0, 0);
310
+  #endif
311
+  #if defined(I2S_BCK) && I2S_BCK >= 0
312
+    gpio_matrix_out_check(I2S_BCK, I2S0O_BCK_OUT_IDX, 0, 0);
313
+  #endif
314
+  #if defined(I2S_WS) && I2S_WS >= 0
315
+    gpio_matrix_out_check(I2S_WS, I2S0O_WS_OUT_IDX, 0, 0);
316
+  #endif
319 317
 
320 318
   // Start the I2S peripheral
321 319
   return i2s_start(I2S_NUM_0);

+ 4
- 3
Marlin/src/core/boards.h Vedi File

@@ -425,9 +425,10 @@
425 425
 #define BOARD_MRR_ESPA                6001  // MRR ESPA based on ESP32 (native pins only)
426 426
 #define BOARD_MRR_ESPE                6002  // MRR ESPE based on ESP32 (with I2S stepper stream)
427 427
 #define BOARD_E4D_BOX                 6003  // E4d@BOX
428
-#define BOARD_FYSETC_E4               6004  // FYSETC E4
429
-#define BOARD_PANDA_ZHU               6005  // Panda_ZHU
430
-#define BOARD_PANDA_M4                6006  // Panda_M4
428
+#define BOARD_RESP32_CUSTOM           6004  // Rutilea ESP32 custom board
429
+#define BOARD_FYSETC_E4               6005  // FYSETC E4
430
+#define BOARD_PANDA_ZHU               6006  // Panda_ZHU
431
+#define BOARD_PANDA_M4                6007  // Panda_M4
431 432
 
432 433
 //
433 434
 // SAMD51 ARM Cortex M4

+ 89
- 0
Marlin/src/pins/esp32/pins_ESPA_common.h Vedi File

@@ -0,0 +1,89 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2021 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 <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+/**
25
+ * ESPA-like pin assignments
26
+ * Supports 4 stepper drivers, heated bed, single hotend.
27
+ */
28
+
29
+#include "env_validate.h"
30
+
31
+#ifndef DEFAULT_MACHINE_NAME
32
+  #define DEFAULT_MACHINE_NAME  BOARD_INFO_NAME
33
+#endif
34
+
35
+//
36
+// Disable I2S stepper stream, by default
37
+//
38
+#undef I2S_STEPPER_STREAM
39
+#undef I2S_WS
40
+#undef I2S_BCK
41
+#undef I2S_DATA
42
+
43
+//
44
+// Limit Switches
45
+//
46
+#define X_STOP_PIN                            34
47
+#define Y_STOP_PIN                            35
48
+#define Z_STOP_PIN                            15
49
+
50
+//
51
+// Steppers
52
+//
53
+#define X_STEP_PIN                            27
54
+#define X_DIR_PIN                             26
55
+#define X_ENABLE_PIN                          25
56
+
57
+#define Y_STEP_PIN                            33
58
+#define Y_DIR_PIN                             32
59
+#define Y_ENABLE_PIN                X_ENABLE_PIN
60
+
61
+#define Z_STEP_PIN                            14
62
+#define Z_DIR_PIN                             12
63
+#define Z_ENABLE_PIN                X_ENABLE_PIN
64
+
65
+#define E0_STEP_PIN                           16
66
+#define E0_DIR_PIN                            17
67
+#define E0_ENABLE_PIN               X_ENABLE_PIN
68
+
69
+//
70
+// Temperature Sensors
71
+//
72
+#define TEMP_0_PIN                            36  // Analog Input
73
+#define TEMP_BED_PIN                          39  // Analog Input
74
+
75
+//
76
+// Heaters / Fans
77
+//
78
+#define HEATER_0_PIN                           2
79
+#define FAN_PIN                               13
80
+#define HEATER_BED_PIN                         4
81
+
82
+//
83
+// MicroSD card
84
+//
85
+#define SD_MOSI_PIN                           23
86
+#define SD_MISO_PIN                           19
87
+#define SD_SCK_PIN                            18
88
+#define SDSS                                   5
89
+#define USES_SHARED_SPI                           // SPI is shared by SD card with TMC SPI drivers

+ 1
- 56
Marlin/src/pins/esp32/pins_FYSETC_E4.h Vedi File

@@ -37,41 +37,8 @@
37 37
 #endif
38 38
 
39 39
 #define BOARD_INFO_NAME       "FYSETC_E4"
40
-#define DEFAULT_MACHINE_NAME  BOARD_INFO_NAME
41 40
 
42
-//
43
-// Disable I2S stepper stream
44
-//
45
-#undef I2S_STEPPER_STREAM
46
-#define I2S_WS                                -1
47
-#define I2S_BCK                               -1
48
-#define I2S_DATA                              -1
49
-
50
-//
51
-// Limit Switches
52
-//
53
-#define X_STOP_PIN                            34
54
-#define Y_STOP_PIN                            35
55
-#define Z_STOP_PIN                            15
56
-
57
-//
58
-// Steppers
59
-//
60
-#define X_STEP_PIN                            27
61
-#define X_DIR_PIN                             26
62
-#define X_ENABLE_PIN                          25
63
-
64
-#define Y_STEP_PIN                            33
65
-#define Y_DIR_PIN                             32
66
-#define Y_ENABLE_PIN                X_ENABLE_PIN
67
-
68
-#define Z_STEP_PIN                            14
69
-#define Z_DIR_PIN                             12
70
-#define Z_ENABLE_PIN                X_ENABLE_PIN
71
-
72
-#define E0_STEP_PIN                           16
73
-#define E0_DIR_PIN                            17
74
-#define E0_ENABLE_PIN               X_ENABLE_PIN
41
+#include "pins_ESPA_common.h"
75 42
 
76 43
 #if HAS_TMC_UART
77 44
   //
@@ -89,28 +56,6 @@
89 56
   #define TMC_BAUD_RATE 115200
90 57
 #endif
91 58
 
92
-//
93
-// Temperature Sensors
94
-//
95
-#define TEMP_0_PIN                            36  // Analog Input
96
-#define TEMP_BED_PIN                          39  // Analog Input
97
-
98
-//
99
-// Heaters / Fans
100
-//
101
-#define HEATER_0_PIN                           2
102
-#define FAN_PIN                               13
103
-#define HEATER_BED_PIN                         4
104
-
105
-//
106
-// MicroSD card
107
-//
108
-#define SD_MOSI_PIN                           23
109
-#define SD_MISO_PIN                           19
110
-#define SD_SCK_PIN                            18
111
-#define SDSS                                   5
112
-#define USES_SHARED_SPI                           // SPI is shared by SD card with TMC SPI drivers
113
-
114 59
 /**
115 60
  * Hardware serial pins
116 61
  *

+ 1
- 52
Marlin/src/pins/esp32/pins_MRR_ESPA.h Vedi File

@@ -38,68 +38,17 @@
38 38
 
39 39
 #define BOARD_INFO_NAME       "MRR ESPA"
40 40
 #define BOARD_WEBSITE_URL     "github.com/maplerainresearch/MRR_ESPA"
41
-#define DEFAULT_MACHINE_NAME  BOARD_INFO_NAME
42 41
 
43
-//
44
-// Disable I2S stepper stream
45
-//
46
-#undef I2S_STEPPER_STREAM
47
-#undef I2S_WS
48
-#undef I2S_BCK
49
-#undef I2S_DATA
50
-
51
-//
52
-// Limit Switches
53
-//
54
-#define X_STOP_PIN                            34
55
-#define Y_STOP_PIN                            35
56
-#define Z_STOP_PIN                            15
42
+#include "pins_ESPA_common.h"
57 43
 
58 44
 //
59 45
 // Steppers
60 46
 //
61
-#define X_STEP_PIN                            27
62
-#define X_DIR_PIN                             26
63
-#define X_ENABLE_PIN                          25
64 47
 //#define X_CS_PIN                            21
65
-
66
-#define Y_STEP_PIN                            33
67
-#define Y_DIR_PIN                             32
68
-#define Y_ENABLE_PIN                X_ENABLE_PIN
69 48
 //#define Y_CS_PIN                            22
70
-
71
-#define Z_STEP_PIN                            14
72
-#define Z_DIR_PIN                             12
73
-#define Z_ENABLE_PIN                X_ENABLE_PIN
74 49
 //#define Z_CS_PIN                             5  // SS_PIN
75
-
76
-#define E0_STEP_PIN                           16
77
-#define E0_DIR_PIN                            17
78
-#define E0_ENABLE_PIN               X_ENABLE_PIN
79 50
 //#define E0_CS_PIN                           21
80 51
 
81
-//
82
-// Temperature Sensors
83
-//
84
-#define TEMP_0_PIN                            36  // Analog Input
85
-#define TEMP_BED_PIN                          39  // Analog Input
86
-
87
-//
88
-// Heaters / Fans
89
-//
90
-#define HEATER_0_PIN                           2
91
-#define FAN_PIN                               13
92
-#define HEATER_BED_PIN                         4
93
-
94
-//
95
-// MicroSD card
96
-//
97
-#define SD_MOSI_PIN                           23
98
-#define SD_MISO_PIN                           19
99
-#define SD_SCK_PIN                            18
100
-#define SDSS                                   5
101
-#define USES_SHARED_SPI                           // SPI is shared by SD card with TMC SPI drivers
102
-
103 52
 // Hardware serial pins
104 53
 // Add the following to Configuration.h or Configuration_adv.h to assign
105 54
 // specific pins to hardware Serial1.

+ 0
- 1
Marlin/src/pins/esp32/pins_MRR_ESPE.h Vedi File

@@ -51,7 +51,6 @@
51 51
 //
52 52
 // Enable I2S stepper stream
53 53
 //
54
-#undef I2S_STEPPER_STREAM
55 54
 #define I2S_STEPPER_STREAM
56 55
 #define I2S_WS                                26
57 56
 #define I2S_BCK                               25

+ 37
- 0
Marlin/src/pins/esp32/pins_RESP32_CUSTOM.h Vedi File

@@ -0,0 +1,37 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2021 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 <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+/**
25
+ * Rutilea ESP32 (Tensilica Xtensa LX6) pin assignments
26
+ */
27
+
28
+#include "env_validate.h"
29
+
30
+#define BOARD_INFO_NAME "Rutilea ESP32"
31
+
32
+#include "pins_ESPA_common.h"
33
+
34
+//
35
+// I2S (steppers & other output-only pins)
36
+//
37
+#define I2S_STEPPER_STREAM

+ 2
- 0
Marlin/src/pins/pins.h Vedi File

@@ -695,6 +695,8 @@
695 695
   #include "esp32/pins_MRR_ESPE.h"              // ESP32                                  env:esp32
696 696
 #elif MB(E4D_BOX)
697 697
   #include "esp32/pins_E4D.h"                   // ESP32                                  env:esp32
698
+#elif MB(RESP32_CUSTOM)
699
+  #include "esp32/pins_RESP32_CUSTOM.h"         // ESP32                                  env:esp32
698 700
 #elif MB(FYSETC_E4)
699 701
   #include "esp32/pins_FYSETC_E4.h"             // ESP32                                  env:FYSETC_E4
700 702
 #elif MB(PANDA_ZHU)

Loading…
Annulla
Salva