Browse Source

SKR Pro 1.1 WiFi and LCD SD card support (#17531)

Bob Kuhn 5 years ago
parent
commit
f5d809f366
No account linked to committer's email address

+ 35
- 0
Marlin/src/HAL/shared/esp_wifi.cpp View File

@@ -0,0 +1,35 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 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
+#include "../../inc/MarlinConfig.h"
24
+#include "Delay.h"
25
+
26
+void esp_wifi_init(void) {
27
+  #if PIN_EXISTS(ESP_WIFI_MODULE_RESET)
28
+    OUT_WRITE(ESP_WIFI_MODULE_RESET_PIN, LOW);
29
+    delay(1);
30
+    OUT_WRITE(ESP_WIFI_MODULE_RESET_PIN, HIGH);
31
+  #endif
32
+  #if PIN_EXISTS(ESP_WIFI_MODULE_ENABLE)
33
+    OUT_WRITE(ESP_WIFI_MODULE_ENABLE_PIN, HIGH);
34
+  #endif
35
+}

+ 24
- 0
Marlin/src/HAL/shared/esp_wifi.h View File

@@ -0,0 +1,24 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 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
+#pragma once
23
+
24
+void esp_wifi_init();

+ 3
- 0
Marlin/src/MarlinCore.cpp View File

@@ -44,6 +44,7 @@
44 44
 #include "feature/closedloop.h"
45 45
 
46 46
 #include "HAL/shared/Delay.h"
47
+#include "HAL/shared/esp_wifi.h"
47 48
 
48 49
 #include "module/stepper/indirection.h"
49 50
 
@@ -962,6 +963,8 @@ void setup() {
962 963
     BOARD_INIT();
963 964
   #endif
964 965
 
966
+  SETUP_RUN(esp_wifi_init());
967
+
965 968
   // Check startup - does nothing if bootloader sets MCUSR to 0
966 969
   byte mcu = HAL_get_reset_source();
967 970
   if (mcu &  1) SERIAL_ECHOLNPGM(STR_POWERUP);

+ 6
- 0
Marlin/src/pins/pinsDebug_list.h View File

@@ -1409,3 +1409,9 @@
1409 1409
 #if PIN_EXISTS(CLOSED_LOOP_MOVE_COMPLETE)
1410 1410
   REPORT_NAME_DIGITAL(__LINE__, CLOSED_LOOP_MOVE_COMPLETE_PIN)
1411 1411
 #endif
1412
+#if PIN_EXISTS(ESP_WIFI_MODULE_RESET)
1413
+  REPORT_NAME_DIGITAL(__LINE__, ESP_WIFI_MODULE_RESET_PIN)
1414
+#endif
1415
+#if PIN_EXISTS(ESP_WIFI_MODULE_ENABLE)
1416
+  REPORT_NAME_DIGITAL(__LINE__, ESP_WIFI_MODULE_ENABLE_PIN)
1417
+#endif

+ 5
- 1
Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h View File

@@ -142,7 +142,11 @@
142 142
 #define SDIO_CK_PIN                         PC12
143 143
 #define SDIO_CMD_PIN                        PD2
144 144
 
145
-#if !defined(SDCARD_CONNECTION) || SD_CONNECTION_IS(ONBOARD)
145
+#ifndef SDCARD_CONNECTION
146
+  #define SDCARD_CONNECTION              ONBOARD
147
+#endif
148
+
149
+#if SD_CONNECTION_IS(ONBOARD)
146 150
   #define SDIO_SUPPORT                            // Use SDIO for onboard SD
147 151
 
148 152
   #ifndef SDIO_SUPPORT

+ 33
- 6
Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_V1_1.h View File

@@ -31,7 +31,7 @@
31 31
 
32 32
 // Use one of these or SDCard-based Emulation will be used
33 33
 //#define SRAM_EEPROM_EMULATION                   // Use BackSRAM-based EEPROM emulation
34
-//#define FLASH_EEPROM_EMULATION                  // Use Flash-based EEPROM emulation
34
+#define FLASH_EEPROM_EMULATION                    // Use Flash-based EEPROM emulation
35 35
 
36 36
 //
37 37
 // Servos
@@ -215,7 +215,11 @@
215 215
 #define HEATER_BED_PIN                      PD12  // Hotbed
216 216
 #define FAN_PIN                             PC8   // Fan0
217 217
 #define FAN1_PIN                            PE5   // Fan1
218
-#define FAN2_PIN                            PE6   // Fan2
218
+#define FAN2_PIN                            PE6
219
+
220
+#ifndef E0_AUTO_FAN_PIN
221
+  #define E0_AUTO_FAN_PIN                   PC9
222
+#endif
219 223
 
220 224
 //
221 225
 // Misc. Functions
@@ -227,16 +231,14 @@
227 231
 
228 232
 //
229 233
 // Onboard SD card
230
-//   NOT compatible with LCD
234
+// Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2
231 235
 //
232
-#if SDCARD_CONNECTION == ONBOARD && !HAS_SPI_LCD
236
+#if SD_CONNECTION_IS(ONBOARD)
233 237
   #define SOFTWARE_SPI                            // Use soft SPI for onboard SD
234 238
   #define SDSS                              PA4
235 239
   #define SCK_PIN                           PA5
236 240
   #define MISO_PIN                          PA6
237 241
   #define MOSI_PIN                          PB5
238
-#else
239
-  #define SDSS                              PB12
240 242
 #endif
241 243
 
242 244
 /**
@@ -256,6 +258,9 @@
256 258
 #if HAS_SPI_LCD
257 259
   #define BEEPER_PIN                        PG4
258 260
   #define BTN_ENC                           PA8
261
+  #if SD_CONNECTION_IS(LCD)
262
+    #define SDSS                            PB12  // Uses default hardware SPI for LCD's SD
263
+  #endif
259 264
 
260 265
   #if ENABLED(CR10_STOCKDISPLAY)
261 266
     #define LCD_PINS_RS                     PG6
@@ -272,6 +277,10 @@
272 277
     #undef ST7920_DELAY_2
273 278
     #undef ST7920_DELAY_3
274 279
 
280
+  #elif ENABLED(MKS_MINI_12864)
281
+    #define DOGLCD_A0                       PG6
282
+    #define DOGLCD_CS                       PG3
283
+
275 284
   #else
276 285
 
277 286
     #define LCD_PINS_RS                     PD10
@@ -321,3 +330,21 @@
321 330
   #endif
322 331
 
323 332
 #endif // HAS_SPI_LCD
333
+
334
+//
335
+// WIFI
336
+//
337
+
338
+/**
339
+ *          _____
340
+ *      TX | 1 2 | GND      Enable PG1   // Must be high for module to run
341
+ *  Enable | 3 4 | GPIO2    Reset  PG0   // Leave as unused (OK to leave floating)
342
+ *   Reset | 5 6 | GPIO0    GPIO2  PF15  // Leave as unused (best to leave floating)
343
+ *     3.3V| 7 8 | RX       GPIO0  PF14  // Leave as unused (best to leave floating)
344
+ *            ̄ ̄
345
+ *            W1
346
+ */
347
+#define ESP_WIFI_MODULE_COM 6                     // must also set SERIAL_PORT or SERIAL_PORT_2 to this
348
+#define ESP_WIFI_MODULE_BAUDRATE        BAUDRATE  //115200   // use BAUDRATE ?  would guarantee same baud rate as SERIAL_PORT & SERIAL_PORT_2
349
+#define ESP_WIFI_MODULE_RESET_PIN           -1
350
+#define ESP_WIFI_MODULE_ENABLE_PIN          PG1

+ 5
- 1
Marlin/src/pins/stm32f4/pins_FLYF407ZG.h View File

@@ -164,7 +164,11 @@
164 164
 #define SDIO_CK_PIN                         PC12
165 165
 #define SDIO_CMD_PIN                        PD2
166 166
 
167
-#if !defined(SDCARD_CONNECTION) || SD_CONNECTION_IS(ONBOARD)
167
+#ifndef SDCARD_CONNECTION
168
+  #define SDCARD_CONNECTION              ONBOARD
169
+#endif
170
+
171
+#if SD_CONNECTION_IS(ONBOARD)
168 172
   #define SDIO_SUPPORT                            // Use SDIO for onboard SD
169 173
 
170 174
   #ifndef SDIO_SUPPORT

Loading…
Cancel
Save