Wednesday, October 25, 2017

Arduino - upload the hex file through command line terminal

Below is an example command I use to load the hex file to Arduino Uno development board by executing the command in Linux terminal.

arduino-1.6.12/hardware/tools/avr/bin/avrdude -Carduino-1.6.12/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyUSB0 -b115200 -D -Uflash:w:grbl_v0_9a_edge_328p_16mhz_9600_build20121210.hex:i

However, the command might differ depending on your development board type. To find the exact command that needs to be executed, we can use a basic sample.ino file and upload it via Arduino IDE. Then in order to see what the commands that get executed in the background we can enable logs and see them through the console.

How to enable console logs:

  • Go to File -> Preferences
  • Enable show verbose output during upload

Now check for the console output and find the appropriate command.

Cheers!!