For my latest project i wanted to use the famous GRBL firmware that loads into an arduino and helps drive steppers with G-code as input. I had an Arduino-Uno that i wanted to use.
Now the arduino IDE can be used to compile and upload sketches. But what if you had the compiled ‘hex’ file itself? : Like in the case of GRBL. The github page hosts hex files compiled for the Atmega328p.
You can use external programs like Xloader to do the job. However it looks like these programs have their own issues. So why not make use of the Arduino that you already have ?
The arduino IDE does 2 things.
- First it compiles your C/C++ sketch for a particular Atmega processor (depending upon the type of the arduino board) and generates a ‘hex’ file or a binary file that the processor can understand.
- Then it uses its own ‘avrdude’ and config file and uploads this hex file.
Here’s a typical output command of the uploading process from arduino.
C:\Users\rkovvuri\Downloads\arduino-1.0.2-windows\arduino-1.0.2\hardware/tools/avr/bin/avrdude -CC:\Users\rkovvuri\Downloads\arduino-1.0.2-windows\arduino-1.0.2\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM5 -b115200 -D -Uflash:w:C:\Users\rkovvuri\AppData\Local\Temp\build37.tmp\BlinkWithoutDelay.cpp.hex:i
So for my case, to burn in the GRBL hex file, i did the following
- cd Users\rkovvuri\Downloads\arduino-1.0.2-windows\arduino-1.0.2\hardware/tools/avr/bin
- avrdude -CC:\Users\rkovvuri\Downloads\arduino-1.0.2-windows\arduino-1.0.2\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM5 -b115200 -D -Uflash:w:C:\Users\rkovvuri\Desktop\grbl.hex:i