2

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.

  • 1
    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 at 13:25
  • I've been using Xloader. hobbytronics.co.uk/arduino-xloader – Martynas Jan 14 at 15:22
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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