What's New In The 3D Printer World

8 minutes reading time (1640 words)
Featured 

Flashing firmware on to stock TronXY X5S control board

          This tutorial will help you flash some real firmware on to your stock TronXY X5S control board, using a separate Arduino Uno board as the programmer. It’s not meant for any other board, period. Just the stock one specifically. No others. If you try it on a different board and it doesn’t work, don’t say I didn’t warn you.

It is also written under the assumption that you're running Windows. If you're on a different operating system you'll need to take the appropriate equivalent steps. If you don't know how to do that you'll need to find a different set of instructions. :)

You'll need:

-Your printer control board

-An Arduino Uno. Using other Arduino board variants is possible, but will require different hardware connections as well as some software changes. Non-Uno boards will not be covered here.

-The Arduino IDE, which is currently at version 1.8.5:

https://www.arduino.cc/en/Main/Software

-Two USB A to B cables

-Four male-to-female jumper wires

-The Marlin 1.1.X (currently 1.1.8) firmware:

https://github.com/MarlinFirmware/Marlin
(click the green “Clone or download” button, then “Download ZIP”)

-The U8glib library for Arduino

https://github.com/olikraus/U8glib_Arduino

-The X5S/Marlin configuration files, Version 4, graciously put together by Harald Gutsche and available in the TronXY X5S/X3S Facebook group for download:

https://www.facebook.com/groups/169728600253557/184255938800823/

-You might need an additional USB driver if your OS doesn't automatically detect the printer control board

http://www.wch.cn/download/CH341SER_EXE.html

-Patience, in case things don’t go right the first time. :)

The first thing we need to do is get all of the software installed, and all of the requisite libraries in place inside of the Arduino environment. Go ahead and run the Arduino 1.8.5 installer now, following all of the prompts and leaving everything at their defaults. Start the program when the installation is done so we can add a couple of things to it.

Import the U8glib library (this makes your LCD screen work) into the Arduino IDE. Go to the Sketch menu, hover your mouse over the Include Library option, and then select Add .ZIP Library… from the remaining options. Use the file dialog box that opens up to select the U8glib Zip file that you downloaded from Github, and the library will now be imported and made available for use.

We also have to make sure that the Arduino IDE has the right stuff under the hood to talk to the printer control board. First, go to File menu and select Preferences. At the bottom of the window, you’ll see an option called Additional Boards Manager URLs with a text input box next to it. Paste the following line into that text box:

https://raw.githubusercontent.com/Lauszus/Sanguino/master/package_lauszus_sanguino_index.json

Hit the OK button to save the changes and close the Preferences window.

Next, go to the Tools menu, hover your mouse over the Boards: option (it may or may not have a specific board name next to it, don’t worry about this) and then select Boards Manager… from the remaining options. In the new dialog box that opens, type Sanguino into the search field. It should return one option, “Sanguino by Kristian Sloth Anderson, version 1.0.2”. Click on this to select it and then hit the Install button. The Sanguino will now be available as a board selection. We’ll need this later.

Minimize or close the Arduino IDE for the moment, it’s time to have a look at the firmware files now.

Unzip the Marlin firmware that you downloaded from Github into its own separate folder.

Unzip the configuration file that you downloaded from the Facebook group into its own folder too.

Open the configuration file folder you just made, select all five files inside of it, and right click->Copy or hit CTRL+C. Now navigate to the Marlin firmware folder you made, open the subfolder inside that’s named Marlin, and then right-click-Paste or hit CTRL+V.  Overwrite the existing files in the Marlin folder with the new ones.

Now it’s time to go back to the Arduino IDE. We’re going to open up the Marlin firmware project file and make a couple of small configuration changes. Go to the File menu, select Open, and navigate to your Marlin folder. Scroll down the file list until you find the Marlin.ino file and select it.

A new Arduino IDE window will open up, and you’ll see a number of tabs with different file names. Select the configuration.h tab.

Hit CTRL+F to open the Find dialog, type K1 into the search box, and hit the “Find” button. The screen should jump to the correct line of the file and highlight what you just searched for.  The line should read:

#define K1 0.95 //smoothing factor within the PID

Change this line so it reads:

#define PID_K1 0.95 //smoothing factor within the PID

That’s it for the first change. Next, hit CTRL+F again to open the Find dialog, type default_axis (make sure to use the underscore) into the search box, and hit the “Find” button. The line should read:

#define DEFAULT_AXIS_STEPS_PER_UNIT   { 80, 80, 400, 500 }

Change this line so it reads:

#define DEFAULT_AXIS_STEPS_PER_UNIT   { 80, 80, 400, 95 }

