The thought of having HW debug capabilities on a development board was fascinating, but I found out pretty quickly that I wouldn’t be able to accomplish everything I’d hoped with the ST-Link debugger which is included on the stm32-discovery. I was searching for a cheap/open JTAG debugger when I stumbled across this thread on versaloon.com: http://www.versaloon.com/~bbs/viewtopic.php?f=2&t=17
Here’s how I accomplished converting the ST-Link of one stm32-discovery to Versaloon using the ST-Link of a second stm32-discovery to do the flashing. The details are all pulled from the above linked thread; I’m not taking credit for any of this! Many thanks to Bingo for the stm32-discovery patches and to Simon for the Versaloon project. Another excellent side-effect is that you gain the ability to flash and debug from linux!
NOTE: there will be no way to reverse back to st-link if you complete all of the following steps
1. Obtain the Versaloon binaries for the stm32-discovery. You can find binaries (search for the most recent) attached to the thread or better you can build the binary from source.
2. I’ll be calling the stm32-discovery we’re updating to Versaloon the “target.” You’ll need to solder two very thin wires to the target device. I used wire-wrap wire for this. This is the most difficult step; if you make it past here, you’ll be fine.
You’re going to solder to the left-hand side of the SB6 and SB10 bridges shown above, but you’ll want to be sure not to actually connect both sides of the bridge. If you use too much solder, this may occur, and then you’ll probably need some solder wick to clean it up. I found the easiest thing to do was to put just the tiniest bit of solder on the end of the wire, position the wire, and then attach to the pad.
As you can see, I attached a red wire to the SB6 pad and a yellow wire to the SB10 pad. Nothing special, but hopefully it will help you to distinguish the two in this post.
3. I installed a 3 pin male header to the end of the two wires I just connected to the bottom of the board; this will make it easy to connect it to the host ST-Link.
4. Next I used F/F jumper wires to connect 5V/GND and SWD pins from the primary board to the target. In the next couple of images, the target board is on top, the primary board is on bottom.
Above are 3 of the 4 connections on the primary board. The jumper wires are connected on the primary board to the bottom 3 pins of the header labeled “SWD”. The red and yellow jumper wires are connected to the red and yellow wires recently connected to the “target” board. The black/center wire can be connected to any GND on the “target” board. I’m using the one at the top right of the board.
The 4th connection is from a 5V pin on the primary board connected a 5V pin on the target. In this picture the connection was made to the top-side of the board, but you’ll probably find it easier to connect to the bottom side.
5. Remove the jumpers from CN3 on the primary board.
6. Connect USB from a Windows PC to the USB port on the primary stm32-discovery board.
7. Run the ST-Link software. Choose Target->Connect. Then Target->Option Bytes and change Read Out Protection to Disabled.
8. Download the binary (.bin) you obtained in step 1 using Target -> Program & Verify.
9. Fix jumpers at CN3 on the target. You’ll either need to make a “special” jumper out of a 4-pin female header or just jumper the center and run a wire between the outside posts.
10. Test newly programmed Versaloon with vsprog and openocd!
NOTE: If you wish to use your newly converted versaloon stm32-discovery to program/debug a remote SWD target (like we used the “primary” stm32-discovery above), the SWD pins are now reversed. This is explained in the versaloon forum linked above.