9

I am working on a PCB which includes an microcontroller (STM32), some sensors and a BLE module. Right now it is still a prototype, only 3 units have been produced.

  • To program the microcontroller, I am using the programming probe provided by STMicroelectronics (ST-LINK/V2).
  • To check that the hardware is fine, I send a BLE command to the PCB : the microcontroller verifies that all the sensors are responding and if the test is passed, a green LED is turned on (otherwise a red LED). It is not an exhaustive test procedure but it is convenient for my needs (for example I do not test the red LED nor the values of all the resistors nor the measurements of the sensors).

That works for small quantities, but if the prototyping phase is conclusive it might be produced in large quantites (some thousands), so I will have to change the way the MCU is programmed and the PCB tested. I have never done this before, so I have trouble finding what is expected of me and of the EMS.

Programming

How can the MCUs be mass-programmed ? Let's consider I will not ask STMicroelectronics to deliver the MCUs with my custom firmware (because that solution is "easier"). I suppose I will need to make the programming pins of the MCUs accessible. But can I just send the .bin file to the EMS who will take care of the whole programming procedure ? Do I need to specify the programming procedure ? Or do I need to design another electronical card whose goal will only be to program the MCUs ?

Testing

I do not have any idea how to industrialize a testing procedure. Once again : can the EMS take care of the whole procedure based on my schematics/layout ? Or do I need to design another electronical card ?

pipe
  • 13,748
  • 5
  • 42
  • 72
JackOfHearts
  • 649
  • 1
  • 6
  • 14
  • 1
    Some board manufacturers/assemblers will work with you to design a programming/testing jig with pogo pins that can be used in automated production. – Unimportant Mar 22 '21 at 13:57
  • You can usually buy gang programmers for the common MCUs. Your testing question is too broad. How well do you need to test your product? How fast do you need to test your product? How much can you afford to spend to develop your test equipment? National Instruments sells H/W and S/W to for test equipment, but it is really expensive. Where I worked, we spent hundreds of thousands on test equipment H/W and S/W. – Mattman944 Mar 22 '21 at 13:58
  • There are sliding scales that determine how thoroughly you want to test a product and how much are you willing to spend. On a cheap product, it is not worth checking every single component, just the end functionality. On an expensive product, it is worth checking every single component and maybe even have special test firmware that doubly verifies everything. This will obviously cost more. The choice is yours. Often the assemblers will work with you (for a fee) to find where your happly medium is. – vini_i Mar 22 '21 at 14:11
  • Think about your path to production. Are you going to start by making 10 units or 10,000? If 10 you can manually test and program and figure out what you need to do. If you're ramping up quickly, then work with someone to develop test jigs and test plans, of which programming the MCU will be one aspect. – Spehro Pefhany Mar 22 '21 at 14:16
  • 2
    For pre-programmed MCUs, there are many companies specializing in such. If you tell ST that you want pre-programmed flash for a few thousand parts they'll probably tell you to get lost, that's too low volume. You can ask your distributor if they can do this for you. You should aim to have the parts pre-programmed when they come on tray/tape&reel, not when they are already soldered to the board. That way you can either include test firmware before programming the real firmware, or have the real firmware pre-programmed so that you don't have to mess around with pogos and custom connectors. – Lundin Mar 22 '21 at 14:55
  • The point @Lundin makes gets even more important if you have devices which you can hardly prevent from entering the bootloader and change pins to outputs you didn't want to have as output. Like on the STM32L4 series. – Arsenal Mar 22 '21 at 15:54
  • These are two separate questions, you should focus on one so it's answerable. – pipe Mar 22 '21 at 23:57
  • ST is experiencing shortages and long lead times on MANY processors. FYI. Do not assume you will be able to order them and get them in a reasonable time frame unless you have a commitment already from ST. – user57037 Mar 23 '21 at 00:06
  • @mkeith Yep, they have completely messed up their production, but they aren't alone. I'm experiencing the same problems with Microchip, Infineon, Silabs and others. This always happens when there's a production dip because of recession, in this case because of Covid. Then when everyone wants to get back on full production, the silicon vendors can't keep up. Then everyone gets skittish and places even more orders. Add component brokers and automated purchasing systems on top of that and you'll get the fiasco that's the world's electronics production à la year 2021. – Lundin Mar 23 '21 at 08:44
  • But well, indeed I wouldn't recommend using STM32F for new projects currently, if you plan production within a year. – Lundin Mar 23 '21 at 08:46
  • @Lundin I like ST. Didn't mean to single them out. I was just trying to warn the OP. This shortage seems a bit worse than previous shortages. Lead times are 36 weeks and more for some parts. But the OP should find something that can be purchased, and design around that. – user57037 Mar 23 '21 at 16:53
  • @mkeith I liked ST until last autumn when they told me to get lost because they can't produce their own products. Supposedly some factory in Taiwan that got mice in the wafers or whatever they will blame this time. When this same thing happened to the industry in 2009, there was no end to creative excuses. – Lundin Mar 24 '21 at 07:33
  • @Lundin you really wouldn't want mice around the wafers, especially older mice. The gunge from a trackball could really contaminate the silicon. – K H Mar 27 '21 at 02:49

2 Answers2

