3

I have a Rostock Max 3d with an Arduino Uno as the controller. The OEM has a firmware version I would like to upload, but it is in the hex file format.

I have looked all over the Arduino IDE, but did not found a way to upload a hex file to the Arduino. I tried using AVRDUDE, but the Arduino only communicates with my PC when I set the "Programmer" to AVRISP. I have uploaded other codes for blink, and hello_world, but haven't been able to compile the firmware source. I was hoping I could just use the hexfile included in the firmware package.

My OS is Linux.

2
  • 3
    You can enable "Verbose output" under File -> Preferences for uploading the code. The Arduino IDE also uses avrdude to upload its sketches - you may "steal" the command it uses from that verbose output. After that, simply edit the command used by the IDE to point to your .hex file.
    – towe
    Jan 14, 2019 at 13:25
  • I've been using Xloader. hobbytronics.co.uk/arduino-xloader
    – Martynas
    Jan 14, 2019 at 15:22

4 Answers 4

3

I use a standalone programmer that uploads a .hex file from an SD card via the ICSP interface.

enter image description here

2

I recommend looking at the arduino IDE files located at "(install path)/hardware/arduino/avr/" (on windows anyway, I should assume the same on linux).

I am unsure if the following files have the .txt extension on them, but if not use just the file name.


Open and look in "boards.txt" and find the associated entries starting with "uno." keeping this file open.

Next open "platform.txt" looking for the entries "tools.avrdude" (the avrdude part comes from boards.txt "uno.upload.tool" entry) and copy into a new text editor the value of "tools.avrdude.upload.pattern" you can fill in the parameters later.

With the command you copied replace the following:

from platform.txt

  • "{cmd.path}" = "tools.avrdude.cmd.path"
  • "{config.path}" = "tools.avrdude.config.path"
  • "{upload.verbose}" = "tools.avrdude.upload.params.verbose"
  • "{upload.verify} = "tools.avrdude.upload.verify"

now from boards.txt

  • "{build.mcu}" = "uno.build.mcu"
  • "{upload.protocol} = "uno.upload.protocol
  • "{{serial.port}" = Your serial port (according to research something like /dev/ttyS0)
  • "{upload.speed}" = "uno.upload.speed"
  • "{build.path}" and "{build.project_name} = path to file you are trying to upload

So with the above set out for me to upload a program to an Arduino uno I would use something like the following in windows:

assuming install path was "C:\Arduino\"

"C:\Arduino\hardware\tools\avr\bin\avrdude.exe" "-CC:\Arduino\hardware\tools\avr\etc\avrdude.conf" -v -patmega328p -carduino "-PCOM1" -b115200 -D "-Uflash:w:C:\MyArduinoProject\build.hex:i"

for linux it could possibly be (I really am unsure):

assuming install path was "/opt/Arduino/"

"/opt/Arduino/hardware/tools/avr/bin/avrdude" "-C/opt/Arduino/hardware/tools/avr/etc/avrdude.conf" -v -patmega328p -carduino "-P/dev/ttyS0" -b115200 -D "-Uflash:w:/usr/MyArduinoProject/build.hex:i"


The above should work for you, I have previously written my own program to upload a hex file to the Arduino utilizing the above commands and avrdude.

1

I think you can use this software http://www.mediafire.com/file/tx2l85gsdkpf5d4/HEXtoArduino_V1.0.0.zip/file enter image description here

1

I found the definitive answer to this.

  1. Start Arduino IDE
  2. To to File...Preferences...
  3. Turn on Show verbose output during: [X] upload (image 1 below)
  4. Upload a sketch to your Arduino Uno
  5. I used the sample blink sketch and saw the following (image 2 below):

AVRDude: is used to upload

You want that first line shown in white --- when you expand it you'll see that it is the entire line of code that is used to upload the HEX file of your program to the Uno.

The entire command on my computer looks like the following:

C:\Users\<username>\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\<username>\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:C:\Users\<username>\dev\arduino\STK2UPDI\build\blink.ino.hex:i

I'm going to break this down into a few lines:

First, it's the full path to the avrdude exe. Then it is passing the -C argument with the full path to the avrdude.conf file

c:\longpath\avrdude -C C:\avrdude.conf

Then a bunch of params to set up avrdude properly: -v -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:

And finally the full path to the HEX file you want to upload

c:\longpath\blink.ino.hex:i

All You Have To Do

All you have to do is take that extremely long line and replace the full-path to the hex file to be your target HEX file and then run the entire command and you'll see something like what is shown in image 3 below.

Image 1

verbose output

Image 2

upload info

Image 3 upload success

2
  • neat, I'll check that out. what version are you using?
    – j0h
    Jun 29, 2021 at 21:37
  • using Arduino IDE 1.8.15 👍🏽
    – raddevus
    Jun 29, 2021 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.