makerbase-mks / MKS-Monster8

MKS Monster8 is an 8-axis motherboard, which supports Voron printers and can run Marlin and Klipper firmware.
https://www.aliexpress.com/item/1005003183498253.html?spm=a2g0o.store_pc_home.productList_8356958.pic_0
GNU General Public License v3.0
109 stars 64 forks source link

How to - Visual Code, STM32CubeProgrammer, compiling Marlin and upload via USB C DFU Boot0 method #32

Closed HattonLe closed 1 year ago

HattonLe commented 1 year ago

Here's how to upload firmware to Monster8 using STM32CubeProgrammer via the USB C connection.

Install Visual Code and then add in the extensions for PlatformIO and "Auto Build Marlin". Download the Marlin source code zip file from github and unzip it somewhere accessible for Visual Code. Now find in that unzipped code the file in folder "Monster8\Marlin-2.0.x\ini" called "stm32f4.ini" You want to edit that file to change lines 410, 411 to read as follows --> board_build.offset = 0x0000 board_upload.offset_address = 0x08000000

Now use Visual Code to compile (using Marlin AutoBuilder works fine for this) using the environment called "mks_Monster8". The compiled file will be found in folder "Monster8\Marlin-2.0.x.pio\build\mks_monster8" and it will be called either "firmware.bin", "firmware.elf" or "mks_monster8.bin" (you can use either of them for the following download process).

Attach your Monster8 board to your computer via its USB C socket (you can't use the USB 2.0 connector for this activity). Press and hold down the "Boot0" button and either power on the Monster8 board or press and release the "Reset" button. Your computer should then detect a USB device has arrived - It will be show right at the bottom of Windows "Device Managers list", called "STM32 BOOTLOADER".

Run up STM32CubeProgrammer, in the top right corner, select "USB" and click "Connect". This will connect to the Monster8 board and show details about the STM32F407 processor. In STM32CubeProgrammer, Open File to the "firmware.bin" file from above, and then click "Download" to send it to the Monster8. Then just reset or reboot your Monster8 board to get your new code up and running. Hope this helps anyone stuck trying to get things going :o)

HattonLe commented 1 year ago

I should warn you that if you use decide to use BOOT0 DFU mode, that you should physically disable your heat bed (e.g. by removing fuse FS1) before entering DFU mode. See issue #26 if in doubt why. I have modified my Monster8 board to change the MOSFET Q7 gate drive signal. I disconnected PB10 (by removing the 100 Ohm resistor) and connected the MOSFET gate to PA8 (used for 3DTouch). This modification stops the hotbed from heating up when you go into DFU mode.