Bladeren bron

🔨 MKS Robin E3 for HAL/STM32 (#21927)

ldursw 3 jaren geleden
bovenliggende
commit
6131d2c5a6
No account linked to committer's email address

+ 1
- 1
Marlin/src/pins/pins.h Bestand weergeven

@@ -503,7 +503,7 @@
503 503
 #elif MB(MKS_ROBIN_PRO)
504 504
   #include "stm32f1/pins_MKS_ROBIN_PRO.h"       // STM32F1                                env:mks_robin_pro
505 505
 #elif MB(MKS_ROBIN_E3)
506
-  #include "stm32f1/pins_MKS_ROBIN_E3.h"        // STM32F1                                env:mks_robin_e3
506
+  #include "stm32f1/pins_MKS_ROBIN_E3.h"        // STM32F1                                env:mks_robin_e3 env:mks_robin_e3_maple
507 507
 #elif MB(MKS_ROBIN_E3_V1_1)
508 508
   #include "stm32f1/pins_MKS_ROBIN_E3_V1_1.h"   // STM32F1                                env:mks_robin_e3
509 509
 #elif MB(MKS_ROBIN_E3D)

+ 10
- 1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h Bestand weergeven

@@ -176,8 +176,17 @@
176 176
 //
177 177
 // SD Card
178 178
 //
179
-#define SPI_DEVICE                             2
179
+#define SPI_DEVICE                          2
180
+#define ONBOARD_SPI_DEVICE                  2
181
+#define SDSS                           SD_SS_PIN
182
+#define SDCARD_CONNECTION                ONBOARD
180 183
 #define SD_DETECT_PIN                       PC10
184
+#define ONBOARD_SD_CS_PIN              SD_SS_PIN
185
+#define NO_SD_HOST_DRIVE
186
+
187
+// TODO: This is the only way to set SPI for SD on STM32 (for now)
188
+#define ENABLE_SPI2
189
+#define CUSTOM_SPI_PINS
181 190
 #define SD_SCK_PIN                          PB13
182 191
 #define SD_MISO_PIN                         PB14
183 192
 #define SD_MOSI_PIN                         PB15

+ 23
- 0
buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py Bestand weergeven

@@ -0,0 +1,23 @@
1
+#
2
+# stm32_serialbuffer.py
3
+#
4
+Import("env")
5
+
6
+# Marlin has `RX_BUFFER_SIZE` and `TX_BUFFER_SIZE` to configure the
7
+# buffer size for receiving and transmitting data respectively.
8
+# Stm32duino uses another set of defines for the same purpose,
9
+# so we get the values from the Marlin configuration and set
10
+# them in `SERIAL_RX_BUFFER_SIZE` and `SERIAL_TX_BUFFER_SIZE`.
11
+# It is not possible to change the values at runtime, they must
12
+# be set with build flags.
13
+#
14
+# The script will set the value as the default one (64 bytes)
15
+# or the user-configured one, whichever is higher.
16
+mf = env["MARLIN_FEATURES"]
17
+rxBuf = str(max(64, int(mf["RX_BUFFER_SIZE"]) if "RX_BUFFER_SIZE" in mf else 0))
18
+txBuf = str(max(64, int(mf["TX_BUFFER_SIZE"]) if "TX_BUFFER_SIZE" in mf else 0))
19
+
20
+build_flags = env.get('BUILD_FLAGS')
21
+build_flags.append("-DSERIAL_RX_BUFFER_SIZE=" + rxBuf)
22
+build_flags.append("-DSERIAL_TX_BUFFER_SIZE=" + txBuf)
23
+env.Replace(BUILD_FLAGS=build_flags)

+ 1
- 1
ini/stm32f1-maple.ini Bestand weergeven

@@ -268,7 +268,7 @@ extra_scripts = ${common_stm32f1.extra_scripts}
268 268
 # MKS Robin E3D (STM32F103RCT6) and
269 269
 # MKS Robin E3 with TMC2209
270 270
 #
271
-[env:mks_robin_e3]
271
+[env:mks_robin_e3_maple]
272 272
 platform      = ${common_stm32f1.platform}
273 273
 extends       = common_stm32f1
274 274
 board         = genericSTM32F103RC

+ 25
- 5
ini/stm32f1.ini Bestand weergeven

@@ -31,6 +31,8 @@ build_flags   = ${common.build_flags}
31 31
   -DADC_RESOLUTION=12
32 32
 build_unflags = -std=gnu++11
33 33
 src_filter    = ${common.default_src_filter} +<src/HAL/STM32> +<src/HAL/shared/backtrace>
34
+extra_scripts = ${common.extra_scripts}
35
+  pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
34 36
 
35 37
 #
36 38
 # BigTree SKR Mini V1.1 / SKR mini E3 / SKR E3 DIP (STM32F103RCT6 ARM Cortex-M3)
@@ -53,7 +55,7 @@ monitor_speed        = 115200
53 55
 board_build.core     = stm32
54 56
 board_build.variant  = MARLIN_F103Rx
55 57
 board_build.ldscript = ldscript.ld
56
-extra_scripts        = ${common.extra_scripts}
58
+extra_scripts        = ${common_stm32.extra_scripts}
57 59
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
58 60
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
59 61
 
@@ -136,13 +138,31 @@ build_flags          = ${common_stm32.build_flags}
136 138
   -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
137 139
 build_unflags        = ${common_stm32.build_unflags}
138 140
  -DUSBCON -DUSBD_USE_CDC
139
-extra_scripts        = ${common.extra_scripts}
141
+extra_scripts        = ${common_stm32.extra_scripts}
140 142
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
141 143
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
142 144
   buildroot/share/PlatformIO/scripts/mks_encrypt.py
143 145
 lib_deps             =
144 146
 
145 147
 #
148
+# MKS Robin E3/E3D (STM32F103RCT6) with TMC2209
149
+#
150
+[env:mks_robin_e3]
151
+platform                    = ${common_stm32.platform}
152
+extends                     = common_STM32F103RC
153
+build_flags                 = ${common_stm32.build_flags}
154
+  -DDEBUG_LEVEL=0 -DTIMER_SERVO=TIM5
155
+build_unflags               = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
156
+monitor_speed               = 115200
157
+board_build.offset          = 0x5000
158
+board_build.encrypt         = Yes
159
+board_build.firmware        = Robin_e3.bin
160
+board_upload.offset_address = 0x08005000
161
+debug_tool                  = stlink
162
+extra_scripts               = ${env:STM32F103RC.extra_scripts}
163
+  buildroot/share/PlatformIO/scripts/mks_encrypt.py
164
+
165
+#
146 166
 # Creality (STM32F103RET6)
147 167
 #
148 168
 [env:STM32F103RET6_creality]
@@ -181,7 +201,7 @@ board_build.firmware = Robin_mini.bin
181 201
 board_build.encrypt  = Yes
182 202
 board_upload.offset_address = 0x08007000
183 203
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
184
-extra_scripts        = ${common.extra_scripts}
204
+extra_scripts        = ${common_stm32.extra_scripts}
185 205
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
186 206
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
187 207
   buildroot/share/PlatformIO/scripts/mks_encrypt.py
@@ -204,7 +224,7 @@ board_upload.offset_address = 0x08007000
204 224
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
205 225
 debug_tool           = jlink
206 226
 upload_protocol      = jlink
207
-extra_scripts        = ${common.extra_scripts}
227
+extra_scripts        = ${common_stm32.extra_scripts}
208 228
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
209 229
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
210 230
   buildroot/share/PlatformIO/scripts/mks_encrypt.py
@@ -222,6 +242,6 @@ board_build.ldscript = ldscript.ld
222 242
 board_build.offset   = 0x10000
223 243
 build_flags          = ${common_stm32.build_flags} -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
224 244
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
225
-extra_scripts        = ${common.extra_scripts}
245
+extra_scripts        = ${common_stm32.extra_scripts}
226 246
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
227 247
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py

Laden…
Annuleren
Opslaan