The ProtoStack ATmega328 Development Kit came in a well packaged antistatic bag that had individual heat sealed sections for the PCB and components. I also got a free USBasp programmer which I was not expecting (Thanks ProtoStack!). I did have an Atmel JTAG ICE mk-II that I was planning on using to program the ATmegga328, but the USBasp is a bit more compact and I thought I'd use that instead.
User's Guide for the ATmega328 kit is very well laid out and is easy to follow. They have put a lot of effort documenting different build configurations to easily change how the board is powered or programmed. They clearly document how to power the board with a DC Jack, USB Device, Coincell CR2032 Battery, or Terminal Block. They also show how to add board stacking connectors.
Parallax 16x2 Serial LCD by hooking up the RX pin of the LCD display to the D1 [Tx] pin of the micro and hooking up 5V and GND of the display to the boards power rails.
Adafruit's cool ATmega 168/328 labels on the micro, so I don't have to grab the schematic or datasheet when doing a quick measurement or mod.
websites/software. The struggle I had was all of these websites assumed the user had a basic understanding of programming Atmel AVR's which I didn't. All I had done before is used the Arduino IDE to program parts that already had the Arduino bootloader installed.... so that was my first step, I needed to use the USBasp to program in the Arduino bootloader then I should be able to use the RS232 interface to load sketches onto this board.
The first thing I did was download Atmel's AVR Studio for Windows. I got that installed and was surprised to find that even though the USBasp programmer had a windows driver it was not compatible with AVR Studio.... fail. So I grabbed my mk-II programmer I had gotten from a friend and was surprised to find that I could not get that to work either..... double fail. It turned out that the mk-II programmers USB Device interface was broken and it worked fine if I used its RS232 connection instead. This worked, but I wanted to get the USBasp programmer working, so I downloaded a few other free Windows AVR programs.
I downloaded WinAVR which is compatible with the USBasp, but it kept crashing and locking up on my Vista laptop. So I downloaded eXtremeBurner-AVR which ran fine, but it didn't have the ATmega328 in it's list of parts it was compatible with. At this point I gave up on finding a Windows compatible AVR program that worked with the USBasp and rebooted my laptop and started up my Ubuntu 11.04 Linux distribution.
I loaded AVRdude and started searching for tutorials on how to load the Arduino bootloader into blank parts with AVRdude. This wasn't too hard to find; Adafruit's LadyAda and Sparkfun all had well written tutorials to walk me through the process.
First thing I did was look in my Arduino IDE directory for the \arduino-0022\hardware\arduino\boards.txt file. This text file told me that for an Arduino Uno with an ATmega328 I needed to use the \arduino-0022\hardware\arduino\bootloaders\optiboot\optiboot_atmega328.hex bootloader file with the low fuses set to 0xFF, high fuses set to 0xDE, extended fuses set to 0x05, and the lock bits set to 0x0F. Cool, now I had all the info I needed to program the Arduino bootload into my board.
Next I needed to figure out how to use the USBasp with AVRdude. After plugging the USBasp into my laptops USB port I struggled a bit to get AVRdude to recognize that the USBasp was plugged in.
avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc
After Google searching for clues as to why I couldn't get it to work I found many posts stating that the Linux permissions for the USBasp required AVRdude be run by the super-user (su) or root. I tried that and still wasn't having any luck. Using the lsusb command I could see that the USBasp programmer was being recognized but it looked like there was a PID & VID ID conflict error with libusb.
ID 16c0:05dc VOTI shared ID for use with libusb
After trying to read the AVR forums for several hours to try and find a solution I remembered that some of my USB flash drives wouldn't work with Ubuntu when plugged directly into my laptop's USB ports, but worked fine when plugged into a 4-1 USB hub that was plugged into my laptop. So I tried plugging the USBasp into my 4-1 USB hub and once I got the permissions setup right it worked great!!!!! (Yeah now I was cooking!)
I loaded up the command shell and moved to the folder that had the optiboot_atmega328.hex file in it and typed in the following command into AVRdude:
avrdude -b 19200 -c usbasp -p m328p -F -v -e -U flash:w:optiboot_atmega328.hex -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m -U lock:w:0x0F:m
- "avrdude" runs the program
- "-b 19200" is the baud rate avrdude sends the data to the programmer
- "-p m328p -F" sets the device to ATmega328p... the -F kills the warning i kept getting because I had a ATmega328 - no "F", but AVRdude doesn't have a non-F part in it's list of supported devices.
- "-v -e" erase and verify the Flash of the part
- "-U flash:w:optiboot_atmega328.hex" is the file we want to load into the device
- "-U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m -U lock:w:0x0F:m" sets all the fuse and lock bits. These bits configure the devices boot, xtal and configuration settings
A complete text file of the output is available here for download.
Now that I had the Arduino Uno bootloader loaded into the micro I loaded up the Arduino IDE and wrote a small sketch to display a message on the Parallax Serial LCD.
Overall I am pretty happy with the ProtoStack ATmega328 Development Kit and would highly recommend anyone getting one. I am excited to build up a few new projects with this board; having the extra prototyping space without having to stack a proto shield is a huge plus. Thanks ProtoStack for sponsoring the 7400 contest and getting me this kit and USBasp programmer!