4

I've recently upgraded my old project that goes to mass production (a pair of thousand pieces, pretty niche). Previously I used DIP atmega328p, which were manually programmed in China. I sent them a detailed instruction, HEX of Flash and HEX of EEPROM, all was OK, I made the process as quick as I could, given limits.

But I've decided to switch to SMD version of the MCU (hardware/spacing related reasons). So it will make assembly process quicker and easier. So I thought why not to optimize MCU programming step as well, now that I have a little more experience and knowledge (the original project was one of my very first projects ever). So if I can also get rid of manual programming, it's a double win. I'm aware of zif sockets for qfn-32 which can be used to program the MCUs manually, it's a backup option. I want pick-and-place machine to solder the MCU onto the board and be done with it. Manual programming means manual soldering of the MCU, which, in case of QFN-32, sounds like a really bad idea.

Unfortunately, fierce and fingerbreaking googling didn't yield expected (or desired) results. The best I saw was purchasing Atmegas with a bootloader, which doesn't really solve the problem of course.

So is there a way to buy Atmega328p SMD with Flash and EEPROM programmed? The rest of the PCB will be assembled in China, so if there is any way to do that in China too (LCSC?), that would be great, but I just want to find out if/how this works in general, who could I contact? Should I contact, say, LCSC? Or someone else? It's critical to have BOTH FLASH and EEPROM.

In case it somehow matters: in my project the Atmega328p runs from the internal 8mhz oscillator

Ilya
  • 3,478
  • 7
  • 33
  • 5
    Have you considered in-circuit programming with a test jig? – user253751 Jul 09 '20 at 13:33
  • individually programming every chip? Sorry, I have no idea what you're talking about. Please, give a link to a picture or specify somehow. The MCU are intended to be loaded into pick'n'place machine after being programmed. My experience with this is still pertty limited, so a single sentence reply doesn't help much – Ilya Jul 09 '20 at 13:35
  • 4
    In-circuit programming means you solder them to the board and *then* you program them. Have you considered that option? It is quite popular. – user253751 Jul 09 '20 at 13:39
  • I have vertical spacing limits, unfortunately, it's not an option as I see it, although you gave me some idea. I would still prefer chips preprogrammed of course. Thank you for an idea anyway, I'll keep it in mind – Ilya Jul 09 '20 at 13:42
  • What does vertical spacing have to do with programming them when they're soldered? – user253751 Jul 09 '20 at 13:54
  • I will have to put jumpers on pins sticking up? I don't have a USB interface to program just like that – Ilya Jul 09 '20 at 13:59
  • 5
    Pogo pins are the usual method of doing this. All you need on the board itself for those is a few circular contacts for the pogo pins to touch, don't even solder anything to them. – Hearth Jul 09 '20 at 14:05

4 Answers4

9

In my experience, this has only economical for gigantic production runs; the cost of this value-add service can be high (I've been quoted a multiple of the price of each controller.) Consider the cost of the service vs. how much it costs for 30-60 seconds of labour on the production line to program the board and go for what makes the most economic sense.

It's often easy enough to add some circular copper pads on the board and use a pogo-pin fixture to program the micro as part of the board's assembly process. This allows for much more flexibility - imagine what might happen if you need a firmware update and you have 100000 pre-programmed parts in stock. If you don't have programming pins on your board, you'd need to ship'em all back and get them unpackaged/reprogrammed/repackaged. (Also, every time a part is handled there's a risk of ESD or other damage -yields may be affected)

If you really must go with pre-programmed, consider having the supplier only program a bootloader into the controller, and do the programming as part of your product test suite. This still allows you to control and update firmware as needed. Once the bootloader is working, it's rare to ever need to update it so it's much safer to pre-program that part of the software.

At my workplace we produce many controller boards with multiple microcontrollers and we always go with the post-assembly pin-programming option. Any EEPROM programming is taken care of during functional test. The cost of doing it at our CM is much cheaper than pre-programming; also, because we use the microcontrollers in multiple projects we would need a unique P/N for each micro + firmware combination in order for the CM to not get mixed up - that would be a logistical nightmare.

