<p>Considering AVR based controller boards...</p>

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

<ol>
<li>Controller board which is Arduino based - Arduino Mega 2560 with a RAMPS 1.4 - <em>with</em> a bootloader</li>
<li>Controller board which is Arduino based - Arduino Mega 2560 with a RAMPS 1.4 - <em>without</em> a bootloader</li>
<li>Controller board which is AVR based board (no separate Arduino board) - as is the case with an Ender-3 and the TronXY board<sup>1</sup> - <em>without</em> a bootloader</li>
</ol>

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

<p>Options 2 and 3 is where you would require an In-circuit Serial Programmer (ISP). Such as a USBasp: <a href="https://www.fischl.de/usbasp/" rel="nofollow noreferrer">USBasp - USB programmer for Atmel AVR controllers</a></p>

<p><a href="https://i.sstatic.net/ksElR.jpg" rel="nofollow noreferrer" title="USBasp"><img src="https://i.sstatic.net/ksElR.jpg" alt="USBasp" title="USBasp"></a></p>

<p>or you can use another Arduino, see <a href="https://www.arduino.cc/en/Tutorial/ArduinoISP" rel="nofollow noreferrer">Arduino as ISP and Arduino Bootloaders</a>.</p>

<p>An ISP device basically converts the USB to TTL signals (along with a serial protocol (JTAG or derivative)) which then connects to the ICSP<sup>2</sup> interface on the controller board:</p>

<p><a href="https://i.sstatic.net/fnPk8.jpg" rel="nofollow noreferrer" title="ICSP connector"><img src="https://i.sstatic.net/fnPk8.jpg" alt="ICSP connector" title="ICSP connector"></a></p>

<h3>Scenario 1</h3>

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

<h3>Scenario 2</h3>

<p>For the Mega2560 the pins the MOSI, MISO and SCK are broken out on to are:</p>

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

<p>To program the Mega2560 using an Uno, connect as follows:</p>

<p><a href="https://i.sstatic.net/ifLTz.png" rel="nofollow noreferrer" title="Uno as ISP programming Mega"><img src="https://i.sstatic.net/ifLTz.png" alt="Uno as ISP programming Mega" title="Uno as ISP programming Mega"></a></p>

<p>or using the ISP connector (in this diagram the electrolytic capacitor<sup>3</sup> is not shown):</p>

<p><a href="https://i.sstatic.net/gFhfl.png" rel="nofollow noreferrer" title="Uno as ISP programming Mega via ICSP connector"><img src="https://i.sstatic.net/gFhfl.png" alt="Uno as ISP programming Mega via ICSP connector" title="Uno as ISP programming Mega via ICSP connector"></a></p>

<p>Take note of the electrolytic capacitor<sup>3</sup> on the programming device:</p>

<blockquote>
  <p>The 10&nbsp;µ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. </p>
</blockquote>

<p>or using the Mega's ICSP connector, from <a href="https://www.gammon.com.au/bootloader" rel="nofollow noreferrer">Atmega bootloader programmer</a> (see <a href="https://www.gammon.com.au/images/Arduino/Atmega_Chip_Detector9.jpg" rel="nofollow noreferrer">original image</a>):</p>

<p><a href="https://i.sstatic.net/PscDO.jpg" rel="nofollow noreferrer" title="Uno programming a Mega"><img src="https://i.sstatic.net/PscDO.jpg" alt="Uno programming a Mega" title="Uno programming a Mega"></a></p>

<p>Note D10 is used, not <code>RESET</code><sup>4</sup></p>

<h3>Scenario 3</h3>

<p>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:</p>

<pre><code>ICSP     Uno

MOSI     D11
MISO     D12
SCK      D13
GND      GND
5V       5V
RESET    D10
</code></pre>

<p>or, like this, from <a href="http://www.chaos-drucker.de/anleitungen-und-tutorials/creality-ender3-mit-marlin-ausstatten/" rel="nofollow noreferrer">Chaos Drucker - CREALITY ENDER3 MIT MARLIN AUSSTATTEN</a>  (see <a href="https://www.chaos-drucker.de/wp-content/uploads/2018/04/Schemata-225x300.jpg" rel="nofollow noreferrer">original image</a>):</p>

<p><strong>There is an error in the image and the red line should go to <code>D10</code> and not <code>D9</code> as shown</strong></p>

