I've designed a PCB for small scale production; currently I'm hand soldering them in batches of 20 at a time. This PCB uses an ATMEGA168 microcontroller which I program before soldering to the board - this method works well for me at the moment.

I'm looking at having a batch of 200 boards manufactured and assembled for me as the product I've designed seems to be quite popular. Would it be better practice to either include an ICSP header onto the board or keep on pre-programming the ICs myself? Re-programming of the board after manufacture or assembly isn't an intended or required feature.

I'm unsure of how this is done in a larger scale production environment? Adding an ICSP header would increase the cost of manufacture slightly so is pre-programming a standard practice?


I would suggest always including a header in that kind of quantity (small). If you get to larger quantities you can consider pads for pogo pins (you'd have to make a fixture to hold the PCB in alignment) or, in your quantities, you could use one of the Tag Connect cables which require only holes and unpopulated pads (they snap onto the board).

enter image description here

As well as allowing you to recover from a need for a programming update, this will allow you to have an assembly house populate the boards before programming, which could improve logistics.

Pre-programming is certainly an option, even in production quantities (you can even have the distributor do it for you), but it seems to be mostly used in the most simple of applications. Usually chips on boards are programmed (or capable of being programmed) post-assembly.

  • \$\begingroup\$ This looks like a good solution - thanks for your help, those cables look pretty useful! \$\endgroup\$ – edcs Dec 26 '14 at 18:07
  • 1
    \$\begingroup\$ Tag-Connect work well for this. You can also get versions without the locking pins (the black plastic at the right of the image) which instead rely on pressure or a backplate which captures the pins. Note that the pictured cable is about $50. On the plus side, the PCB contacts are about $0. \$\endgroup\$ – Ben Jackson Dec 27 '14 at 1:30

If you have the space for a header, that's probably the best option, and the slightly staggered pins Majenko recommends is a good way to hold a connector in place without adding complexity.

But here's an alternative approach, for boards where you don't have space to fit a header, or the standard header doesn't accomplish all your programming/setup/board test tasks.

Given a small form factor PCB as here (33mm diameter) enter image description here

you can lay it out with test points (labelled on the back) enter image description here

and create a test fixture for it (using Pogo Pins) enter image description here

This requires some machining ability and at least a pillar drill (because the pogo pins must be exactly vertical). However if you're willing to risk a prototype PCB you can clamp it to a sheet of material and "spot" through the testpoint holes to get the pogo pins in exactly the right place. (I get 10 PCBs for a ridiculously low price from Itead, so losing one is no big deal).

With a lathe and mill, making the pillars and clamps to locate the PCB in exactly the right place is a doddle, but it's not too difficult with simpler tools.

Then you simply fit each PCB, program and test it. The loose connector normally goes to header pins on a TI Launchpad, used for programming this MPU (TI MSP430) via the SBW interface, but the same principle would apply to JTAG or other interfaces. (The brown cable at the top is a co-ax cable carrying a calibration signal to a frequency counter). enter image description here

The polished mahogany base is optional; I just happen to prefer a steampunk style for my test fixtures.

  • \$\begingroup\$ This is a great answer and thanks for taking the time to provide such a useful detailed response! I didn't mark it as the answer because in my case, I have the space to fit in an ICSP header but it's something I'll keep in mind if I have to build anything tiny. \$\endgroup\$ – edcs Dec 26 '14 at 18:04
  • 2
    \$\begingroup\$ That's a pretty jig (or is it a fixture?). Is there anything to key the PCB angle-wise or is it just lined up by eye? \$\endgroup\$ – Spehro Pefhany Dec 26 '14 at 19:59
  • \$\begingroup\$ I eyeball the pogo pins through the visible testpoint holes before I push down and swing the clamps in. Crude but it works. On a larger PCB I'd recommend a couple of location pins, e.g. in the PCB mounting holes. \$\endgroup\$ – Brian Drummond Dec 26 '14 at 20:46

I always add space for an ICSP header, even if it's not populated. I have three ways of doing it at the moment depending on situation.

One of my designs has a very fine pitch header for which I have built an adapter (0.6mm solid core wire is perfect for it):

enter image description here

I use this connector when space is at an absolute premium. (Sorry it's blurred, my phone's camera is naff).

The second arrangement I often use is to incorporate the ICSP into another header. If the ICSP pins can also be used as GPIO pins, and you can use them with a detachable connection, then it is simple enough to include any other ICSP connections you may need (MCLR, for instance) at minimal cost. Then you just plug your programmer into that header with an adapter that should be simple enough to make.

The third way is to provide a "staggered" or "offset" header footprint for ICSP. I use this mainly on development boards where the end user may want to do ICSP but doesn't want to ruin their board by soldering a header in permanently. This footprint allows a standard header to push-fit and make good solid contact without any solder:

enter image description here

When you start dealing with much larger quantities it can certainly be more cost-effective to get the chip manufacturer to pre-program the chips for you with your firmware. I think all the major manufacturers provide that facility.

  • \$\begingroup\$ Thanks for the detailed answer - definitely useful information here! I didn't accept your answer because I'm going to use the Tag Connect cable suggested, though the staggered pin method would work just as well. \$\endgroup\$ – edcs Dec 26 '14 at 18:07
  • \$\begingroup\$ Atmel definitely provides it as an option. \$\endgroup\$ – Ignacio Vazquez-Abrams Dec 26 '14 at 19:09
  • 1
    \$\begingroup\$ The staggered header footprint is pure genious. +1 \$\endgroup\$ – Vladimir Cravero Dec 28 '14 at 15:32

If one is using a processor which can be reprogrammed in circuit, I would highly recommend that boards be designed in such a way as to allow its use, even if actually using the feature would require making building a fixture for that specific purpose and one doesn't plan on having to build one. If a firmware problem is discovered after manufacturing a large batch of boards, building a fixture which can reprogram those boards may be much cheaper than having to rework or rebuild them.

In some cases, a good approach may be to select a board's I/O layout so that the controller pins needed for in-circuit reprogramming are given to purposes which "naturally" result in them being exposed to easily-accessed contact points. For example, a board which is designed for use with metal-dome contacts might have the contacts themselves wired to the in-circuit programming pins. Such a design wouldn't require dedicating any space in the layout for a programming connector, but--especially if the battery contact were also generally sized, allow a programming connector to get by with simple spring-loaded contacts.

Note that it doesn't necessarily matter if the code seems to be well-tested; changes from one batch of chips to the next can still cause unexpected problems. For example, I designed a product that was supposed to switch itself off under processor control by having the processor output "high" on a pin when it was supposed to be "on". On the first batch of 10,000 units everything worked fine, but on a later batch the processor would start malfunctioning when its voltage hit about 2 volts, and could switch that pin back to "high"; the 2-volt "high" output was barely enough to turn the unit back on. Since the processor was specified to remain in sleep mode down to IIRC 1.6 volts, it was possible to correct the problem by reprogramming the units so that they would enter sleep mode when activating their shutdown state. Had such reprogramming not have been possible, much more expensive rework (or else scrapping and rebuilding) would have been required.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.