Adam Lawrence
  • 32,921
  • 3
  • 58
  • 110
  • Thank you for such an insight. Unfortunately, pogo-pins are a no go for space reasons, although I have some other ideas already. I will provide the PCB manufacturer with both flash and eeprom, I did that before, just hoped to save a little bit of cost on the pcb manufacturer not actually programming the mcu. Guess I'll have to live with pcb manufacturer programming them. I'll find a way to make it possible. Thank you – Ilya Jul 09 '20 at 14:03
  • 6
    @Ilya Pogo pins don't go on your circuit board. They go on the *other* circuit board that you design to program *your* product with. And they touch tiny copper circles that you put on your product's circuit board. Can you really not think of *any* way to temporarily plug something into your product's circuit board? How big is it? – user253751 Jul 09 '20 at 14:24
  • 1
    something like tag-connect works well - they are pogo pins – uglyoldbob Jul 09 '20 at 15:23
  • 1
    There are a myriad of ways of doing in-circuit programming. None need to be extensively large. Heck, make a few vias larger (and unplated) and use *those* as your pogo-pin points. – Adam Lawrence Jul 09 '20 at 17:54
  • 1
    ICSP connectors that take up almost no little board space do exist, see e.g. [SOICbite](https://hackaday.com/2019/06/13/soicbite-a-program-debug-connector-for-an-soic-test-clip/). – 2012rcampion Jul 10 '20 at 02:07
  • 1
    Considering how other answers point out services that can do it for less than 20% of the part cost even at less than 100 units quantities, I do no see how it would be uneconomical. – jpa Jul 10 '20 at 07:13
  • Another with images of the pads on the PCB and the programming connector: microchip.com/forums/tm.aspx?m=440903&mpage=2 (yes, yes it says PIC but the same should work with AVR) – ilkkachu Jul 10 '20 at 10:55
  • @jpa I suppose it depends on your service provider. I've not had luck with pre-programmed micros being economical other than with DIP packaged parts which are easy to remove/replace in their tubes. I did advise OP to consider the cost of the value-add service vs. the cost of having the CM do the programming themselves. – Adam Lawrence Jul 10 '20 at 13:06
  • 1
    "In my experience, this has only economical for gigantic production runs;" Eh, you got ripped off then. I do this with several projects that only run around 1k pieces a year. The companies offering this service most often has a better deal with the silicon vendor than you can get yourself, so most of their profit comes there. The products only gets marginally more expensive and I save that on salaries, not mounting programming connectors etc. – Lundin Jul 10 '20 at 13:24
  • Not disputing this fact. It has been some time since we tried this avenue. – Adam Lawrence Jul 10 '20 at 13:54
3

You can order them directly from Microchip pre-programmed and they can ship to your assembly house.

It might be more economical to have the distributor do it, or to incorporate it as part of the testing procedure. Sometimes you might want to load a self-test program and then load the user program when it passes.

Unless your code is extremely simple and stable and your product is disposable, I would strongly suggest retaining some means of reprogramming the MCUs.

Spehro Pefhany
  • 376,485
  • 21
  • 320
  • 842
  • 1
    The prices for programming atmega328p by Microchip factory look to be only about 0.30 USD even at low quantities, so this is definitely a good option. – jpa Jul 10 '20 at 07:11
2

Chip preprogramming is a so-called "Value Add" Service offered by many IC distributors. You will receive your programmed chips in a tape, just like you would an unprogrammed SM IC.

Arrow.com has IC programming-as-a-service

Future Electronics has value-add-programming

or, in this case, you can order programmed chips directly from microchip: https://www.microchipdirect.com/programming/price-lookup

Note, when you use a preprogrammed chip and a contract manufacturer (someone assembling your boards), Definitely use your own part number, do not use the normal MFG pn. The CM will tend to just order the "normal" part and skip ordering your special preprogrammed variant.

pgvoorhees
  • 2,496
  • 16
  • 14
  • Does it mean I won't be able to get the chips programmed and compatible with pick'n'place machine? – Ilya Jul 09 '20 at 13:44
  • 1
    They'll arrive in a normal tape/reel configuration for something like the atmega328p. But, if you really wanted them to, they can repackage it however your workflow desires. You'll just pay a fee. – pgvoorhees Jul 09 '20 at 13:46
2

Most projects I've seen avoided pre-programmed chips. One picture is worth a thousand words:

enter image description here

It doesn't have to be a commercial solution like the Tag Connect in the picture, we are using similar in-house connectors. They take very little PCB area (and zero vertical space), and it's possible to make the mating completely automated for high volumes. Guide holes on the PCB are optional: depending on your product it may be easier to align the connector to parts of the case instead.

Dmitry Grigoryev
  • 25,576
  • 5
  • 45
  • 106
  • looks like cool idea. I may build something similar out of stuff around me (I'm good at crafting stuff) – Ilya Jul 10 '20 at 14:29