<p><a href="https://i.sstatic.net/Mq7zN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Mq7zN.png" alt="Uno to controller board connections"></a></p>

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

<h3>Configure the Arduino IDE</h3>

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

<p><a href="https://i.sstatic.net/ywWQ3.jpg" rel="nofollow noreferrer" title="Uno as an ISP"><img src="https://i.sstatic.net/ywWQ3.jpg" alt="Uno as an ISP" title="Uno as an ISP"></a></p>

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

<hr>

<h3>Footnotes</h3>

<p><sup>1</sup> Which <em>both</em> use the <em>same</em> board - see <a href="https://3dprinting.stackexchange.com/questions/6342/what-voltage-does-the-creality-ender-3-run-at#answer-6521">this answer</a> to <a href="https://3dprinting.stackexchange.com/questions/6342/what-voltage-does-the-creality-ender-3-run-at">What voltage does the Creality Ender-3 run at?</a></p>

<p><sup>2</sup> In case you are wondering, see <a href="https://arduino.stackexchange.com/questions/19130/whats-the-difference-between-icsp-vs-isp">What's the difference between ICSP vs ISP?</a>:</p>

<blockquote>
  <p>The difference between ISP and ICSP is a hyphen.</p>
  
  <p>ISP stands for In-circuit Serial Programming, and ICSP stands for In
  Circuit Serial Programming.</p>
  
  <p>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.</p>
</blockquote>

<p>See also <a href="https://en.wikipedia.org/wiki/In-system_programming" rel="nofollow noreferrer">Wikipedia - In-system programming</a>.</p>

<p><sup>3</sup> See <a href="https://arduino.stackexchange.com/questions/55498/when-using-an-arduino-as-an-isp-is-the-capacitor-required-or-not">When using an Arduino as an ISP, is the capacitor required or not?</a> </p>

<p><sup>4</sup> Why? From <a href="https://arduino.stackexchange.com/questions/1003/can-the-arduino-uno-become-an-avr-programmer-and-use-the-icsp-header-to-program">Can the Arduino Uno become an AVR programmer and use the ICSP header to program the target board</a>:</p>

<blockquote>
  <p>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).</p>
  
  <p>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.</p>
</blockquote>

CC BY-SA 4.0
2018-08-17T12:07:52.633Z
thanks a lot - also I suggest to put up a note reminding to CHECK YOUR CONNECTION WIRES in case some odd error pops up.
Trish
CC BY-SA 4.0
2018-08-16T09:12:37.667Z
2018-08-22T09:28:45.310Z
2018-08-22T09:28:45.310Z
Greenonline
<p>While uploading <a href="https://3dprinting.stackexchange.com/questions/6654/how-to-install-a-hex-firmware">.hex firmware directly</a> 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).</p>

<p>On both my TronXY X1 board (Melzi 2.0 V5 with <code>ATMEGA1284P</code>) and the Creality Ender 3 (Creality 3D v.1.1.2 with <code>Δ ATMEL  ATMEGA1284P  AU 1726</code>) I spotted these 6 pins labeled <code>ISP</code> 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 <a href="https://reprap.org/wiki/Melzi" rel="nofollow noreferrer">Sanguinololu</a> and both are <a href="https://github.com/Lauszus/Sanguino" rel="nofollow noreferrer">Sanguino Compatible</a>.</p>

<p>After creating the new firmware in <strong>Arduino IDE</strong> 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  <strong>via the ISP</strong> to my printer?</p>

<p>This is asking specifically about ATmega based controller boards, using the Arduino toolchain.</p>

