8
\$\begingroup\$

For my Super OSD project I'm going to need to program large batches of MCU's, probably about 10-15 boards an hour. I could just use my trusty PICkit 2 to program them (there are two - maybe three - on each board) but it would be very laborious to load each file (up to 128KB and 256KB in size), hit program, and repeat for each MCU, and probably wouldn't allow me to meet my target speed. Also, the MCU's are surface mount, so I have to have headers on the board to allow this. Ideally, I'd like to remove these headers, but it may not be an option.

So what options are there for mass programming of MCU's - are there faster ways to do it? I'm kind of on a budget of less than $100 USD, so things like Microchip's MPLAB PM3 at $895 USD, while nice, wouldn't be an option.

I'm dealing with PIC microcontrollers of various types. There's a PIC16F887, PIC24FJ64GA002 and dsPIC33FJ128GP802. However, I am also interested in options for AT32 and STM32 processors, as I may also be using them.

Please note, I'm not currently considering ordering chips from the manufacturers pre-programmed because the software may change by the time the chips arrive, and because of the additional cost involved.

\$\endgroup\$
3
  • \$\begingroup\$ 15 boards per hour is four minutes per board. How long does the PICkit 2 take to program your part? \$\endgroup\$
    – markrages
    Commented Nov 27, 2010 at 23:36
  • \$\begingroup\$ @markrages: It's about 20 seconds with a small code base (~6KB). I imagine with more code, it could take up to a minute and a half for each board, which doesn't give me much breathing room. \$\endgroup\$
    – Thomas O
    Commented Nov 28, 2010 at 0:17
  • 3
    \$\begingroup\$ @Markrages, I can vouch, I wrote a very large project with the ICD2 LE and it would take 2 or 3 minutes to program. Quite annoying. With the pickit 3 however, it is screaming fast. \$\endgroup\$
    – Kortuk
    Commented Nov 28, 2010 at 0:20

7 Answers 7

10
\$\begingroup\$

What we do for production, is to first load a program into the PIC that tests out the board (using a small test board that independently verifies the 3.3v rail is within spec using a couple of comparators, and then we use the ADC on the PIC to check everything else out. We had enough pins left over to allow this (it required some extra resistors to act as voltage dividers for the voltages over 3v).

After the tests pass, the real production code is flashed into the micro. Some additional tests are run, and the PCB is ready for assembly into a case.

This is all done via a program on the PC that only requires an operator to connect the board, click one button, and wait for the result PASS/FAIL. All test results (including ADC readings) are logged. The entire process (including the programming of the PICs via an ICD 3) is controlled via the PC program, which runs batch scripts to do the actual programming. Communication to the PIC to control the tests is done via one of the UARTs, whose pins are brought out to the test board (so in addition to the pins required for programming, we also have TX/RX as a minimum).

We set up several stations like this at our contract manufacturer.

BTW the ICD 3 is much faster than the ICD 2 (USB 2.0 vs 1.1).

\$\endgroup\$
4
  • \$\begingroup\$ The pickit 3 also runs at USB 2.0 which is why I love it. ICD3 is a little expensive for me. My company uses MSP430s so it is quite different. \$\endgroup\$
    – Kortuk
    Commented Nov 29, 2010 at 1:18
  • \$\begingroup\$ Can you clarify how you program the IC? Your own brewed up ICSP or what? \$\endgroup\$ Commented Jan 15, 2016 at 13:13
  • \$\begingroup\$ @ErikFriesen I use either an ICD 3 or REAL Ice for Microchip PICs. Both are probably too expensive for most hobbyists ($200 and $500 respectively). Other chips families (Freescale, Silicon Labs, etc.) have their own line of programmers. I include headers on the PCB's to connect with the programmers. After a device is out in the field, if it has wireless connectivity (Cellular or WiFi) it can be updated over the air. \$\endgroup\$
    – tcrosley
    Commented Jan 15, 2016 at 18:42
  • \$\begingroup\$ I have both and the pm3. The pm3 won't do all parts without connecting to the pc on > X2.15, it splits on the pic32 line. \$\endgroup\$ Commented Jan 15, 2016 at 19:10
5
\$\begingroup\$

Get a pickit 3 and put it in programmer to go mode.

You tell it you want programmer to go mode and you load your rom, then you no longer need a usb port for more than power(yes, you still need it for power).

As you plug into devices you hit the program button and it loads the program and lets you know when it is done, takes less then 20 seconds a board. Costs no more than 50$

\$\endgroup\$
4
\$\begingroup\$

The PICkit 2 isn't a production programmer. You really need to get an ICD 3, which is classed as a production programmer, if you want to be sure that the devices are being programmed properly. Alternatively, you could buy your chips pre-programmed from Microchip or a distributor, if you have the code finalised.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ This would be the correct way to go about this. \$\endgroup\$
    – Kortuk
    Commented Nov 27, 2010 at 22:28
  • \$\begingroup\$ Please provide a citation for the "production programmer" comment. Clearly, the Pickit isn't physically robust enough for an industrial application. But the signals it presents to the target are the same as any other programmer. (The original meaning of "production programmer" is that certain programmers were able to vary the supply voltage and read back the program contents to verify correct programming. Microchip hasn't mentioned this in their datasheets for about a decade, but the folklore lives on. Ironically, the PICkit 2 can vary the supply voltage...) \$\endgroup\$
    – markrages
    Commented Nov 27, 2010 at 23:32
  • \$\begingroup\$ This cropped up on the Microchip forum recently. The ICD 3 documentation states that it is a production programmer, unlike the PICkit 2/3 which someone from Microchip stated were not production programmers. \$\endgroup\$ Commented Nov 27, 2010 at 23:45
