How to program a "raw" mcu on pcb - Page 1
Forum section: electronics / beginners

author: Ram80
author_rank: Contributor
timestamp: June 08, 2024, 12:29:48 pm
content: So far I've been using an stm8 which comes on a development board hence it has pins to connect to programmer. Say I wanted to create a product, I'm just going to want to use a individual MCU chip soldered directly onto a PCB. So what's the best way to hook this up to a programmer. I could solder wires direct to the MCU legs but that's some fine soldering for a start.How would you generally do this, i.e connect programmer cables to the MCU while it's in it's most raw state on a PCB ?Secondly, when sourcing a PCB for a final product which will have strips to solder an MCU onto, can you buy generic boards or will most be custom made to fit?

author: Doctorandus_P
author_rank: Super Contributor
timestamp: June 08, 2024, 01:09:43 pm
content: The simplest is to just put a connector on the PCB that breaks out the needed pins (STM8 only needs power, GND, SWclk, SWdata If I remember well).Usable connectors can come in many formats. The simplest is a 4- pin header with square pins. There are ingenious methods to bend the pins in such a way that they clamp in the holes without having to actually solder the pins. There are also test clips with a bunch of pogo pins you can clamp on the side of the PCB. Or a more luxurious variant such as the "TagConnect" connectors.In bigger systems it is more common to have a "bed of nails" type text equipment. Such test fixtures align the whole PCB to a lot of pogo pins and clamp it down while the electronics in that system does a whole lot of functionality tests of the hardware, and it can also do programming.Yet another possibility is to order your IC's pre programmed. Several manufacturers have a service where you can buy the chips programmed with your firmware for a small extra fee.The two searches below give a decent overview of different ways to connect programming or test fixtures to PCB's.https://duckduckgo.com/?hps=1&q=pcb+test+fixture&iax=images&ia=imageshttps://duckduckgo.com/?q=pcb+programming+connector&iar=images&iax=images&ia=images

author: Ram80
author_rank: Contributor
timestamp: June 08, 2024, 01:34:23 pm
content: Would it possible to just place the MCU onto an adapter board without soldering then connect the board to the programmer?

author: jpanhalt
author_rank: Super Contributor
timestamp: June 08, 2024, 01:45:32 pm
content: I don't think just sitting on a board will work for programming. If I understand your question, you want to program a chip before soldering it into a target circuit.Various companies make testing and burn-in ZIF sockets for SMD chips. I have used the 3M version called "Textool." There are less expensive versions available from China. Basically, they apply a little pressure to the chip sitting on springy contacts. Just search on that name, and you should get several hits.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: June 08, 2024, 02:20:41 pm
content: The problem with attempting to clamp the chip to such a PCB, is that neither the pins of your IC, nor the pads on the PCB are flat, and because of this you will need extreme clamping forces to get a reliable connection. You need a bit of springiness in each contact to make sure that it gets a reliable connection. But for a bunch of common IC packages there are test clips available. as jpanhalt also mentioned.Also note that pogo pins are readily available in a lot of different models. From sharp points to crater types. There are also very short pogo pins (3mm high or even smaller) that can be mounted on a PCB to create a bit of springiness in contacts.But overall, it's probably easier to first solder your IC's into the final circuit, and then program them. Small IC packages are a nuisance to handle manually, while it's much easier to add some kind of test and programming connection to the bigger PCB.

author: JustMeHere
author_rank: Frequent Contributor
timestamp: June 08, 2024, 02:44:54 pm
content: If you're going to make adapter boards, you might as well put the hole on the actual board.A lot boards have a programming header on them. These headers are also used for debugging. The Arduino Uno R3 actually has 2. These are the 6 pin headers near the two MCU.https://store-usa.arduino.cc/products/arduino-uno-rev3?selectedStore=usThe Arduino actually has a third programming "header" too. That's the universal serial port. The second MCU is actually there to do that. It's job is to program the main MCU.The two options used in the Arduino:6 pin ICSP headers (In circuit self programming)Build a programmer into your design that can use a common interface like USB.If you do use an ICSP header, take care to have programming pins "quiet" for a second or two at boot. This will give your programmer a chance to start the programming.In the case of the Atmel chips, the SPI bus is shared with programming and other SPI chips. You need to make sure the other chips have their CS biased (pulled up or down) to the inactive signal level. If you don't they will see the programmer working and think they are getting commands. They will start talking and interfere with the programming.See section 2 of this guide:https://ww1.microchip.com/downloads/en/appnotes/atmel-0943-in-system-programming_applicationnote_avr910.pdfThe ESPThing by Sparkfun has a good example of a built in programmer. See the top right of this schematic:https://cdn.sparkfun.com/assets/learn_tutorials/5/0/7/esp32-thing-schematic.pdf