CC BY-SA 4.0
2018-08-16T08:46:14.597Z
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.
Tom van der Zanden
CC BY-SA 4.0
2018-08-16T08:47:48.417Z
@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.
Trish
CC BY-SA 4.0
2018-08-16T09:12:38.583Z
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*](https://3dprinting.stackexchange.com/help/dont-ask). You aren't actually facing the problem of having a board you can't upload to using Cura.
Tom van der Zanden
CC BY-SA 4.0
2018-08-16T10:11:11.433Z
@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.
Trish
CC BY-SA 4.0
2018-08-16T10:21:17.130Z
@TomvanderZanden - the ATmega on the controller of the Ender-3 does not have a bootloader, apparently, as per [TH3D Unified Firmware Package](https://www.th3dstudio.com/knowledge-base/th3d-unified-firmware/): *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](https://www.th3dstudio.com/product/arduino-uno-bootloader-flashing-kit/) to flash the bootloader on your board.* The Uno kit is the ISP.
Greenonline
<firmware>
How to install new ATmega firmware via the ISP pins?
Trish
# How to install new ATmega firmware via the ISP pins?

(Asked by: username_0 on 2018-08-16)

While uploading [.hex firmware directly](https://3dprinting.stackexchange.com/questions/6654/how-to-install-a-hex-firmware) 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](https://reprap.org/wiki/Melzi) and both are [Sanguino Compatible](https://github.com/Lauszus/Sanguino).

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.

**Tags:** firmware

> **Comments:**
> **username_1**: 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.  
> **username_0**: @username_1 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.  
> **username_1**: 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*](https://3dprinting.stackexchange.com/help/dont-ask). You aren't actually facing the problem of having a board you can't upload to using Cura.  
> **username_0**: @username_1 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.  
> **username_2**: @username_1 - the ATmega on the controller of the Ender-3 does not have a bootloader, apparently, as per [TH3D Unified Firmware Package](https://www.th3dstudio.com/knowledge-base/th3d-unified-firmware/): *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](https://www.th3dstudio.com/product/arduino-uno-bootloader-flashing-kit/) to flash the bootloader on your board.* The Uno kit is the ISP.  

---

## 1 answers

### Answer by username_2 on 2018-08-16. Score: 7 | Accepted answer

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](https://www.fischl.de/usbasp/)

[![USBasp](https://i.sstatic.net/ksElR.jpg "USBasp")](https://i.sstatic.net/ksElR.jpg "USBasp")

or you can use another Arduino, see [Arduino as ISP and Arduino Bootloaders](https://www.arduino.cc/en/Tutorial/ArduinoISP).

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](https://i.sstatic.net/fnPk8.jpg "ICSP connector")](https://i.sstatic.net/fnPk8.jpg "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](https://i.sstatic.net/ifLTz.png "Uno as ISP programming Mega")](https://i.sstatic.net/ifLTz.png "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](https://i.sstatic.net/gFhfl.png "Uno as ISP programming Mega via ICSP connector")](https://i.sstatic.net/gFhfl.png "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](https://www.gammon.com.au/bootloader) (see [original image](https://www.gammon.com.au/images/Arduino/Atmega_Chip_Detector9.jpg)):

[![Uno programming a Mega](https://i.sstatic.net/PscDO.jpg "Uno programming a Mega")](https://i.sstatic.net/PscDO.jpg "Uno programming a Mega")

Note D10 is used, not `RESET`4

### 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](http://www.chaos-drucker.de/anleitungen-und-tutorials/creality-ender3-mit-marlin-ausstatten/) (see [original image](https://www.chaos-drucker.de/wp-content/uploads/2018/04/Schemata-225x300.jpg)):

**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](https://i.sstatic.net/Mq7zN.png)](https://i.sstatic.net/Mq7zN.png)

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](https://i.sstatic.net/ywWQ3.jpg "Uno as an ISP")](https://i.sstatic.net/ywWQ3.jpg "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.

---

### Footnotes

1 Which *both* use the *same* board - see [this answer](https://3dprinting.stackexchange.com/questions/6342/what-voltage-does-the-creality-ender-3-run-at#answer-6521) to [What voltage does the Creality Ender-3 run at?](https://3dprinting.stackexchange.com/questions/6342/what-voltage-does-the-creality-ender-3-run-at)

2 In case you are wondering, see [What's the difference between ICSP vs ISP?](https://arduino.stackexchange.com/questions/19130/whats-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](https://en.wikipedia.org/wiki/In-system_programming).

3 See [When using an Arduino as an ISP, is the capacitor required or not?](https://arduino.stackexchange.com/questions/55498/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](https://arduino.stackexchange.com/questions/1003/can-the-arduino-uno-become-an-avr-programmer-and-use-the-icsp-header-to-program):

> 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.

> **Comments:**
> **username_0**: thanks a lot - also I suggest to put up a note reminding to CHECK YOUR CONNECTION WIRES in case some odd error pops up.  

---

