Saturday, September 26, 2015

AVR Dude


AVRDUDE is an excellent program for programming a AVR Atmega series microcontroller. In order to program any microcontroller you need to have a *.hex file which contain the instructions for the microcontroller. Apart from the software you need to have a hardware connection between your PC and the microcontroller which acts as an interface to write the *.hex file into the memory of the microcontroller, from where it run the instuctions in the specified *.hex file. USBasp is an awesome programmer found at cheap cost on almost all online stores these days. So you need a programmer like USBasp, some basic circuit for the ATmega and a PC with AVRDUDE and *.hex file to start the programming the microcontroller.



Here is the circuit required between the PC and USBasp:
USBasp and AVR connection details

Using the AVRdude:
I'll be explaining the procedure for linux and is basically same in windows.
Open the terminal and check whether AVRDUDE is installed by typing avrdude. If AVRDUDE is installed it will give you a output describing the options available in avrdude.
Reading the flash of microcontroller-
avrdude -c  usbasp -p m32 -u -U flash:r:backup.hex

Let's understand the above command :-
  • The -c option describes the type of programmer being used.
  • The -p option specified the type of microcontroller being used.
  • Yhe -u option is to disable safe mode (for noe just accept it)
  • The -U option is the last and most improtant, in flash:r:backup.hex - flash is the type of memory, r implies read mode and finally backup.hex implies write the data to backup.hex. 
Summing up it implies that the flash memory of the microcontroller m32(Atmega32) is to be read and written to a file named backup.hex .

Similarly if you want to write the file backup.hex to the microcontroller:-
avrdude -c usbasp -p m32 -u -U flash:w:backup.hex

 I hope this post helps you to understand about avrdude if any clarification is required please comment.



No comments :

Post a Comment