Browse Source

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

ldursw 3 years ago
parent
commit
6131d2c5a6
No account linked to committer's email address

+ 1
- 1
Marlin/src/pins/pins.h View File

503
 #elif MB(MKS_ROBIN_PRO)
503
 #elif MB(MKS_ROBIN_PRO)
504
   #include "stm32f1/pins_MKS_ROBIN_PRO.h"       // STM32F1                                env:mks_robin_pro
504
   #include "stm32f1/pins_MKS_ROBIN_PRO.h"       // STM32F1                                env:mks_robin_pro
505
 #elif MB(MKS_ROBIN_E3)
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
 #elif MB(MKS_ROBIN_E3_V1_1)
507
 #elif MB(MKS_ROBIN_E3_V1_1)
508
   #include "stm32f1/pins_MKS_ROBIN_E3_V1_1.h"   // STM32F1                                env:mks_robin_e3
508
   #include "stm32f1/pins_MKS_ROBIN_E3_V1_1.h"   // STM32F1                                env:mks_robin_e3
509
 #elif MB(MKS_ROBIN_E3D)
509
 #elif MB(MKS_ROBIN_E3D)

+ 10
- 1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h View File

176
 //
176
 //
177
 // SD Card
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
 #define SD_DETECT_PIN                       PC10
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
 #define SD_SCK_PIN                          PB13
190
 #define SD_SCK_PIN                          PB13
182
 #define SD_MISO_PIN                         PB14
191
 #define SD_MISO_PIN                         PB14
183
 #define SD_MOSI_PIN                         PB15
192
 #define SD_MOSI_PIN                         PB15

+ 23
- 0
buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py View File

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 View File

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

+ 25
- 5
ini/stm32f1.ini View File

31
   -DADC_RESOLUTION=12
31
   -DADC_RESOLUTION=12
32
 build_unflags = -std=gnu++11
32
 build_unflags = -std=gnu++11
33
 src_filter    = ${common.default_src_filter} +<src/HAL/STM32> +<src/HAL/shared/backtrace>
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
 # BigTree SKR Mini V1.1 / SKR mini E3 / SKR E3 DIP (STM32F103RCT6 ARM Cortex-M3)
38
 # BigTree SKR Mini V1.1 / SKR mini E3 / SKR E3 DIP (STM32F103RCT6 ARM Cortex-M3)
53
 board_build.core     = stm32
55
 board_build.core     = stm32
54
 board_build.variant  = MARLIN_F103Rx
56
 board_build.variant  = MARLIN_F103Rx
55
 board_build.ldscript = ldscript.ld
57
 board_build.ldscript = ldscript.ld
56
-extra_scripts        = ${common.extra_scripts}
58
+extra_scripts        = ${common_stm32.extra_scripts}
57
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
59
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
58
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
60
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
59
 
61
 
136
   -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
138
   -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
137
 build_unflags        = ${common_stm32.build_unflags}
139
 build_unflags        = ${common_stm32.build_unflags}
138
  -DUSBCON -DUSBD_USE_CDC
140
  -DUSBCON -DUSBD_USE_CDC
139
-extra_scripts        = ${common.extra_scripts}
141
+extra_scripts        = ${common_stm32.extra_scripts}
140
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
142
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
141
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
143
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
142
   buildroot/share/PlatformIO/scripts/mks_encrypt.py
144
   buildroot/share/PlatformIO/scripts/mks_encrypt.py
143
 lib_deps             =
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
 # Creality (STM32F103RET6)
166
 # Creality (STM32F103RET6)
147
 #
167
 #
148
 [env:STM32F103RET6_creality]
168
 [env:STM32F103RET6_creality]
181
 board_build.encrypt  = Yes
201
 board_build.encrypt  = Yes
182
 board_upload.offset_address = 0x08007000
202
 board_upload.offset_address = 0x08007000
183
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
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
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
205
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
186
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
206
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
187
   buildroot/share/PlatformIO/scripts/mks_encrypt.py
207
   buildroot/share/PlatformIO/scripts/mks_encrypt.py
204
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
224
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
205
 debug_tool           = jlink
225
 debug_tool           = jlink
206
 upload_protocol      = jlink
226
 upload_protocol      = jlink
207
-extra_scripts        = ${common.extra_scripts}
227
+extra_scripts        = ${common_stm32.extra_scripts}
208
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
228
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
209
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
229
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
210
   buildroot/share/PlatformIO/scripts/mks_encrypt.py
230
   buildroot/share/PlatformIO/scripts/mks_encrypt.py
222
 board_build.offset   = 0x10000
242
 board_build.offset   = 0x10000
223
 build_flags          = ${common_stm32.build_flags} -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
243
 build_flags          = ${common_stm32.build_flags} -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
224
 build_unflags        = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
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
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
246
   pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
227
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py
247
   buildroot/share/PlatformIO/scripts/stm32_bootloader.py

Loading…
Cancel
Save