6
\$\begingroup\$

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 ?

\$\endgroup\$
13
  • 1
    \$\begingroup\$ Some board manufacturers/assemblers will work with you to design a programming/testing jig with pogo pins that can be used in automated production. \$\endgroup\$ – Unimportant Mar 22 at 13:57
  • \$\begingroup\$ 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. \$\endgroup\$ – Mattman944 Mar 22 at 13:58
  • \$\begingroup\$ 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. \$\endgroup\$ – vini_i Mar 22 at 14:11
  • \$\begingroup\$ 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. \$\endgroup\$ – Spehro Pefhany Mar 22 at 14:16
  • 2
    \$\begingroup\$ 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. \$\endgroup\$ – Lundin Mar 22 at 14:55
5
\$\begingroup\$
  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.
\$\endgroup\$
7
  • \$\begingroup\$ 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. \$\endgroup\$ – Lundin Mar 22 at 14:59
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ – Carla H. Mar 22 at 15:07
  • \$\begingroup\$ 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. \$\endgroup\$ – Lundin Mar 22 at 15:13
  • 1
    \$\begingroup\$ 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: i.imgur.com/05fLQNc.jpg \$\endgroup\$ – Carla H. Mar 22 at 15:20
  • \$\begingroup\$ 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. \$\endgroup\$ – Lundin Mar 22 at 15:35
4
\$\begingroup\$

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)

\$\endgroup\$
5
  • \$\begingroup\$ 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. \$\endgroup\$ – Arsenal Mar 22 at 14:22
  • \$\begingroup\$ @Arsenal An STLINK-ISO does a 77kB image in about 4 seconds into an STM32F4. \$\endgroup\$ – Jeroen3 Mar 22 at 15:19
  • \$\begingroup\$ @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. \$\endgroup\$ – Lundin Mar 22 at 15:30
  • \$\begingroup\$ @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. \$\endgroup\$ – Arsenal Mar 22 at 15:42
  • \$\begingroup\$ @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. \$\endgroup\$ – Lundin Mar 23 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.