Sidewinder X4 Plus MCU not found anymore

Basic Information:

Printer Model: Artillery Sidewinder X4 Plus
MCU / Printerboard: STM32F407
Host / SBC Artillery KL v1.01 (makerbase mks-pi clone?)
klippy.log (no log because it just shows that /dev/serial/... is missing)

Describe your issue:

The X4 Plus uses a custom klipper repo, but I’ve done changes to it and flashed it to the board and the MCU successfully many times. But the last time I wanted to flash a newer version I think I messed up by flashing klipper configured with No Bootloader set in make menuconfig. Now the MCU is effectively dead. lsusb doesn’t show the device anymore, and /dev/serial/... doesn’t exist either. I managed to get the mcu in DFU mode by bridging BOOT0 on the board with a wire (they didn’t solder a button here…) and pressing RESET at the same time.
This is how the device shows up in dmesg when I do this

[  109.674081] usb 1-1: new full-speed USB device number 2 using dwc2
[  109.883577] usb 1-1: New USB device found, idVendor=0483, idProduct=df11, bcdDevice=22.00
[  109.883622] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  109.883646] usb 1-1: Product: STM32  BOOTLOADER
[  109.883664] usb 1-1: Manufacturer: STMicroelectronics
[  109.883683] usb 1-1: SerialNumber: 329A36663033

and dfu-util -l:

Found DFU: [0483:df11] ver=2200, devnum=2, cfg=1, intf=0, path="1-1", alt=3, name="@Device Feature/0xFFFF0000/01*004 e", serial="329A36663033"
Found DFU: [0483:df11] ver=2200, devnum=2, cfg=1, intf=0, path="1-1", alt=2, name="@OTP Memory /0x1FFF7800/01*512 e,01*016 e", serial="329A36663033"
Found DFU: [0483:df11] ver=2200, devnum=2, cfg=1, intf=0, path="1-1", alt=1, name="@Option Bytes  /0x1FFFC000/01*016 e", serial="329A36663033"
Found DFU: [0483:df11] ver=2200, devnum=2, cfg=1, intf=0, path="1-1", alt=0, name="@Internal Flash  /0x08000000/04*016Kg,01*064Kg,01*128Kg", serial="329A36663033"

I have tried multiple different variations of flashing CanBoot/Katapult and klipper, but nothing seems to have any effect, when I reboot, the device just doesn’t show up. I’ve tried flashing only katapult, katapult and then klipper with an offset, and only flashing klipper. All with different bootloader offsets in make menuconfig. The flashing always works without errors, but after a restart it just didn’t change anything.

make menuconfig for katapult

Katapult Configuration v0.0.1-75-g90eb71b
    Micro-controller Architecture (STMicroelectronics STM32)  --->
    Processor model (STM32F407)  --->
    Build Katapult deployment application (32KiB bootloader)  --->
    Clock Reference (8 MHz crystal)  --->
    Communication interface (USB (on PA11/PA12))  --->
    Application start offset (32KiB offset)  --->
    USB ids  --->
()  GPIO pins to set on bootloader entry
[ ] Support bootloader entry on rapid double click of reset button
[ ] Enable bootloader entry on button (or gpio) state
[ ] Enable Status LED

make menuconfig settings for klipper:

  Klipper Firmware Configuration
[ ] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32)  --->
    Processor model (STM32F407)  --->
    Bootloader offset (32KiB bootloader)  --->
    Communication interface (USB (on PA11/PA12))  --->

Example output of a flash:

 sudo dfu-util -a 0 -D ./out/klipper.bin --dfuse-address 0x08000000:force:mass-erase:leave -d 0483:df11
[sudo] password for mks:
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Performing mass erase, this can take a moment
Setting timeout to 35 seconds
Downloading to address = 0x08000000, size = 26544
Download        [=========================] 100%        26544 bytes
Download done.
File downloaded successfully
Transitioning to dfuMANIFEST state

After flashing, dmesg just shows

[ 1760.710344] usb 1-1: USB disconnect, device number 2

(nothing else after that).

I couldn’t find a real datasheet for the Board that they are using, just images from replacement parts… Artillery3d Mainboard For SW-X4 PRO / X4 Plus

Can anyone tell me what I’m supposed to flash in what order, so that the MCU will work again? I’m not entirely clear how the bootloader chain is supposed to work, so I’ve just been trying solutions to similar problams I’ve found.

I’ve already tried the steps from here (with STM32F401 replaced with STM32F407): Sidewinder X4 Pro flash STM32F401xc - #5 by AutoComplete
But for me after the CanBoot flashing step, the MCU just doesn’t show up

Right now the klipper Version they are using is based on 0.10.X, but I also have my own branch where I ported their changed to the latest master (0.12.X) and had it printing successfully. Right now I’m just back to 0.10.X because I flashed their official image again to make sure none of my changes I made to the system were the problem.

Try following approach:

  1. Build Katapult

  2. Put the board into DFU mode

  3. Flash Katapult with

    sudo dfu-util -a 0 -D ~/katapult/out/katapult.bin --dfuse-address 0x08000000:force:mass-erase:leave -d 0483:df11
    
  4. Build Klipper

  5. Check with sudo dmesg. Should roughly look like below. Check for the TTY address

  6. Flash Klipper with make flash FLASH_DEVICE=/dev/ttyACM2. Replace /dev/ttyACM2 with the one from your dmesg command

I think I figured it out with the help of someone in the klipper Discord… Even though in the system image that Artillery ships, klippers make menuconfig is configured for STM32F407 and the binary that is already built in .../out/klipper.bin is also built for the F407, the chip that is actually used in the X4 Plus is the 401…

I built and flashed klipper built for F401 with “No Bootloader” as bootloader offset now in DFU mode by just doing make flash FLASH_DEVICE=0483:df11 while the device is in DFU mode, and it shows up in /dev/serial/... again now.

So, for anyone else who accidentally flashed something bad to the X4 Plus MCU, to fix it you need to

  1. Open up the chassis so you have access to the board
  2. While the system is running, Press the RESET button on the board while bridging the BOOT0 pins with a wire (right next to the RESET button where they didn’t put a button for some reason…). Have sudo dmesg -w running to see if it works, there will be messages about a new device when the BOOT0 pins had proper contact. It’s really finicky to get it to work, took me ~10 tries every time to get it to work, there isn’t really space for fingers in the place where they put the board.
  3. Change the klipper config with make menuconfig from STM32F407 to STM32F401 and set Booloader offset to “No Bootloader”, leave the rest as it comes in the system image.
  4. make clean && make && make flash FLASH_DEVICE=0483:df11

The MCU should show up again.

After this is done, you can flash the MCU the next time with make flash FLASH_DEVICE=/dev/serial/by-id/... (Press TAB, there should be only 1 device here)

I’ll edit this post if I can also make it work with a bootloader now.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.