## Friday, February 17, 2012

### STK 200: Getting Started Programming Guide

To start programming the STK 200, you need to download some software. Namely, you need AVR Studio and AVRISP-U. I talked about the basic layout of the board in a previous post (link), so check that out if some of the terms I am using are unfamiliar. I broke the process into three steps below.

Step 1 - Download AVR Studio 5: I started programming with AVR Studio 4, but if you are starting today, you might as well start with the new AVR Studio 5 release. The program is built using the Microsoft Visual Studio Shell (VSS) so the user interface is very similar to Visual Studio. I suppose this can be a good thing for those who like Visual Studio and a bad thing for those who don't. Overall, it seems to have a lot of convenient features such as IntelliSense and debugging interface.

So to get the software, go to the AVR Studio 5 page (link) from Atmel and download the software package you need. I recommend downloading the package that includes VSS and .NET 4.0. The software is completely free but you do have to fill out a registration form. The installer is pretty big (the one including VSS and .NET is over 600 MB).
 STK 200: AVR Studio 5

Step 2 - Download and initialize AVRISP-U: The other piece of software you will need is "AVRISP-U" from Kanda. This will take the hex file you created using AVR Studio and send it through the ISP connecting your USB port to the board and program the chip. This package is not nearly as big as AVR Studio (~5 MB). Go ahead and extract the .exe file and install the software. After that is complete, plug in your STK 200, turn it on, and connect the ISP from the board to your USB port. If that is confusing, look at the image below:

After it is all connected, you might get a notice that the ISP's driver was installed. Now launch AVRISP-U. It should automatically detect the microcontroller in the STK 200. You should get a screen similar to the image below, with a green dot on the bottom left and a message saying that the ISP is initialized:

 STK 200: AVRISP-U

Step 3 - Integrate AVRISP-U with AVR Studio 5: Open AVR Studio 5 and go to Tools Menu > External Tools. You will see the External Tools dialog box. If this is the first time you have ever accessed this dialog, there should be a placeholder tool named "[New Tool 1]." You can overwrite this tool. Or if you have previously entered tools, simply click the Add button near the top right. Now, you will fill out some information about the new programmer you are adding. You can see the proper entries in the screenshot, or I listed them as text below:

Title: AVRISP-U
Command: C:\Program Files\embres\AVRISP-U\AVRISP-U.exe
Arguments: $(ProjectDir)$(ProjectFileName)
Initial Directory: \$(ProjectDir)

What does all this mean? The "Title" is simply the name given to the new programmer in AVR Studio. "Command" is the path to the .exe file which corresponds to the programmer; in our case: AVRISP-U.exe. The location of this file all depends on where you chose to install the AVRISP-U software during setup. If you are following step 2 of my guide and downloaded the software from Kanda's website and you kept the default path during the installation process, the path I have given should be correct. If you installed the software from the CD that was shipped with the kit, the path is likely different. Browse around in the Program Files folder to find it for sure. It should resemble something like: C:\Program Files\Kanda AVR\avrisp-u\AVRISP-U.exe. The next two lines ("Arguments" and "Initial Directory") correspond to where the programmer can find the files it needs to program the microcontroller.
 STK 200: Adding AVRISP-U to AVR Studio 5

Hit OK and it should be installed! To check that it worked, go to the Tools Menu in AVR Studio 5 and look to see if there is a menu item for AVRISP-U.