Electronic – Possible to buy Atmega328p with programmed Flash and EEPROM

atmega328peepromflashmicrocontrollerprogramming

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

Best Answer

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.