Building Marlin for my modified Ender 3

Sep 22, 2022 marlin ender 3d printing firmware bigtreetech bltouch

This is a memory-jogger for me when making changes to my 3D printer’s firmware.

Background

A while back I upgraded my Ender 3 Pro 3D printer by replacing the standard motherboard with the Bigtreetech SKR Mini E3 V1.2 32 bit board (long since superseded by their newer boards). I also added a BLTouch sensor for automatic levelling.

Before the upgrade the servo noise drowned out the fan noise; after, the smoother driving from the new board made them almost silent in comparison. The printer has some distortion (I think in the build plate) but with the BL Touch it can compensate for this exactly.

Out of the box, the Ender 3 runs a lightly modified version of the Marlin firmware.

However, the BLTouch supporting firmware from BigTreeTech never worked for me. Their fork of the Marlin firmware, while openly available, wasn’t very coherently documented and I got the impression that the staffer populating it didn’t really understand source control - it’s never a good sign when you get a bunch of commits that all have a commit message reading “first commit” ! Some of the commits seemed to be non-working and others semi-working, so I gave up on using their repo directly. It does look like it got a bit of love from OSS-savvy contributors later though.

However, I was able to combine some info from some Reddit threads including this one, the example Marlin configurations, and the modifications in the BTT repository, to figure it out for the actual Marlin repository.

For reference, my changes were against commit a52afd2aebeb1029f80f175489e66a310de4197d of Marlin which was on the 2.0.6.x branch and here’s a link to my patch against that. Note that some changes (probe offsets) are hardware instance specific, so you will need to tweak it at least slightly if you’re not me!

One additional change in there - I did a few experiments using the printer as a plotter with a pen affixed to the print head carriage, so my patch turns on the BEZIER_CURVE_SUPPORT feature to allow for bezier curves to be drawn via the G5 gcode command.

Platform IO

I prefer to be able to be build stuff at the command line - I don’t want to mess around with ArduinoIDE (cool though it is). Happily you can build Marlin using Platform IO. Marlin’s instructions are pretty good, but a couple of notes of my own:

I tried using the apt installed version of Platform IO, but running the build with that produces the following error:

Error: Detected unknown package 'ststm32'

Instead install an up-to-date version of PlatformIO Core as documented on the PlaformIO site.

With that version you should be able to run a build to successful completion with the following command:

platformio run -e STM32F103RC_btt_512K

Upon successful completion the image file should be written to .pio/build/STM32F103RC_btt_512K as firmware.bin

Copying that onto the root of an SD card, popping it into the printer SD slot, and starting up the printer should result in the firmware being applied.

Next steps…

The main pain point I have now with the printer is that when printing something large I have to figure out how to split it into smaller parts that can be glued or otherwise fastened together. To address this, I have an Ender Extender on order, which will let me have a print bed of 40cm square.

Some minor firmware upgrades (dimensions mostly) will be necessary to accommodate that. Once I’ve got the printer back in action after that upgrade I will figure out how to apply my configuration changes to the latest version of Marlin instead of the 2.0.x series.

© 2017 - 2022 Dave Minter