ordinary nonsense

I swear I'll find something to write someday


Project maintained by surepy Hosted on GitHub Pages — Theme by mattgraham

Flashing Latest Marlin on Aquila X2 with H32 chip

It’s been a while since I wrote anything, because everything I do is pretty well documented and just requires me to actually read existing documentation, or someone else already wrote an article about it.

However this time there wasn’t really a single article about it and I probaly want to come back to how to do this, so here we go.

The situation until 2023

I bought a Aquila X2 (well, I really didn’t but that’s a story for a different day) around a year ago, and wanted to print some stuff with octoprint

… and it didn’t really work at all for me, not to mention this pretty scary message.

unsafe firmware warning
scary!

Thankfully, a custom firmware fixe- oh I can’t use any of these.

Thankfully (Attempt 2), alexqzd (our savior) has a h32 build with some known issues (which I haven’t really ran into), but it works perfectly for printing.

though,

⚠️ This firmware is no longer being maintained.
I have moved on to other projects and this firmware is no longer being developed.

alex stopped maintaining his fork of Marlin, and I thought a more updated build for my H32 printer would be nice.

Our new god, shadow578 blesses us

in r/VoxelabAquila, a post is made

Marlin for the Voxlab Aquila X2 (H32) - u/shadow_578

:O no way?

since the aquila X2 with H32 SoC has very little support for custom firmware, i decided to port marlin to the H32 myself.

:OO??

a pre-built firmware is available under releases, but you can also build the firmware yourself following the readme.

:OOOOO??

shadow's marlin repo

aw, the prebuilt binaries aren’t there anymore… wait.
EDIT: looks like they’re still there but github is hiding the releases???

(now in upstream)

shookt-shocked

Well, let’s try it out!

Building

NOTE: As of time of writing, H32 (aka HC32F460JEUA / HC32) is only in the bugfix-2.1.x branch, which is considered “Nightly”, and could be unstable. You have been warned!

Okay, let’s get Building.

Prerequsites and Preparing

Install Visual Studio Code, with Auto build Marlin extension. (This should also install PlatformIO IDE for you.)

Auto build Marlin

Also download Marlin’s source code by either cloning https://github.com/MarlinFirmware/Marlin.git, or download it from https://marlinfw.org/meta/download/

Make sure you either clone or download the bugfix-2.1.x verion/branch!

cloning
I named it marlin2 because I already had a marlin folder, just name it marlin.

NOTE: This will change. if H32 is in the stable release, use that one instead. (at the moment H32 is not in the stable release) I will try to edit this portion when that happens.

now open the folder that you just downloaded or cloned, make sure you’re in the directory where platformio.ini exists

platformio.ini

Configuring Build

default auto build configuration

You should be greeted with this screen. as you can see “RAMPS 14 EFB” is probably not what we want, and our archtecture is probably not “ATmega2560”
Hint: it’s not

so let’s go configuring.

Open platformio.ini and change default_envs to HC32F460C_aquila_101 to change the default board configuration on platformIO.

default_envs diff
(This value is defined by ini/hc32.ini)

Now we need to modifyConfiguration.h and Configuration_adv.h for actaully building for our board.

Instead of trying to configure it ourselves and probably messing up, We’re gonna use Sample Configurations (provided by shadow578).

He uploads his sample configurations in his github issues, linked below
>> https://github.com/shadow578/Marlin-H32/issues/38 «

For this guide, we will be using this specific configuration-
nov 11 aquila config
but even if a new configuration is released the guide should be relatively the same.

Download the zip file and you will be greeted with these two files that we happened to need.

Aquila-X2_config.zip

Decompresss them and overwrite the existing configs in the Marlin folder, and your auto build configuration should update to this.

Updated Build

Unfortunately, We can’t just build as-is with this configuration, and need to make some changes to make it build.

And there might be more issues that you have to fix, as this branch is a nightly branch and there could be destructive changes in configurations.

Fortunately, These errors are pretty straightforward to fix, as the compiler error just straight up tells us what to do.

Z_PROBE_OFFSET_RANGE_ is now PROBE_OFFSET

for this as the compiler tells you to do, copy the PROBE_OFFSET_* portion of the default configuration, Screenshot_20240328_002558

and merge it back to our Configuration.h

Screenshot_20240328_002751

to make it look something like this.

for SPEED_EDIT macros not being defined

SPEED_EDIT_* not declared

just revert this entire portion of this code (or put it at the bottom of Configuration_adv.h),

revert this code

and it should build!

Successful build

Congratulations! you now have a latest Marlin build for your X2!

Display Firmware

Alex’s display firmware nor the default firmware will not work for us, so let’s get one!

The X2’s display is actually the same as Ender-3 V2’s screen, named “DWIN display”

DWIN display aquila x2 and aquila's display

you can see that they are literally the same.

So we just grab the LCD files from the Example Configuration of Ender-3 V2
- aka DWIN_SET.tar.gz and you’re done!

Customizing

This is kind of out of scope for this guide, but you should consider looking into configurations more.

Please check Marlin’s documentation on configuration for more info!

For example

manual move
I’ve reverted this so I can have manual move options on the printer

m92
I’ve also reverted this so M92 gets included

I recommend you look into stuff like Linear Advance, Input Shaping, etc also.

Flashing

Flashing is the same with all the other firmwares for the x2, so I’m just gonna brush over it.

Grab a random sdcard, and format it to fat32

fat32

extract DWIN_SET folder to sdcard
and also firmware.bin from <Marlin-folder>/.pio/build/HC32F460C_aquila_101/firmware.bin to sdcard, in a folder called firmware.

directory structure
your directory structure should look like this.

flash on your display and motherboard and you’re good!

Happy Printing!

marlin boot screen on h32

You did it! Now you’re on upstream Marlin with your H32 aquila X2!

I hope you get to make cool stuff with this!

Thank you to shadow578 (aka Chris) for making this possible.

References/Links

Written on March 28, 2024