Marlin 1.1.9 on TronXY X5S (“Melzi” style board)

There really are enough tutorials out there on how to get the bootloader into that board (not neccessary for me as mine already had it), avoiding the snares of Sanguino yourself or even complete Arduino IDEs, ready to be masticated via Google Drives. Besides that, I already dropped some links on that baud rate / boards.txt topic and the OctoPi Firmware Uploader myself (as Junk electronics, new electronics). So here  I’ll just list up a few changes to get a “clean Marlin” working on a TronXY X5S Melzi (8bit) Board.

On Marlin 1.1.9 ou want to configure…
…besides the obvious stuff like
and so on.

YouMagine-Link to the header files and binaries at the bottom.

TronXY Melzi

In detail:

The reason for me to post this is, again*, Cunningham’s Law: “The best way to get the right answer on the internet is not to ask a question; it’s to post the wrong answer.” (Meta-Wiki).

The “wrong answer of the week” for me was, after re-building my X5S to a direct/non-bowden “Btech” (Bondtech drivegear clone) configuraion, just flashing the newest Marlin from Thingiverse. And then not being able to print circles at speed. Unlike the first version I sumbled upon, this time the uploader had  tossed in some work-in-progress with a completely messed-up configuration. (Timings, buffer sizes, …)

After verifying, that my old version of Marlin 1.1.8 was working like charm and the version of 1.1.9 I downloaded was indeed the cause of error (after all I just had changed some critical hardware) I set out to start from a clean copy. From (With lots of dust caps for my SchuKo socket outlets in the drawer, as these were my “curve test prints”. 😉 )

There are even more tutorials on customizing Marlin out there, than on any X5S specific topic, so if you have questions: Ask Thomas Sanladerer and the others out there about the way to do it.

As I now had to use WinMerge (like Airtripper suggested here) to compare entire folders, and I didn’t like digging through the 309 files of Marlin 1.1.9, I tried to stick to just changing “Configuration.h” and “Configuration_adv.h” this time. Which works – and if you only want to compare two files at once, you can get along with ExamDiff (which doens’t even need to be installed). Much more comfortable.

So what are the lines to alter or comment to get “the final release of the 8-bit flat version of Marlin Firmware” working on an X5S? The “Configuring Marlin 1.1” chapter of is pretty good, but here is the “short” summary of what I did:


Hardware / Kinematics / mechanical configuration – basics

Look! TronXY now have their own “pins_MELZI_TRONXY.h” file. (So that’s the reason there are over 300 files in that folder…)


The Sanguino / Melzi usually runs at 115200 baud (not 250000).

#define BAUDRATE 115200

Just in case somebody actives “volumetric extrusion”:


This should be already a “1”. (I have a “5” for my E3Dv5, look at your Hot End documentation, if you also changed yours)…

 #define TEMP_SENSOR_0 1 // TronXY Mk8 Hotend

Stardard is “no heated bed”. But we have one:


Obviously, we need this…

#define COREXY

These endstops work the other way round.

#define X_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Y_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.

A4988 is default, but I guss we can also clearly state this:

#define X_DRIVER_TYPE  A4988
#define Y_DRIVER_TYPE  A4988
#define Z_DRIVER_TYPE  A4988
//#define X2_DRIVER_TYPE A4988
//#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE A4988

If you don’t want to invert the connector (or re-arrange it’s crimped contacts):

#define INVERT_X_DIR true

Just being careful here…

#define Z_HOMING_HEIGHT 20 // 4 

Even with OctoPrint you might still prefer the reliability of SD cards – or use them as backup, if the Pi has messed up it’s OS again:


To get the encoder and display working the way I wanted them I had to try our a few things (no, it is neither the “REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER” nor the “ANET_FULL_GRAPHICS_LCD”!)


Parameters to tune / match to your specimen

This is mostly geometry. Your Extruder should be tuned, though:

#define DEFAULT_AXIS_STEPS_PER_UNIT    { 80, 80, 400, 90 } // Stock TronXY Extruder

Slight alterations here:

#define DEFAULT_MAX_FEEDRATE          { 250, 250, 25, 70 } // { 300, 300, 5, 25 } 

Stole the X- and Y-values from Prusa. 😉

#define DEFAULT_MAX_ACCELERATION    { 1250, 1250, 100, 3000 } 

These values are less important, because they could be overwritten by the slicer.

##define DEFAULT_ACCELERATION          1250 // 3000    // X, Y, Z and E acceleration for printing moves
#define DEFAULT_RETRACT_ACCELERATION  3000    // E acceleration for retracts
#define DEFAULT_TRAVEL_ACCELERATION   1250 // 3000    // X, Y, Z acceleration for travel (non printing) moves

Still playing with these – more “jerk” means less acceleration and deceleration.

#define DEFAULT_XJERK                 15.0 // 10.0
#define DEFAULT_YJERK                 15.0 // 10.0
#define DEFAULT_ZJERK                  0.4 // 0.3