The change from 500 to 95 puts the extruder steps per millimeter much, much closer to where they actually need to be and will save you a lot of aggravation later when you calibrate your extruder steps.

Go to the File menu and select Save. You won’t see any confirmation, but this will preserve the changes.

Now it’s time to configure our Arduino board so we can use it to program the printer control board!

Connect your Arduino board to the computer with one of the USB A to B cables.

In the Arduino IDE, go to the Tools menu, hover your mouse over the Boards: option, and then select Arduino/Genuino Uno from the remaining options. Also under Tools-> Boards is a Port option. There should be a single COM port listed there. Select it, and make a careful note of the port number. It will be important to know which port number is associated with each particular board when we have them both connected.

Next, go to the File menu, hover your mouse over Examples, hover again over ArduinoISP, and then finally select ArduinoISP as the remaining option. This will open a new IDE window with the ISP sketch loaded up.

Unless something’s wrong, at this point you should be able to hit the Upload button (it’s the arrow next to the check mark button) and the ArduinoISP sketch will be verified and uploaded to the Arduino board. If something is wrong, troubleshooting basic Arduino connectivity is outside the scope of this tutorial.

From the Tools menu, hover your mouse over the Programmer: option, and select Arduino as ISP.

OK, now that we’ve got our Arduino Uno loaded up with the software it needs to act as a programmer, we need to make some connections between it and our printer control board. Grab your four jumper wires, and maybe a magnifying glass because the silk screening on the control board is very, very small.

Locate the six pin programming connector on the control board. It’s toward the middle near a capacitor and the 16Mhz crystal (a silver, oval component). Connections are from the printer board to the Arduino, as follows:

Connect a jumper from the printer board pin labeled RESET to pin 10 on the Uno.
Connect a jumper from the printer board pin labeled MOSI to pin 11 on the Uno.
Connect a jumper from the printer board pin labeled MISO to pin 12 on the Uno.
Connect a jumper from the printer board pin labeled SCLK to pin 13 on the Uno.
 

Now connect the printer control board to the computer with your second USB A to B cable.

Back in the Arduino IDE, we need to set our board options a little differently now. This configuration will be critical to success, so double-check that everything is correct.

Go to the Tools menu, hover your mouse over the Board: option, and select Sanguino. A new Processor option will appear on the Tools menu now, and from there you need to select
ATmega 1284 or ATmega1284P (16MHz).

Do not change the port number. That needs to stay selected for the Arduino Uno board, whose COM port number you should have previously noted. Check to see if a different port has been selected, and change it back to the Uno’s port number if it has.

Everything is now configured, both software and hardware. Are you ready? Let’s burn a bootloader so all of this actually works!

Tools menu, Burn Bootloader.

That’s it. Unless you see an error of some sort at the bottom of the screen, it worked. The printer control board is now capable of receiving new firmware, and also of saving any future firmware settings that you change from the printer’s control panel. Neat, huh? We probably ought to feed it some actual firmware now.

In the Arduino IDE, open the Marlin.ino file again just like you did earlier, and once it’s open just hit the Upload button. This will take some time, as the computer needs to compile all of the human-readable files into stuff that the control board can use. The length of time really depends on how fast your computer is, so don’t be alarmed if it takes 3 or 5 or even 10 minutes or more. You’ll know it’s ready when the progress bar disappears and you see a message at the bottom of the window detailing how much storage space the files are using.

And…that’s it. You now have a proper, non-proprietary installation of Marlin 1.1.8 on your control board. Disconnect the four jumper wires, disconnect the control board from the computer, and fire the printer up! Any further settings and calibration are also outside the scope of this tutorial, so you’re on your own from here. J Have fun!

G Codes and M Codes for 3D printing
Site updates

Related Posts

 

Comments 23

Scott Worthington on Wednesday, 17 January 2018 22:46

I posted a copy of my full firmware in the downloads area of the forum. so no need to edit the files or anything.

I posted a copy of my full firmware in the downloads area of the forum. so no need to edit the files or anything.
Norman Gilman on Thursday, 18 January 2018 17:33

What advantages does this have over the stock 1.1.7 firmware currently on my new X5S?

What advantages does this have over the stock 1.1.7 firmware currently on my new X5S?
Scott Worthington on Thursday, 18 January 2018 17:38

factory firmware is not a true 1.1.7. 1.1.8 has assisted manual bed leveling lot faster responce from the controls and reads the sd cards faster.

factory firmware is not a true 1.1.7. 1.1.8 has assisted manual bed leveling lot faster responce from the controls and reads the sd cards faster.
Rick Hanson on Thursday, 18 January 2018 17:47