5
  1. First, I'd suggest to use one of these pads (i.e. TC2030) for JTAG/SWD programming as they do not cost a component and they lend themselves very easily to programming jigs. Tag Connect. Use the lower-most footprint at the left. No, not the 0805.
  2. Normally, you can just send the bin or hex file to the EMS. The EMS should be able to identify a gang programmer apt for the MCU, as necessary.
  3. You need a dedicated testing jig ("bed of nails") for the actual testing. General ease of test jig development depends on the presence of test pads and how the PCBA mechanically lends itself to testing (i.e. are the test pads reachable by pogo pins and are not hampered by tall components, etc). Note that the programming jig and the testing jig can be the same jig, but again, that depends on the complexity of the PCBA, and the number/complexity of tests.
  4. You do need to present them a programming procedure (power up sequences, pin inputs, etc). Its the EMS's job to replicate this on a mass-pro level. Same with the basic test procedure you mentioned.
  5. Component-wise, you can opt for the EMS to do ICT test prior to programming/ testing. At least for the first batch, just to be sure that the right component values are mounted on the right places or that BGA components are connected well. You'd have better confidence of proceeding with the programming/ testing (or at least less debug points to look into) knowing that the PCBAs are assembled correctly.
  6. At a very basic level, those test jigs are computer-controlled (i.e. PC with LabView hooked to different instruments, the programmer, etc) where an operator/ technician manually loads the PCBA(s), presses down the jig, press a start button on the interface, wait for the programming, and the test results PASS/FAIL message to come out.
Carla H.
  • 410
  • 2
  • 7
  • If you go with a custom programming solution, you can drop a lot of the pins from SWD (in this case), it just needs 4-5 or so pins and not all 10 present on the standard 2x5 1.27mm connector. – Lundin Mar 22 '21 at 14:59
  • 1
    Yup, I suggested the TC2030, the footprint just above the 0805 footprint at the lowermost-leftmost part of the pic. For SWD, I believe one needs 5 out of those 6 pins (data/ clock/ vref/ gnd/ reset) at the minimum. – Carla H. Mar 22 '21 at 15:07
  • Yep, that's a neat solution. Though btw I still recommend to keep the 2x5 connector on the PCB if there's room, just exclude it from assembly. They are very nice to have for the programmer in case there's need to troubleshoot something and then you can just hand solder a single one on a board. – Lundin Mar 22 '21 at 15:13
  • 1
    There's no need for that. That footprint has a standard connector i.e. to a Segger or STLinkV2. Actual pic from a previous project: https://i.imgur.com/05fLQNc.jpg – Carla H. Mar 22 '21 at 15:20
  • Curious, though I'd still prefer good old soldering if I need it connected for long times. Especially when connecting to some board that's been out in the field for a while and you got oxidation on all pads. – Lundin Mar 22 '21 at 15:35
  • We aren't having the best experience with the Tag-Connect system. Our jig builders have tolerance problems because the dots are very small and close together. If board space is a premium it is still requiring quite a big area. And lastly we've seen cables just go half bad with random connection issues occurring. So in the end we turned back to normal sized test points with soldering our SWD wires to them for development and direct pogo contacting during production. (but that is just our experience) – Arsenal Mar 22 '21 at 15:51
  • @Arsenal I don't think tag-connect was made to be used in jig setup. It's just a connector for development and service without bom cost. – Jeroen3 Mar 23 '21 at 11:35
4

It depends on the volume and firmware image size.

  • You can use the ST-Link utility in "auto-mode" and for example a TAG-Connect pogo-pin connector. Quickly setup, but quite slow.

  • You can use the various bootloaders inside the ST chips. Very slow, but easier to scale if you write the sofware. (eg: attach 10 devices to a host at once)

  • You can use a custom pogo-pin test jig and production programming hardware. Combined with basic electrical test. Expensive, but very fast per unit programmed and little room for human error.

  • You can use any of the above methods to load your own tiny bootloader and then pull firmware from the network or bluetooth.
    Very fast but hard to setup. You load a very small binary using the ST-Link and then have the board test itself and pull the full firmware. (useful with embedded websites containing many images)

Jeroen3
  • 21,976
  • 36
  • 73
  • I think it would help to have a rough number of the speed you can expect. This allows for people to estimate which option is worth to consider or to look into. – Arsenal Mar 22 '21 at 14:22
  • @Arsenal An STLINK-ISO does a 77kB image in about 4 seconds into an STM32F4. – Jeroen3 Mar 22 '21 at 15:19
  • @Arsenal For custom-made batch bootloaders, the time bottleneck by far is that someone has to manually connect/remove all the boards to whatever "programming chain" you have designed. So ideally you would design some cunning "backplane" solution. For example I designed such a bootloader over CAN once, the problem was neither data speed nor flash erase times, but that it relied on DB9 IDC connectors along a cable that had to be attached to each device, which took far more time than the actual programming. – Lundin Mar 22 '21 at 15:30
  • @Lundin that's why we have up to 21 boards in one programmer jig and then have them all connect at once before they are cut out. Handling time is minimal, but tests are serialized, so test and programming time becomes dominating. So a difference between 15 kB/s or 30 kB/s is quite important. There are a lots of different strategies which all are viable in certain cases. – Arsenal Mar 22 '21 at 15:42
  • @Arsenal The project I made was based on 1000kbps CAN, since all boards already had CAN. The advantage of CAN is that it's rugged, got built-in CRC and you get multi drop with no effort. Faulty nodes can post error messages without interrupting traffic etc. – Lundin Mar 23 '21 at 08:37