# How are SMD microcontrollers preloaded with code?

Often when you buy an SMD microcontroller (say AVR) or a PCB with an SMD microcontroller it comes preloaded with whatever program that board uses to run. I was wondering how it is preloaded - I guess DIP ICs could be programmed using DIP sockets, so are there special SMD sockets?

• – davidcary Sep 24 '11 at 17:59

Most microcontrollers have an in-circuit programming (ICP) capability; you can program them over a few digital I/O lines through JTAG or whatever, by powering up the printed circuit board and hooking up a cable from the board to a PC. This is possible by using programming signals that are at regular logic levels. (Microchip had a high-voltage in-circuit programming approach where the reset line MCLR had to be held at a high voltage (12V?) which was OK only by adding an isolating diode between MCLR and the rest of the circuit.)

In the earlier days before ICP, you could buy large numbers of ICs from the manufacturer, programmed by them, as a value-added service. Small numbers would have to be programmed by you or someone else.

As far as sockets go -- there are sockets for almost everything. A few years ago I was working recently with an MSP430 kit that had a clamshell socket for a 64-pin QFP. They're not cheap but they work well. (Here's one for a 400-pin BGA good to 10GHz) They get used mostly for testing purposes rather than programming.

• You can still buy ICs programmed by the manufacturer; even with ICP it takes time on the line to flash parts and board space to add ICP probe points. For large production runs, this is quite common. For example, Microchip does this through Microchip Direct, in quantities down to 1 (as well as in reel-and-above quantities). – Kevin Vermeer Sep 16 '11 at 16:05

Yes, there certainly are device sockets for SMD devices. They are routinely used for production and reliability testing of SMT components. Production testing is usually done using a device handler, essentially a robotic device that transfers the parts to be tested to and from the socket(s) on the production test equipment.

The same production test equipment is capable of programming the devices at the factory (practical only for large volume purchases), or a distributor and/or end customer can program the parts.

-- edited to add a link to a stand-alone automated programming system. --

http://dataio.com/Solutions/AUTOMATEDPROGRAMMING/PS588.aspx

• For large volumes (thousands), I think they program them at the same point as the e-test, which is in bare-die form. They already have to connect to the IC die to test it before packaging it in the SMT package. – Connor Wolf Sep 3 '11 at 6:12

I see you have already gotten a couple of good answer. Perhaps my writeup on in-circuit programming of Microchip PICs will give you some additional background and help demystify the process in general.

• Argh. I used a HTML A tag for the link, which I thought was supported here. Apparently not. Unfortunately, it seems impossible to look up the editing details when you actually need them in the post editor. Oh well. In any case, the link is embedinc.com/picprg/icsp.htm – Olin Lathrop Sep 3 '11 at 14:10
• HTML <a> tags do work, you just forgot the quotes around the URL. The syntax is <a href="URL" title="Hover text">in-line text</a>. The title attribute is optional, the quotes around the URL (and title) are not. See the <a href="electronics.stackexchange.com/editing-help">Markdown Editing Help</a> and <a href="meta.stackexchange.com/q/1777/146495" title="What HTML tags are allowed on Stack Overflow, Server Fault, and Super User?">this MSO question</a> for more info. – Kevin Vermeer Sep 16 '11 at 15:33
• Note that you'll still have to use mini-markdown [text](URL) syntax in comments. The above is just for demonstration. Not sure why the semicolon got added, though. – Kevin Vermeer Sep 16 '11 at 15:35