author: pcprogrammer
author_rank: Super Contributor
timestamp: June 08, 2024, 04:33:09 pm
content: Quote from: jpanhalt on June 08, 2024, 01:45:32 pmAs an example you can find these kind of things on Aliexpress:https://nl.aliexpress.com/item/1005005939115495.htmlThis is a 16 pin one, but that can also be used for 8 pins. One thing to be aware of is the width of the chip. For instance 8 pin FLASH chips can be wider then other 8 pin chips with more or less the same naming like SOP-8. For example you can see it here:https://nl.aliexpress.com/item/1005006431850330.htmlThey come in 150mil, 200mil (208 mil, 209mil) and 300mil and a 150mil chip does not make contact in a 200mil socket.

author: globoy
author_rank: Frequent Contributor
timestamp: June 08, 2024, 04:58:11 pm
content: Quote from: Ram80 on June 08, 2024, 12:29:48 pmI'm not sure what you mean by this question. Usually a product has a custom designed PCB. Sometimes a product can be built around an existing design (for example various gadgets that have a Raspberry Pi in them). But if you have added extra circuitry to your STM8 dev board then you're probably going to have to design your own PCB.I would ask myself the following questions to try to determine the best way to program a micro-controller going into a product.How complex is your product (e.g. how much circuitry did you connect to your dev board that you will replicate on the PCB)?How many of these do you plan to build at a time?Will you be building them or will someone else (e.g. a contract manufacturer)?Are there any other steps that have to be performed when building the board (e.g. calibrating it)?Answers to these questions help decide what kind of production tooling you need (e.g. which solution mentioned previously would be best for your situation). Aside from programming the micro-controller, other things you might end up thinking about include ways to test each board after assembly to make sure there are no problems before shipping it, and steps like calibrating it or adding cryptographic information (doesn't sound like your gadget needs these).

author: tooki
author_rank: Super Contributor
timestamp: June 08, 2024, 05:06:17 pm
content: Quote from: Ram80 on June 08, 2024, 12:29:48 pmBy “strips”, you mean the solder pads?Regardless, commercial products practically invariably have custom PCBs. Generic PCBs are actually not that cheap, and they need a lot of manual labor to become useful. Even if, as globoy says, you integrate a board like a Raspberry Pi into your product, treating it as a module, you’ll likely still have a custom PCB as well. High-volume products rarely use off-the-shelf boards, but you do see it in low-volume products and prototypes.Thanks to Chinese PCB vendors like JLCPCB, even hobbyists now have access to custom PCBs at prices oftenbelowthose of generic boards like perfboard/veroboard/breakout boards. So there is truly no reason not to design your own board, provided you're willing to learn how to do it.

author: dietert1
author_rank: Super Contributor
timestamp: June 08, 2024, 05:36:26 pm
content: For our pulse oximeter production i designed the traces for the programming pins onto the board, ending in a via without any further connection on board. Then we made a programmer/tester with a ZIF socket for the module interface plus spring probes that enter into the vias in order to connect the programmer (TI MSP-FET430UIF) to the MCU. The spring contacts came from Feinmetall Herrenberg, seehttps://www.farnell.com/datasheets/24045.pdf.Regards, Dieter

author: radiolistener
author_rank: Super Contributor
timestamp: June 08, 2024, 11:21:21 pm
content: usually there is JTAG/SWD connector on the PCB, which can be used to connect JTAG dongle and upload firmware