1. About
  2. Features
  3. Explore

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

USBasp

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.


Footnotes

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.