We're going to open Atmel Studio and add our device pack for ATtiny, then add our hardware programmer to the list of devices we can use to programme from within Atmel Studio (such as the Atmel ICE programmer). This should speed up our development iterations over using avrdude from the command line each time we want to upload code to the ATtiny.
Open up Atmel Studio and open Tools\Device Pack Manager:
On Windows you may be asked if you want Device Pack Manager to make changes to your system. I clicked Yes.
If you have a green icon and an "Install" button next to ATtiny DFP 1.3.229 click it and follow the instructions so it installs and you end up looking like this:
You can now close the Device Pack Manager and go back to the main Atmel Studio screen. Now we're going to add our jtag2updi Arduino as a hardware programmer that uses avrdude from within Atmel Studio. Click Tools\External Tools
And a window will pop up like this one, which you are going to copy the contents of into yours:
- Title. Give the tool a descriptive title - note that this tool is tied to the part you're programming because of how it commands avrdude. So you need to add external tools for each part you program, as far as I know.
C:\avrdude\avrdude.exeThis, except make sure the file path is wherever you have saved avrdude.exe:
- Arguments. The key part to get here is the target part being programmed (look in avrdude.conf for nicknames of parts) and the COM port number (6 in my case)
avrdude -P com6 -c jtag2updi -p t402w -U flash:w:$(ProjectDir)Debug\$(TargetName).hex:i
- I followed a guide which didn't mention putting anything in Initial Directory and to tick Use Output window but leave unticked both Prompt for arguments and Treat output as Unicode.
- Then click OK.
You should be all set to programme your ATtiny402 from Atmel Studio now! I have written this guide a couple of weeks after I first went through the process so if I have missed a step, please shout in the comments.