Author Topic: How to program a "raw" mcu on pcb  (Read 755 times)

0 Members and 1 Guest are viewing this topic.

Offline Ram80Topic starter

  • Contributor
  • Posts: 37
  • Country: gb
How to program a "raw" mcu on pcb
« on: June 08, 2024, 12:29:48 pm »
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?
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3832
  • Country: nl
Re: How to program a "raw" mcu on pcb
« Reply #1 on: June 08, 2024, 01:09:43 pm »
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=images

https://duckduckgo.com/?q=pcb+programming+connector&iar=images&iax=images&ia=images



« Last Edit: June 08, 2024, 01:13:11 pm by Doctorandus_P »
 

Offline Ram80Topic starter

  • Contributor
  • Posts: 37
  • Country: gb
Re: How to program a "raw" mcu on pcb
« Reply #2 on: June 08, 2024, 01:34:23 pm »
Would it possible to just place the MCU onto an adapter board without soldering then connect the board to the programmer?


 

Offline jpanhalt

  • Super Contributor
  • ***
  • Posts: 3762
  • Country: us
Re: How to program a "raw" mcu on pcb
« Reply #3 on: June 08, 2024, 01:45:32 pm »
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.
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3832
  • Country: nl
Re: How to program a "raw" mcu on pcb
« Reply #4 on: June 08, 2024, 02:20:41 pm »
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.
 

Offline JustMeHere

  • Frequent Contributor
  • **
  • Posts: 813
  • Country: us
Re: How to program a "raw" mcu on pcb
« Reply #5 on: June 08, 2024, 02:44:54 pm »
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=us

The 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.pdf

The 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
« Last Edit: June 08, 2024, 05:49:03 pm by JustMeHere »
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4305
  • Country: nl
Re: How to program a "raw" mcu on pcb
« Reply #6 on: June 08, 2024, 04:33:09 pm »
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.

As an example you can find these kind of things on Aliexpress: https://nl.aliexpress.com/item/1005005939115495.html

This 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.html

They come in 150mil, 200mil (208 mil, 209mil) and 300mil and a 150mil chip does not make contact in a 200mil socket.

Offline globoy

  • Regular Contributor
  • *
  • Posts: 233
  • Country: us
Re: How to program a "raw" mcu on pcb
« Reply #7 on: June 08, 2024, 04:58:11 pm »
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?

I'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).
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12577
  • Country: ch
Re: How to program a "raw" mcu on pcb
« Reply #8 on: June 08, 2024, 05:06:17 pm »
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?
By “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 often below those 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.
 

Offline dietert1

  • Super Contributor
  • ***
  • Posts: 2375
  • Country: br
    • CADT Homepage
Re: How to program a "raw" mcu on pcb
« Reply #9 on: June 08, 2024, 05:36:26 pm »
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, see https://www.farnell.com/datasheets/24045.pdf.

Regards, Dieter
 

Online radiolistener

  • Super Contributor
  • ***
  • Posts: 3995
  • Country: ua
Re: How to program a "raw" mcu on pcb
« Reply #10 on: June 08, 2024, 11:21:21 pm »
usually there is JTAG/SWD connector on the PCB, which can be used to connect JTAG dongle and upload firmware
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf