While uploading .hex firmware directly onto boards that allow this via CURA, this is not always an option for all machines (for lack of a functioning USB-connectable port for example).

On both my TronXY X1 board (Melzi 2.0 V5 with ATMEGA1284P) and the Creality Ender 3 (Creality 3D v.1.1.2 with Δ ATMEL ATMEGA1284P AU 1726) I spotted these 6 pins labeled ISP that are supposed to allow to connect an Arduino or similar to flash firmware. According to the RepRap Wiki, Melzi is a derivative of the Sanguinololu and both are Sanguino Compatible.

After creating the new firmware in Arduino IDE and making sure it compiles for the correct chip in the board, how can I use an Arduino Uno or other microcontroller to flash the new firmware via the ISP to my printer?

This is asking specifically about ATmega based controller boards, using the Arduino toolchain.

  • 1
    $\begingroup$ Not all printers are created equal. The process would be very different for a board based on, say, an AtMega2560 than a board based on a Cortex M3. It also depends on what (if any) bootloader is present on the board. I think the question is too broad in its current state. $\endgroup$ Commented Aug 16, 2018 at 8:46
  • $\begingroup$ @TomvanderZanden true, this is meant as a generic "I have some printer and managed to get the firmware to compile - hw do I get it onto the printer? I have this other microcontroller around". If you can add to the question or reitterate it in a better form, feel free to do so - we pretty much need to answer these basic questions to be able to answer more difficult answers more quickly by interlinking. $\endgroup$
    – Trish
    Commented Aug 16, 2018 at 8:47
  • 2
    $\begingroup$ There isn't a one-size-fits-all answer for this. It would be much better to have separate questions for separate types of board, because a single answer can't cover all possible scenario's you're imagining. Keep in mind that you should only ask practical, answerable questions based on actual problems that you face. You aren't actually facing the problem of having a board you can't upload to using Cura. $\endgroup$ Commented Aug 16, 2018 at 9:12
  • $\begingroup$ @TomvanderZanden I know it is supposed to work, but I fail to understand why it is supposed to be better than for example directly loading it via CURA or a different method to send the compiled .hex to the board... After all you have to open your machine... But it is a rather universal solution and would work for pretty much any machine - even ones that have no possibility to connect it to the PC, for exampe if the USB port was broken. $\endgroup$
    – Trish
    Commented Aug 16, 2018 at 10:11
  • $\begingroup$ @TomvanderZanden - the ATmega on the controller of the Ender-3 does not have a bootloader, apparently, as per TH3D Unified Firmware Package: CR-10, Ender 2, and Ender 3 Printers need the bootloader. You will need to follow the CR-10 bootloader guide to flash it before you can load the firmware. You can use our Uno kit to flash the bootloader on your board. The Uno kit is the ISP. $\endgroup$
    – Greenonline
    Commented Aug 16, 2018 at 10:21

1 Answer 1


Considering AVR based controller boards...

You might not need an additional Arduino, to serve as an ISP. It really depends upon the board. There are basically three scenarios:

  1. Controller board which is Arduino based - Arduino Mega 2560 with a RAMPS 1.4 - with a bootloader
  2. Controller board which is Arduino based - Arduino Mega 2560 with a RAMPS 1.4 - without a bootloader
  3. Controller board which is AVR based board (no separate Arduino board) - as is the case with an Ender-3 and the TronXY board1 - without a bootloader

Option 1 is the easiest, and you simply upload with the USB cable, directly from the Arduino IDE.

Options 2 and 3 is where you would require an In-circuit Serial Programmer (ISP). Such as a USBasp: USBasp - USB programmer for Atmel AVR controllers


or you can use another Arduino, see Arduino as ISP and Arduino Bootloaders.

An ISP device basically converts the USB to TTL signals (along with a serial protocol (JTAG or derivative)) which then connects to the ICSP2 interface on the controller board:

ICSP connector

Scenario 1

As stated above, you simply connect the board to the PC/Mac using the USB cable and, within the Arduino IDE, you hit Upload - ensuring that you have the correct Board (i.e. Mega2560) and Port selected in the Tools menu.

Scenario 2

For the Mega2560 the pins the MOSI, MISO and SCK are broken out on to are:

Arduino / Genuino Board    MOSI            MISO             SCK       Level
Mega1280 or Mega2560    51 or ICSP-4    50 or ICSP-1    52 or ICSP-3    5V

To program the Mega2560 using an Uno, connect as follows:

Uno as ISP programming Mega

or using the ISP connector (in this diagram the electrolytic capacitor3 is not shown):

Uno as ISP programming Mega via ICSP connector

Take note of the electrolytic capacitor3 on the programming device:

The 10 µF electrolytic capacitor connected to RESET and GND of the programming board is needed only for the boards that have an interface between the microcontroller and the computer's USB, like Mega, Uno, Mini, Nano. Boards like Leonardo, Esplora and Micro, with the USB directly managed by the microcontroller, don't need the capacitor.

or using the Mega's ICSP connector, from Atmega bootloader programmer (see original image):

Uno programming a Mega

Note D10 is used, not RESET4

Scenario 3

So, to use an Arduino Uno on your controller board, which is scenario 3 (an AVR based board, but not an Arduino board per se), you would need to connect the Uno to the ICSP of the controller board like this:

ICSP     Uno

MOSI     D11
MISO     D12
SCK      D13
GND      GND
5V       5V
RESET    D10

or, like this, from Chaos Drucker - CREALITY ENDER3 MIT MARLIN AUSSTATTEN (see original image):

There is an error in the image and the red line should go to D10 and not D9 as shown

Uno to controller board connections

Note, again, that the RESET on the Arduino Uno's ISP connector is not used (and Pin 10 is used to connect to the controller's ICSP's RESET pin instead)4.

Configure the Arduino IDE

Then in the Arduino IDE you will need to select the Programmer to be used, in this case Uno as an ISP, like so:

Uno as an ISP

Once you have connected correctly, and selected the programmer, then you should be able to hit compile and upload as usual.


1 Which both use the same board - see this answer to What voltage does the Creality Ender-3 run at?

2 In case you are wondering, see What's the difference between ICSP vs ISP?:

The difference between ISP and ICSP is a hyphen.

ISP stands for In-circuit Serial Programming, and ICSP stands for In Circuit Serial Programming.

Any arrangement that allows you to program a microcontroller while it is in a circuit using a serial protocol can be called ISP or ICSP.

See also Wikipedia - In-system programming.

3 See When using an Arduino as an ISP, is the capacitor required or not?

4 Why? From Can the Arduino Uno become an AVR programmer and use the ICSP header to program the target board:

First of all, as configured, the RESET pin can not be used as an output pin. In order to use it as an I/O pin, you would have to program the RSTDISBL fuse. But once you do that, as jippie said, it becomes near-impossible to reprogram your Arduino (if you have the socketed through hole variety of the MCU, you could pull it out and put it into a high voltage programmer; in all other cases, it's effectively impossible).

So in theory, you can use the ICSP header the way you suggest. In practice, it's under almost any conceivable circumstance a terrible idea.

  • 1
    $\begingroup$ thanks a lot - also I suggest to put up a note reminding to CHECK YOUR CONNECTION WIRES in case some odd error pops up. $\endgroup$
    – Trish
    Commented Aug 17, 2018 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .