I'm trying to set up a PCB with an atmega168 and no programming header. I intend to use a serial bootloader (there is a ft232 on the board) to reprogram but I am wondering about the best way to program the bootloader on. Has anyone else tried this before? I am having trouble sourcing a tqfp-32 zif socket.
It might be easier to bring out the programming pins to some pads then use pogopins to attach your programmer.
Just put an ISP header on your board as an "alternative" to the serial bootloader. Then use something like the AVRISP MkII to program your hex file and fuses with AVRStudio. Maybe you only use it once to load the bootloader, but it's by far the most cost-effective solution you're going to find.
In case you don't know what I mean by an ISP header, it's a 2x3 male header, with the following pinout:
2x3 pin connect to AVR pin 1 MISO 2 VCC 3 SCK 4 MOSI 5 RESET 6 GND
Odd numbered pins are on one row, even numbered pins are on the other row, and sequential pins are otherwise adjacent. On a board layout looking down at the top layout the pads are numbered like this (or any consistent rotation):
2 4 6 1 3 5
Wire it like that and you should be able to plug in any programmer that supports ISP (e.g. AVRISP MkII, STK500, etc.)
If you are buying these in large volumes often you can buy chips directly from the vendor pre-programmed with your boot loader. I'm not sure if Atmel offers this service, but I know Microchip does so I would assume they do as well.
In production we use these TQFP32 adapters we bought on ebay.
PS. We bought several more than we need so if anyone needs them with an EU VAT invoice... ;-)
In-system programming facility is a good idea. It'll also let you update the firmware if necessary. Other ways probably involve making a needle bed or a substitute for one.
As a compromise, you could make sure there are test points somewhere on the needed (GND, !RST, SCK, MOSI, MISO, +V) nets and make a needle bed to match those. Then you don't need an actual ISP connector/layout on board. You might extend that to do some automated production testing, too.
You talk about batches of >1, and then the following is probably not worthwhile, but it certainly is for larger batches, say 100 and up.
With In Circuit Programming you program the device after PCB assembly, so with the controller mounted on the PCB. On the bottom of the PCB I have test pads which bring the for programming required signals outside. Typically that's JTAG, but it could also be a serial port. Have the engineering department build a test jig with spring-loaded test pins matching the test pads.
You'll need test pins to supply power too. I usually add a few extra test pins for for instance measuring certain parameters, or a communication channel where the microcontroller can identify itself (think software version). You can't have too many test points. You don't need the space-hungry connector (which also costs money), and you can place the test pads wherever you please. There's always place for a 2mm pad.
The test jig costs in materials and labor, but you really need one if you have a large production, and then you might as well use it to program the device.
After programming you can boot the device on the test jig and perform a number of functional tests.