4
\$\begingroup\$

Microcontroller programming is usually a small part of a larger functional testing process. What is the rest of your test plan like?

For any non-trivial product, you will need to design another board to test the board under production. Generally, the test board will have a computer interface and will connect the target to test equipment with RS-232 or GPIB capabilities. Then a computer can run through a script, programming the board, then running whatever tests are appropriate.

It is helpful to have this test board running for firmware development as well. Implement enough tests to catch regressions in the firmware.

The start of your test board is probably the PICkit 2 circuit. The firmware is open-source, it will take care of the programming part, it has a handy bootloader, and you can extend it to do anything else your functional test will need.

I like to write my production test scripts in Python, but I think the industry standard is Labview.

\$\endgroup\$
1
  • \$\begingroup\$ I use Python lots, but never for general scripting - usually I leave that up to bash/shell or Perl. Thanks for the tips. \$\endgroup\$
    – Thomas O
    Commented Nov 28, 2010 at 0:19
3
\$\begingroup\$

One method you could use is to make a clamp or something akin to a test bed (example video) with pogo pins, so that you don't need to solder pins for the programming connectors. A PCB edge connector, such as an old style floppy cable, might be a cheaper (but more board area demanding) option.

You'll have to come up with a way to program each microcontroller, probably using either multiple programmers or a batch file like David suggested. You could combine it with a large switch (perhaps one of the rotary switches from an old printer sharing switchbox, or a few relays), to reconnect the programmer from one PIC to another without moving the connector.

The techniques also apply for other in-system programmable controllers, although the JTAG capable ones may make it yet easier because JTAG TAP is designed to be chained, so there'd be no moving the programmer from chip to chip. Also, for chips like AVRs that can use ordinary logic levels for programming, the switching could become easier.

\$\endgroup\$
2
  • \$\begingroup\$ You don't even need pogo pins: I put a header pin in the PICkit 2 and I can program by inserting it into the holes in the board and pressing sideways a little bit, then maintaining this pressure until programming is complete. \$\endgroup\$
    – markrages
    Commented Nov 27, 2010 at 23:37
  • \$\begingroup\$ @Markrages, that is how I do it at work. \$\endgroup\$
    – Kortuk
    Commented Nov 28, 2010 at 6:00
2
\$\begingroup\$

There is a command-line utility called PK2CMD for Windows and Linux that lets you program your PICs with the PicKit (so you don't have to use MPLAB or some other GUI). You could use your favorite scripting language to make a little program that runs the correct PK2CMD command when you press a key. This would make the computer side of your production less laborious (just 1 key press per MCU) but you would still need a way to connect the PicKit to each of your 3 MCUs.

\$\endgroup\$
1
\$\begingroup\$

Microchip's programming service is very cheap last time I used it, Once you cover the setup cost it's very cheap - pennies per chip for 12F's - not looked at higher end ones. They can also do marking/labelling etc. Even if you intend to change the FW, having a bootloader preprogrammed may make this easier.

For a production programmer I like the Asix Presto - tons of options for stuff like serialising, and very fast

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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