Skip to content

Commit fd1acb5

Browse files
committed
Remove BTTSKRMINIE3V2_USBMOD, use BTTSKRMINIE3V2 instead
For the past two years I've had only occasional issues with a BTTSKRMINIE3V2_USBMOD build my the SKR MINI, but after upgrading to a faster Pi (64-bit OS) for Klipper, some major problems with this mod became evident. Hard-wiring the USB D+ pullup to 3V3 causes the host to enumerate it as soon as a soft reset is issued, whereby the firmware (and this bootloader) have not had time to properly initialize and get USB ready. This stalls USB hubs, times out the Ethernet controller on Raspberry Pis, and causes all kinds of other issues, thus, I'm discouraging its use and removing the target. Regarding the debugging difficulties motivating BTTSKRMINIE3V2_USBMOD, they can be solved with a proper debugging setup. I'm able to successfully debug the MCU even with the USB pullup MOSFET and the STATUS LED attached to SWDCLK and SWDIO respectively using a FT232H. As such, the BTTSKRMINIE3V2 target should be used instead, and I've also re-added control of the STATUS LED to indicate bootloader presence.
1 parent 94762bd commit fd1acb5

5 files changed

Lines changed: 14 additions & 140 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ To build other targets, you can override the
2222
|`OLIMEXSTM32H103` | Olimex STM32-H103 | https://www.olimex.com/Products/ARM/ST/STM32-H103/ |
2323
|`BLUEPILLPLUSSTM32` | Bluepill with USB C | https://github.com/WeActTC/BluePill-Plus/ |
2424
|`BTTSKRMINIE3V2` | BigTreeTech SKR MINI E3 V2.0 (3D printer motherboard) | https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3 |
25-
|`BTTSKRMINIE3V2_USBMOD` | BTT SKR MINI E3 V2.0 with USB pullup removed | https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3 |
2625

2726
For the above targets there are some potential variants that can be added to the target name based on what the target supports:
2827

release.Makefile

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ all: dapboot-bluepill.bin \
3535
dapboot-olimexstm32h103.bin \
3636
dapboot-bluepillplusstm32.bin \
3737
dapboot-bttskrminie3v2.bin \
38-
dapboot-bttskrminie3v2-usbmod.bin \
3938
dapboot-bluepill-high.bin \
4039
dapboot-maplemini-high.bin \
4140
dapboot-stlink-high.bin \
@@ -46,8 +45,7 @@ all: dapboot-bluepill.bin \
4645
dapboot-stlink-high-128.bin \
4746
dapboot-olimexstm32h103-high-128.bin \
4847
dapboot-bluepillplusstm32-high-128.bin \
49-
dapboot-bttskrminie3v2-high-256.bin \
50-
dapboot-bttskrminie3v2-usbmod-high-256.bin
48+
dapboot-bttskrminie3v2-high-256.bin
5149

5250
clean:
5351
$(Q)$(RM) $(BUILD_DIR)/*.bin
@@ -94,12 +92,6 @@ dapboot-bttskrminie3v2.bin: | $(BUILD_DIR)
9492
$(Q)$(MAKE) TARGET=BTTSKRMINIE3V2 -C src/
9593
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)
9694

97-
dapboot-bttskrminie3v2-usbmod.bin: | $(BUILD_DIR)
98-
@printf " BUILD $(@)\n"
99-
$(Q)$(MAKE) TARGET=BTTSKRMINIE3V2_USBMOD -C src/ clean
100-
$(Q)$(MAKE) TARGET=BTTSKRMINIE3V2_USBMOD -C src/
101-
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)
102-
10395
dapboot-bluepill-high.bin: | $(BUILD_DIR)
10496
@printf " BUILD $(@)\n"
10597
$(Q)$(MAKE) TARGET=BLUEPILL_HIGH -C src/ clean
@@ -165,9 +157,3 @@ dapboot-bttskrminie3v2-high-256.bin: | $(BUILD_DIR)
165157
$(Q)$(MAKE) TARGET=BTTSKRMINIE3V2_HIGH_256 -C src/ clean
166158
$(Q)$(MAKE) TARGET=BTTSKRMINIE3V2_HIGH_256 -C src/
167159
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)
168-
169-
dapboot-bttskrminie3v2-usbmod-high-256.bin: | $(BUILD_DIR)
170-
@printf " BUILD $(@)\n"
171-
$(Q)$(MAKE) TARGET=BTTSKRMINIE3V2_USBMOD_HIGH_256 -C src/ clean
172-
$(Q)$(MAKE) TARGET=BTTSKRMINIE3V2_USBMOD_HIGH_256 -C src/
173-
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)

src/stm32f103/skrminie3v2/config.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,18 @@
3636
#define DFU_WILL_DETACH 0
3737
#endif
3838

39-
/* There is a PCB-mounted status LED, but it's unreadable when the board is installed,
40-
* and additionally it's wired to SWDIO so toggling it manually is a bad idea */
39+
/* STATUS LED */
4140
#ifndef HAVE_LED
42-
#define HAVE_LED 0
41+
#define HAVE_LED 1
42+
#endif
43+
#ifndef LED_OPEN_DRAIN
44+
#define LED_OPEN_DRAIN 0
45+
#endif
46+
#ifndef LED_GPIO_PORT
47+
#define LED_GPIO_PORT GPIOA
48+
#endif
49+
#ifndef LED_GPIO_PIN
50+
#define LED_GPIO_PIN GPIO13
4351
#endif
4452

4553
/* Display encoder button (BTN-ENC) on PA15, no external pullup */
@@ -82,8 +90,8 @@
8290
#define USES_GPIOA 1
8391
#endif
8492

85-
/* For stm32duino bootloader compatibility, the following options enable
86-
* bootloader flashing using KIAUH: https://github.com/th33xitus/kiauh */
93+
/* For stm32duino bootloader compatibility, the following options enable bootloader flashing using Klipper:
94+
* https://github.com/Klipper3d/klipper/blob/6d48adf9ef5d17632acf53a7e3a07964f6cfd642/src/stm32/stm32f1.c#L238 */
8795
#ifndef REG_BOOT
8896
#define REG_BOOT BKP10
8997
#endif

src/stm32f103/skrminie3v2_usbmod/config.h

Lines changed: 0 additions & 106 deletions
This file was deleted.

src/targets.mk

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,6 @@ ifeq ($(TARGET),BTTSKRMINIE3V2_HIGH_256)
139139
ARCH = STM32F1
140140
DEFS += -DBOOTLOADER_HIGH
141141
endif
142-
ifeq ($(TARGET),BTTSKRMINIE3V2_USBMOD)
143-
TARGET_COMMON_DIR := ./stm32f103
144-
TARGET_SPEC_DIR := ./stm32f103/skrminie3v2_usbmod
145-
LDSCRIPT := ./stm32f103/stm32f103x8.ld
146-
ARCH = STM32F1
147-
endif
148-
ifeq ($(TARGET),BTTSKRMINIE3V2_USBMOD_HIGH_256)
149-
TARGET_COMMON_DIR := ./stm32f103
150-
TARGET_SPEC_DIR := ./stm32f103/skrminie3v2_usbmod
151-
LDSCRIPT := ./stm32f103/stm32f103xc_high.ld
152-
ARCH = STM32F1
153-
DEFS += -DBOOTLOADER_HIGH
154-
endif
155142
ifeq ($(TARGET),STM32L1_GENERIC)
156143
TARGET_COMMON_DIR := ./stm32l1
157144
TARGET_SPEC_DIR := ./stm32l1/generic

0 commit comments

Comments
 (0)