In the last few weeks I needed to flash some ATmega328P microcontrollers with the Arduino bootloader. There are a few ways of doing this, and one method is to use an AVR ISP shield. It’s a simple kit to assemble and use, so let’s have look at the process and results.
As the kit is manufactured by Sparkfun, it arrives in typical minimalist fashion:
The kit includes the following items:
That’s it – no URL to instructions or getting started guide or anything. Luckily we have a bit of knowledge behind us to understand what’s going on. The PCB has all the components as SMT including the status LEDs, so the only soldering required is the shield header pins and the six or ten-connector for the programming cable. You receive enough header pins to fit everything except for both six and ten – you can have one or the other, but not both. Having some handy I thought adding my own socket would be a good idea, however the pins are placed too closed to the group of six, nixing that idea:
After collecting all my regular soldering tools and firing up the ‘888 it was time to get to work:
The first thing to fit were the shield headers. A simple way to do this is to break off the required lengths:
… then fit them to a matching board:
… then you place the shield on top and solder the pins. After that I used some of my own headers to fit both six and ten-pin ISP headers – it never hurts to do both, one day you might need them and not have soldering equipment at the ready. Finally the zero-insertion force (ZIF) socket goes in last. Push the lever down so it lays flat before soldering. Then you’re finished:
Now to program some raw microcontrollers. Insert the shield into your board. We used Arduino IDE v1.0.1 without modifying the original instructions from the Arduino team. Now upload the “ArduinoISP” sketch which is in the Examples menu. Once this has been successful the PLS LED will breathe. You then insert the microcontroller into the ZIF socket and gently pull the lever down. The notch on the microcontroller must be on the right-hand side when looking at the shield. Finally – check the voltage! There is a switch at the bottom-left of the shield that allows 5V or 3.3V. This only changes the Vcc so programming a 3.3V microcontroller will still involve 5V via SPI – possibly causing trouble.
Next you need to select the target board for the microcontroller you’re programming. For example, if it’s going into a Uno – click Uno, even if you’re hosting the shield with an older board such as a Duemilanove. Next, choose the programmer type by selecting Tools > Programmer > Arduino as ISP. Now for the magic – select Tools > Burn bootloader. The process takes around one minute, during which time the “PROG” LED on the shield will blink and flicker. It turns off once finished, and the IDE also notifies you of this. For the curious, the process is in the video below:
As you hopefully noticed earlier a cable is included which allows in-circuit programming from the shield to your existing project or prototype. However we didn’t have use for it at this time, it will come in handy when doing more advanced work later on.
It’s simple and it works. So if you need to flash a whole tube of raw micros with the Arduino bootloader, this is an option. Full-sized images available on flickr. This kit was purchased without notifying the supplier.
In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
Latest posts by John Boxall (see all)
- Arduino Workshop – A Hands-On Introduction with 65 Projects - May 6, 2014
- Project Review – Silicon Chip Capacitance Substitution Box - April 23, 2014
- Add long-distance connectivity to your Arduino with the CATkit System - April 13, 2014