In the last article I talked about Programming any AVR microcontrollers using WinAVR and USBTinyISP but recently I found that USBTinyISP can be easily used together with Atmel Studio.
Using an external programmer in Atmel Studio 7
To add USBTiny to Atmel Studio go to Tools -> External Tools
Here pick a name for the programming tool, for example USBTinyISP_Debug or USBTinyISP_Release.
In the command field write avrdude.exe. For this to work you need to install WinAVR which includes avrdude and during installation check the option to add it to the Windows system path otherwise instead of avrdude.exe you need to provide the full path to the executable. WinAVR can be downloaded from http://winavr.sourceforge.net
To check if avrdude is installed and added to Path, open a command prompt window, type avrdude and press enter. You should now see something like this
In the arguments field specify what arguments will be sent to the avrdude.exe
-c usbtiny -p m328p -U flash:w:$(ProjectDir)Debug\$(TargetName).hex:i
-c : specify programmer type. For USBTinyISP use usbtiny. To see a list of all supported programmers use avrdude -c abcd
-p : the avr device. For example ATmega328P is m328p. To see a full list of microcontrollers use avrdude -c usbtiny -p abcd
-U : indicates that we want to :w: write to flash memory the .hex file. :i is Intel hex file format. $(ProjectDir) and $(TargetName) is specific to Atmel Studio 7. For Atmel studio 6 this can differ. Replace Debug with Release when working in Release mode.
Lastly, check Use Output Window.
Now in the Tools menu you should see the tool above the External Tools.... You can add as many as you want. For example one for Debug and one for Release.
In the Toolbar near the device type you should see Custom Programming Tool
If not click on it and select it in the project configuration window
That's it! Now after building the code, upload it to the microcontroller using Tools -> and the newly created programming tool.
Thanks
ReplyDeleteI'm glad it was helpful
Delete