At line 380 (in the original file) add your own Autotuning values!

Use e.g. “M303 E0 S220 C8” (, while everything is in printing state (heaters on, fans on etc.)

Change this to get your prints starting earlier:

// Extruder temperature must be close to target for this long before M109 returns success
#define TEMP_RESIDENCY_TIME 5 // 10  // (seconds)
#define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_WINDOW     3 // 1       // (degC) Window around target to start the residency timer x degC early.

// Bed temperature must be close to target for this long before M190 returns success
#define TEMP_BED_RESIDENCY_TIME 20 // 10  // (seconds)
#define TEMP_BED_HYSTERESIS 5 // 3       // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_BED_WINDOW     1       // (degC) Window around target to start the residency timer x degC early.

I prefer these temperatures for “Preheating” via menu:

// Preheat Constants
#define PREHEAT_1_TEMP_BED     60
#define PREHEAT_1_FAN_SPEED     0 // Value from 0 to 255
#define PREHEAT_2_TEMP_BED     80
#define PREHEAT_2_FAN_SPEED     0 // Value from 0 to 255

This was manually establshed for my specific modifications:

// The size of the print bed
#define X_BED_SIZE 330
#define Y_BED_SIZE 320
// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS -5.0 // 0
#define Y_MIN_POS -0.5 // 0
#define Z_MIN_POS 0
#define Z_MAX_POS 410

I can live without those – at least until alls those mins and maxes are really set up properly (which they aren’t):


We can speed up a bit here:

// Homing speeds (mm/m)
#define HOMING_FEEDRATE_XY (70*60) // (50*60)
#define HOMING_FEEDRATE_Z  (10*60) // (4*60)

Drop your name as “author” – or not.

#define STRING_CONFIG_H_AUTHOR "burningbecks"//"(none, default config)" // Who made the changes.

You only see that after a cold start or reset, but while we are at it…


Stuff I wanted active – or not:

To save memory I decided to go without EEPROM (and re-flash every alteration):

//#define EEPROM_CHITCHAT   // Give feedback on EEPROM commands. Disable to save PROGMEM.

Manual, assisted bed levelling via LCD menu (untested on 1.1.9 – copy & paste from 1.1.8):

  #define MESH_INSET 35 // 1 

To activate the “filament change” feature in the menu I added this “else” part…

  #define NUM_RUNOUT_SENSORS   1     // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
  #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor.
  #define FIL_RUNOUT_PULLUP          // Use internal pullup for filament runout pins.

…and I think we need that:

  // Specify a park position as { X, Y, Z }
  #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MIN_POS + 10), 20 } // { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 }
  #define NOZZLE_PARK_XY_FEEDRATE 100   // X and Y axes feedrate in mm/s (also used for delta printers Z axis)
  #define NOZZLE_PARK_Z_FEEDRATE 10 // 5      // Z axis feedrate in mm/s (not used for delta printers)

Yay! One file down – one to go:


Alter “Thermal Protection” setting (lines 61…109 in the original file) at your own peril. Avoid your specific annoyances (e.g. when heating a granite tile just takes long), but keep values sharp enough to not lever out the protection. (When in doubt, watch Thomas Sanladerer’s video first.)

It is a good idea to have the fan start at full power, before the PWM kicks in:

#define FAN_KICKSTART_TIME 200 // 100

My 5015 blower, now mounted at 45°, can still be used with PWM at 20 (of 255, which is 7.8%) – without the kickstart (or other fans) you might have to enter more.

#define FAN_MIN_PWM 20

Might be useful, if you use SD cards:


If you activated the “M600” command, for filament change via menu or filament runout sensor, you will have to configure the “Advanced Pause” section to your setup. For me (feeder directly above the nozzle) it looks like this:

  #define PAUSE_PARK_RETRACT_FEEDRATE         60  // (mm/s) Initial retract feedrate.
  #define PAUSE_PARK_RETRACT_LENGTH            2  // (mm) Initial retract.
                                                  // This short retract is done immediately, before parking the nozzle.
  #define FILAMENT_CHANGE_UNLOAD_FEEDRATE    100  // 10  // (mm/s) Unload filament feedrate. This can be pretty fast.
  #define FILAMENT_CHANGE_UNLOAD_ACCEL        25  // (mm/s^2) Lower acceleration may allow a faster feedrate.
  #define FILAMENT_CHANGE_UNLOAD_LENGTH      100  // (mm) The length of filament for a complete unload.
                                                  //   For Bowden, the full length of the tube and nozzle.
                                                  //   For direct drive, the full length of the nozzle.
                                                  //   Set to 0 for manual unloading.
  #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE   6  // (mm/s) Slow move when starting load.
  #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH     10 // 0  // (mm) Slow length, to allow time to insert material.
                                                  // 0 to disable start loading and skip to fast load only
  #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE   6  // (mm/s) Load filament feedrate. This can be pretty fast.
  #define FILAMENT_CHANGE_FAST_LOAD_ACCEL     25  // (mm/s^2) Lower acceleration may allow a faster feedrate.
  #define FILAMENT_CHANGE_FAST_LOAD_LENGTH    60  // 0  // (mm) Load length of filament, from extruder gear to nozzle.
                                                  //   For Bowden, the full length of the tube and nozzle.
                                                  //   For direct drive, the full length of the nozzle.
  //#define ADVANCED_PAUSE_CONTINUOUS_PURGE       // Purge continuously up to the purge length until interrupted.
  #define ADVANCED_PAUSE_PURGE_FEEDRATE        3  // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate.
  #define ADVANCED_PAUSE_PURGE_LENGTH         50  // (mm) Length to extrude after loading.
                                                  //   Set to 0 for manual extrusion.
                                                  //   Filament can be extruded repeatedly from the Filament Change menu
                                                  //   until extrusion is consistent, and to purge old filament.
// Filament Unload does a Retract, Delay, and Purge first:
#define FILAMENT_UNLOAD_RETRACT_LENGTH      13  // (mm) Unload initial retract length.

#define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract.
#define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged.

#define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety.
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed.
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.

//#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
//#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change

//#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
//#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302)

Not sure, whether this makes sense – but it didn’t hurt, as far as I have tried…

#define ACTION_ON_PAUSE "pause"
#define ACTION_ON_RESUME "resume"


Why are some of my comments indefinite? Because yesterday my OctoPrint-FirmwareUpdater reported an upload error. So I may have to re-flash the bootloader via AVR ISP. And as everything works good enough for me right now that may be something to do in a year or so, when nobody can use this comments anymore. 😉

Edit: For those who want to start from what I already modified, I added the relevant files of my last upload to the board to YouMagine. (Be aware of “The Prusaic Extruder” and my other modifications!)

Also note that the Bootloader seems to fail at > 97% memory usage, so better have that In-System-Programmer or Arduino-as-ISP lying around when using Marlin 1.1.9!

* The X5S Upgrade List & intermediate conclusion also was (partly) driven by some other info on the WWW.

5 thoughts on “Marlin 1.1.9 on TronXY X5S (“Melzi” style board)

  1. Also the latest Arduino IDE 1.8.10 when used to compile this for the TronXY X5S, made the LCD garbled. Going back to Arduino IDE 1.6.7 everything worked perfectly.


  2. Hi, i am trying to update my tronxy x5s to the last update of Marlin, now is 2.0.72. This post helps me with some configurations but my lcd screen doesnt work properly. It has blurred letters and is unreadable. Im compiled it with vscode, platformio and auto build marlin. Do you have any suggestions?


  3. Moin,
    ich versuche gerade einen Tronxy X5s für meinen Freund zum Laufen zu kriegen und dabei gibt es einige Probleme. Selbst habe ich einen Ender 3, an dem ich schon viel modifiziert habe, aber dafür habe ich auch sehr einfache Tutorials gefunden.
    Zum einen funktioniert der Extrudermotor nicht so wie er soll und zum anderen würde ich gerne Marlin updaten. Kannst du mir vllt dabei helfen? Möglich wäre z. B. eine Videokonferenz, in der ich dir alles zeigen und mit meinem geringen Sachverstand beschreiben könnte. Auch eine kleine Entlohnung zum Dank ist vorstellbar.
    Würde mich über eine Antwort per Mail freuen.
    Liebe Grüße


    1. Hallo Angelus,
      also erstmal bietet WP mir leider keine Möglichkeit auf deinen Post mit einer Mail zu antworten. 😏
      Da hier gerade langes Wochenende ist, kann ich auch keine Videokonferenz ansetzen – die Familie hat mich erstmal in Beschlag genommen. 😉

      Leider läuft kaum noch etwas im „richtigen“ Internet, so dass es jeder finden könnte. Wer Zugang zum entsprechenden „walled garden“ hat, dem kann ich diese Gruppe empfehlen: – von den Diskussion dort haben wenigstens die ~7500 Mitglieder was…

      Die Diagnose des E-Motors würde ich jetzt mal vom Rest trennen: Umstecken, um Kabel, Stecker, Treiber und Motor auszuschließen.
      Wenn’s dann tatsächlich die Firmware ist und das Board heile, kann es beim Update ggf. mit erledigt werden. Sollte aber das Board fritten sein, brauchst du dich nicht mit den veralteten Melzi und seinem zu knappen Programmspeicher herumschlagen.

      Zugegeben: Es gibt viele Fallstricke beim programmieren des roten Boards (mit dem grünen „ChiTu“ habe ich keine Erfahrung).
      => Das steht alles in den oben verlinkten, älteren Beiträgen beschrieben.
      Aktuelles Marlin habe ich zwar noch auf dem Schirm, aber nicht mehr fürs TronXY-Melzi.

      Hoffe diese Hinweise gehen in die richtige Richtung. Falls nicht und/oder du doch verzweifelst, guck mal nach dem Kontaktformular. Darauf müsste ich per Mail antworten können…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.