Use any STM Nucleo as programmer Nov 2015

The Nucleo boards by STMicroelectronics cover a fascinating range of STM µC’s, and are provided for non-commercial use at very low cost. It’s a great way to get started, because they include a built-in “ST-Link V2.1” programmer:

DSC 5257

Actually, the programmer is the only part we’re interested in here. That’s why any Nucleo board will do here. You could saw the bottom part off (can’t break it easily, unfortunately).

The first thing to do is remove those two jumpers. These connect the ST-Link to the board it’s attached to. What we’re after, is to re-use the ST-Link for our own external boards.

The pins on the top left and right are only used as spacers. They can be cut off, if you like. The main pins are the ST-Link “SWD header” (CN4) and those marked TX and RX (CN3).

The programming header pins are, top-to-bottom:

  1. VDD-TARGET
  2. SWCLK
  3. GND
  4. SWDIO
  5. NRST
  6. SWO

Here’s a little PCB for it (a prototype production run is on its way):

Screen Shot 2015 11 17 at 23 00 46

This board is set up to fit on the above ST-Link headers, and can be soldered directly to the pins to create a permanent setup. Note that these pins are not all on a 0.1” grid, so you can’t hack a bit of prototype board onto the ST-Link without bending its pins a bit.

There’s a footprint for an 8-pin header on the left with the following top-to-bottom layout:

  1. N/C (solder jumper can be closed to connect to SWO)
  2. GND
  3. SWCLK
  4. SWDIO
  5. TX (to be connected to target RX)
  6. RX (to be connected to target TX)
  7. 3.3V (analog input, not a power feed)
  8. NRST

By cutting one or more traces inside the solder jumpers, you can rearrange these at will.

Why this layout? Because pins 2..7 match the programming header on a HY-TinySTM103T.

Warning - Without external hook-up, you can still use the ST-Link as programmer for the attached Nucleo. But if you leave the ST-Link attached to the rest of the board you must make some changes to make it work for external use - here is the underside of the ST-Link:

DSC 5259

Solder jumpers SB12, SB13, SB14, and SB15 are used to connect the ST-Link to the rest of the board. If you only use SWCLK and SWDIO, then you’re done. But if you also want to use the ST-Link for the RX, TX, SWO, or NRST pins - you need to cut those connections.

The quick-and-dirty way is to break those resistors with a small cutter, and then remove the debris with a soldering iron. Or just apply more heat and unsolder them properly.

Note that these are the famous “0Ω” resistors: i.e. short circuits. To restore the previous use, you can simply add a solder drop and make sure it covers both pads of the jumper.

The alternative it to simply cut off the ST-Link board and be done with it.

For information on converting the somewhat older Discovery boards to a BMP, see this page on embdev.net - it considerably more work, though definitely possible.

Back to this Nucleo now. We’ve not created a Black Magic Probe - that would require re-flashing the µC on the ST-Link. What we have here is merely an ST-Link V2.1 for external use. But that is actually quite a nice tool as is:

And last but definitely not least: it’s a memory stick. Like all Nucleo boards and all MBED-enabled boards in fact, this board shows up as a memory disk when plugged into USB on Windows, Mac OSX, or Linux. When copying a “.bin” file to it, it will upload that file to the attached target board. No need for any of those “st-…” tools.

One disadvantage is that ST-Link is for STM32 µC’s only, whereas BMP can work with ARM µC’s from a variety of vendors. Another disadvantage has been mentioned here.

But all in all, it’s a useful tool. And as ST-Link, it’s fully compatible with STM utilities.

Weblog © Jean-Claude Wippler. Generated by Hugo.