In my opinion, the biggest advantage is the ability to make configuration/tuning changes from the printer's control panel, and actually *save them* to the EEPROM, which is something that the stock TronXY firmware will not allow.

In my opinion, the biggest advantage is the ability to make configuration/tuning changes from the printer's control panel, and actually *save them* to the EEPROM, which is something that the stock TronXY firmware will not allow.
Nick Clarke on Monday, 22 January 2018 10:42

Job done, follow the guide, don't rush and double check everything. Not as difficult as it looks, have a go!

Job done, follow the guide, don't rush and double check everything. Not as difficult as it looks, have a go!
Lance Harlan on Tuesday, 23 January 2018 02:34

Hi Rick, great article! I'm having issues though at the end. I have a Tronxy X5S and I've verified the board is the ATmega 1284P, but I'm getting a signature error when I upload the firmware. I've pasted the printout here. Can you please help me with the troubleshooting step?


avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

Using Port : COM5
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : ATmega1284P
Chip Erase delay : 55000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 128 0 no 4096 8 0 9000 9000 0xff 0xff
flash 65 10 256 0 yes 131072 256 512 4500 4500 0xff 0xff
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00

Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 4.4
Vtarget : 0.3 V
Varef : 0.3 V
Oscillator : 28.800 kHz
SCK period : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

An error occurred while uploading the sketch
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: Expected signature for ATmega1284P is 1E 97 05

Hi Rick, great article! I'm having issues though at the end. I have a Tronxy X5S and I've verified the board is the ATmega 1284P, but I'm getting a signature error when I upload the firmware. I've pasted the printout here. Can you please help me with the troubleshooting step? avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" Using Port : COM5 Using Programmer : arduino Overriding Baud Rate : 115200 AVR Part : ATmega1284P Chip Erase delay : 55000 us PAGEL : PD7 BS2 : PA0 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 10 128 0 no 4096 8 0 9000 9000 0xff 0xff flash 65 10 256 0 yes 131072 256 512 4500 4500 0xff 0xff lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 Programmer Type : Arduino Description : Arduino Hardware Version: 3 Firmware Version: 4.4 Vtarget : 0.3 V Varef : 0.3 V Oscillator : 28.800 kHz SCK period : 3.3 us avrdude: AVR device initialized and ready to accept instructions An error occurred while uploading the sketch Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e950f (probably m328p) avrdude: Expected signature for ATmega1284P is 1E 97 05
Guest - Pettyofficer99 on Tuesday, 23 January 2018 03:04

Are both boards set to their respective com ports? I had a similar issue because I got the com ports mixed up....

Are both boards set to their respective com ports? I had a similar issue because I got the com ports mixed up....
Lance Harlan on Tuesday, 23 January 2018 12:48

Hi Pettyofficer. I believe so. The instructions say in the final section to use the com port of the Arduino when pushing the firmware to the printer. Should this be the other way, using the comm port of the 3d printer when I upload the sketch?

Hi Pettyofficer. I believe so. The instructions say in the final section to use the com port of the Arduino when pushing the firmware to the printer. Should this be the other way, using the comm port of the 3d printer when I upload the sketch?
Guest - Pettyofficer99 on Tuesday, 23 January 2018 13:14

The Uno stays connected throughout the process using it's own comport. The board on the printer needs to use it's own com port. In my case com 6 for Arduino uno and com 12 for printer board...

The Uno stays connected throughout the process using it's own comport. The board on the printer needs to use it's own com port. In my case com 6 for Arduino uno and com 12 for printer board...
Lance Harlan on Tuesday, 23 January 2018 15:56

Maybe this is where I'm not understanding. After the I have the Arduino prepped, I cable it to the printer board and switch to the sanguino profile and that. Am I burning the AurduinoIDE bootloader again or am I using the Marlin.iso at that time?

Maybe this is where I'm not understanding. After the I have the Arduino prepped, I cable it to the printer board and switch to the sanguino profile and that. Am I burning the AurduinoIDE bootloader again or am I using the Marlin.iso at that time?
Nick Clarke on Tuesday, 23 January 2018 16:30

Once you have burned the boot loader, leave Uno as is and go file/open/marlin.ino. a separate window should appear with Marlin loaded. Check in Tools menu that you have correct com port set for printer and upload.

Once you have burned the boot loader, leave Uno as is and go file/open/marlin.ino. a separate window should appear with Marlin loaded. Check in Tools menu that you have correct com port set for printer and upload.
Lance Harlan on Tuesday, 23 January 2018 19:17

Perfect, I'll try that when I get home. Thanks Nick!

