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.
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??
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)
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.)
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!
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
Configuring Build
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.
(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-
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.
Decompresss them and overwrite the existing configs in the Marlin folder, and your auto build configuration should update to this.
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.
for this as the compiler tells you to do, copy the PROBE_OFFSET_* portion of the default configuration,
and merge it back to our Configuration.h
to make it look something like this.
for SPEED_EDIT macros not being defined
just revert this entire portion of this code (or put it at the bottom of Configuration_adv.h),
and it should 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”
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
I’ve reverted this so I can have manual move options on the printer
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
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.
your directory structure should look like this.
flash on your display and motherboard and you’re good!
Happy Printing!
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.