# How to install a .hex firmware?

Creality does offer its firmware on creality3d.cn as .hex files. These are pretty good as backups as one can't alter and destroy them by accident.

But... How do you install them?!

This is about installing firmware directly and without another microcontroller. To use another mictrocontroller is How to install new firmware via a Microcontroller?

A major part of the Arduino IDE is sort of semi-hidden, and that is some guy called avrdude. Actually, AVRDUDE – AVR Downloader/UploaDEr is a standalone binary.

As an aside, there is also gcc which does the compiling, but that is another matter. The avrdude uploads the compiled binary provided by gcc on to the Arduino, via the USB port (COM port).

You can invoke this from the command line (assuming that you have the Arduino IDE installed).

You will need to specify (see command line option descriptions):

• The baud rate of the COM port (-b)
• The COM port (-P)
• The processor used in the board (for the Arduino Mega2560 board: ATmega2560) (-p)
• The path to the .hex file (-U)
• The path to the .conf file of avrdude itself (-C)
• Verbose mode, so see what is happening (-v)
• Specify the programmer to be used (-c). See the -c option on command line option descriptions for more information.
• Disable auto erase for flash (-D)

The command will be of the form:

<path to arduino>/hardware/tools/avr/bin/avrdude
-C<path to arduino>/hardware/tools/avr/etc/avrdude.conf
-v -patmega2560 -carduino -b 115200 -cstk500v2
-P<name of serial port>
-D -Uflash:w:<path to hex file>:i


This example above:

1. Specifies the full path to the avrdude binary
2. Specifies the full path to the avrdude .conf configuration file
3. Verbose mode
4. The ATmega2560 processor used in the Arduino Mega2560 board
5. The Arduino programmer
6. The baud rate of the USB port
7. The Atmel STK500 Version 2.x firmware programmer (may not be required)
8. The port to which the Arduino board is connected
9. Disables auto-flash as it is not required – Auto erase is not used for ATxmega devices as these devices can use page erase before writing each page so no explicit chip erase is required. Note however that any page not affected by the current operation will retain its previous contents.
10. The memory to be uploaded to and the path to the .hex file (see the -U option on command line option descriptions for more information):
1. flash specifies the flash ROM of the device.
2. w: read the specified file and write it to the specified device memory
3. :i specifies Intel Hex

### Examples

For Windows

C:\dev\Arduino\hardware\tools\avr\bin\avrdude
-CC:\dev\Arduino\hardware\tools\avr\etc\avrdude.conf
-v -patmega2560 -carduino -b115200 -cstk500v2
-P\\.\COM1


For OSX

/Applications/Arduino/hardware/tools/avr/bin/avrdude
-C/Applications/Arduino/hardware/tools/avr/etc/avrdude.conf -v -patmega2560 -carduino -b115200 -cstk500v2 -P\\.\COM1 -D -Uflash:w:/Users/<username>/Documents/Arduino/firmware.hex:i


## Alternatives

If you are not comfortable using a command line interface (CLI) it might be easier to use a GUI solution…

From the author’s website:

I’ve made a small program that can be used to upload your own *.hex files to arduino boards using the bootloader. That means you don’t need a flash programmer. I made it for my own use and found it pretty useful. So now I’ve made a more user friendly version.. To use it compile you’re code in something like AvrStudio. Then simply start XLoader.exe, pick a hex file and press upload. That’s it. Good news it now also supports Arduino Uno.

### Arduino Builder

1. Choose file, either a sketch file (.ino), an HEX file (.hex) or an ELF file (.elf)
2. Choose the board type in the dropdown list.
3. Click on the serial port (or USBASP button) and theuploading will be proceeded.

From the same page, there is Arduino Uploader which is a command line version of Arduino Builder.

Creality also does provide an installation PDF. The process they propose is twofold and might need different settings on other machines1. Spots where I assume you might need to adjust are noted withA. Note that this solution depends on CURA.

## 1. Install the printer as a periphery machine.

This part is specific for Windows. If you use Linux or a MAC, you will need to use a different setup, but you might get the same results.

1. Turn on the power on the printer and connect it from the MircoUSB to a USB of the computer. This should automatically install the driver. If not, the Driver is on the SD card provided with the Printer2.
• To manually install windows Key + "MANAGER" and choose Device manager. Find the serial port that shows yellow, Right-click, choose Update driver software > Browse my computer for driver software. Now Browse, find the location of USB driver on the SD card and click Next.
• Generally,the serial port(COM) you need update has the biggest number, but can change.
• A good idea is to confirm the correct port with a software like Repetier Host, with which you can control the printer directly - if it works, you got the drivers and the port correct. Also, you know the correct Baudrate.
2. After the driver installation, launch CURA to do some settings. In File > Preferences:
• Print Window is "Pronterface UI"A
3. Switch to Machine > Machine Settings:
• Serial Port: choose the one that just was updated
• Baudrate: 115200A

## 2. Upload the .hex file via cura

1. Machine > Install custom Firmware
2. Make sure the printer is connected, then OK
3. find the .hex file on your PC, then confirm.
4. Wait for the process to finish.

1 - most likely, you will have to change the baudrate
2 - This might not be true for all manufacturers, but is for creality. Other manufacturers might have different sources for these.