Perfect, I'll try that when I get home. Thanks Nick!
Lance Harlan on Tuesday, 23 January 2018 22:26

You pointed me in the right direction everyone! Thank you very much! I'm back up and running.

You pointed me in the right direction everyone! Thank you very much! I'm back up and running.
Nick Clarke on Tuesday, 23 January 2018 23:17

You are welcome, have fun!

You are welcome, have fun!
Scott Worthington on Tuesday, 13 February 2018 05:41

ok anyone having issue flashing withan arduino I found this... http://www.instructables.com/id/Bootload-an-ATmega328/ skip to step 6...

ok anyone having issue flashing withan arduino I found this... http://www.instructables.com/id/Bootload-an-ATmega328/ skip to step 6...
Guest - Mark Wilson on Wednesday, 14 February 2018 04:32

Just finished my first print on my x5s. came out pretty good. great tutorial on firmware updating. mine came with 1.1.7 DEV loaded out of the box. I was also surprised by the upgrades it had addressing some of the initial issues it had on first release. trying to join the facebook group to download the necessary files. Scott, can you help me get added? Thanks.

Mark W.

Just finished my first print on my x5s. came out pretty good. great tutorial on firmware updating. mine came with 1.1.7 DEV loaded out of the box. I was also surprised by the upgrades it had addressing some of the initial issues it had on first release. trying to join the facebook group to download the necessary files. Scott, can you help me get added? Thanks. Mark W.
Guest - Jan N. on Friday, 23 February 2018 00:30

Many thanks Scott, for your article. Because i had it laying around, i used a cheap USBasp from ebay to flash a bootloader on the X5S Melziboard. It went without any problems. After that i could load the newest Marlin on the controller with the Arduino IDE - again without any problems thanks to your previse instructions. When i connect power to the controller it works as expected. But i won't use it on my X5S with Marlin: i'll use a smoothie clone (sbase) or flash Klipper on the Melzi...
Best regards
An

Many thanks Scott, for your article. Because i had it laying around, i used a cheap USBasp from ebay to flash a bootloader on the X5S Melziboard. It went without any problems. After that i could load the newest Marlin on the controller with the Arduino IDE - again without any problems thanks to your previse instructions. When i connect power to the controller it works as expected. But i won't use it on my X5S with Marlin: i'll use a smoothie clone (sbase) or flash Klipper on the Melzi... Best regards An
Guest - JimmyPop57 on Monday, 05 March 2018 14:10

I'm curious what I need to tweak for the X3S? I have inverted control box controls that bugs me, but the biggest issue is the extruder port on the main board. Has power and signal, but doesn't send signals when I tell it to. Since I just assembled the kit I'm hoping it's just borked firmware that I can flash and get it working. Otherwise it'll be a board replacement.

I'm curious what I need to tweak for the X3S? I have inverted control box controls that bugs me, but the biggest issue is the extruder port on the main board. Has power and signal, but doesn't send signals when I tell it to. Since I just assembled the kit I'm hoping it's just borked firmware that I can flash and get it working. Otherwise it'll be a board replacement.
Scott Worthington on Monday, 05 March 2018 14:19

Of yu o to the forum area it would be better to help you there. The extruder motor will not move until the hotels is heated above 180c (I believe that's the temp anyway... lol)

Of yu o to the forum area it would be better to help you there. The extruder motor will not move until the hotels is heated above 180c (I believe that's the temp anyway... lol)
Rick Hanson on Monday, 05 March 2018 15:24

I can never remember what the default extruder minimum temperature is either, so I just went to look at it...it's 170C

// This option prevents extrusion if the temperature is below EXTRUDE_MINTEMP.
// It also enables the M302 command to set the minimum extrusion temperature
// or to allow moving the extruder regardless of the hotend temperature.
// *** IT IS HIGHLY RECOMMENDED TO LEAVE THIS OPTION ENABLED! ***
#define PREVENT_COLD_EXTRUSION
#define EXTRUDE_MINTEMP 170

I can never remember what the default extruder minimum temperature is either, so I just went to look at it...it's 170C :) // This option prevents extrusion if the temperature is below EXTRUDE_MINTEMP. // It also enables the M302 command to set the minimum extrusion temperature // or to allow moving the extruder regardless of the hotend temperature. // *** IT IS HIGHLY RECOMMENDED TO LEAVE THIS OPTION ENABLED! *** #define PREVENT_COLD_EXTRUSION #define EXTRUDE_MINTEMP 170
Already Registered? Login Here
Guest
Saturday, 21 December 2024

To keep the site live and make improvements Please consider Donating. Thank you for your donation.