Use your STMxx-Discoveryboard as JTAG

9 posts / 0 new
Last post
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Guyzz

I finally have succeded in adapting Versaloon to run SWD programming , on the embedded ARM Jtag on the STM8S-Discovery or STM32VL-Discovery boards.

Tested on Versaloon SVN rev 669 , also for vsprog

http://www.versaloon.com/bbs/viewtopic.php?f=2&t=17

For now i can only get vsprog to work , but Simon is working on adapting the OpenOCD driver to the new USB_TO_XXX scheme used in the latest versaloon versions. http://www.versaloon.com/bbs/viewtopic.php?p=43#p43

I have reported my problems with OOCD , and given some hints & output here.
http://www.versaloon.com/bbs/viewtopic.php?p=50#p50

Quote:

Remember this WILL erase the onboard ST-Link software , and afaik there is no way to restore it.
But if you are using Linux/*nix , the ST-Link software isn't supported anyways

On the STM8S board i have used the SWIM_IN and SWIM_RST_IN pins , as they are protected by 220 ohm resistors.
I was a bit worried about the 680ohm pullup on SWIM , but it doesnt seem to give any problems.
The SWIM & SWIM_RST pins are set to INPUT-Floating.

Quote:

SWD pins on the STM8S CN7 plug are like this :

1: VDD (Unused)
2: SWDIO/T_JTMS
3: GND
4: SWCLK/T_JTCK
Remember to connect GND to the target , and you can even "steal" 3v3 for the target , from pin-1 on the JTAG.

On the STM32VL board i have reversed the "Original" ST-Link pins used for SWD.
This is due to the way Versaloon operates SWDIO/T_JTMS , where i suppose Simon used on pin as permanently input for speed reasons.
And as the build-in JTAG used 2 pins for T_JTCK , it made sense to use those for T_JTMS.

So the pinout is like this (Reversed from whats shown in the schematic) , and DONT connect the jumpers on CN3 according to the manual.

Quote:

STANDALONE Programmer
----------------------
When jumpers/wires are removed from CN3 , in order to use the JTAG as a standalone unit.
The pinout on CN2 is like this :

1: GND via 10K ??? (Unused)
2: SWDIO/T_JTMS
3: GND
4: SWCLK/T_JTCK

Quote:

ONBOARD Programmer
----------------------
When using the onboard JTAG to program the onboard target chip (the value-line chip) , you can't place the two CN3 jumpers as the manual says.
The CN3 Pins are like this :

1: T_JTMS (From onboard JTAG , differs from schematic)
2: SWCLK (To Onboard value-line chip)
3: T_JTCK (From onboard JTAG , differs from schematic)
4: SWDIO (To Onboard value-line chip)

What i did was connect a jumper on Pin 2-3 , and a short Test-wire on pin 1-4

Quote:

Modifying the STM8S

HW:
-----
Just solder a standard 0.1" pinheader in the 7 empty holes below the usb connector.
I used a 2x4 block where i pulled out one pin (pin1)

Connect an ARM Jtag to the soldered plug , and "Unlock/Program" it.
I used a signalyzer-lite and OpenOCD (from SVN ... Well actually Simons script) from here http://www.versaloon.com/bbs/viewtopic.php?p=43#p43

I just modified openocd_update , and added --enable-ft2232_libftdi to the "./configure" around line 80 , so i had support for both hw dongles.

  ./configure --enable-vsllink --enable-ft2232_libftdi --enable-maintainer-mode

You will need "libftdi devel" installed on your distro (>= 1.17 is needed for FT2232H)
http://www.intra2net.com/en/developer/libftdi/
On Ubuntu just use Synaptic , and you'll get >= 1.17

SW:
-----
1: Start OOCD
sudo openocd -f interface/signalyzer-lite.cfg -f target/stm32.cfg

2:
telnet localhost 4444

3 (Once) : stm32x unlock 0

4:
reset halt
flash probe 0
stm32x mass_erase 0

flash write_bank 0 Versaloon_GCC.bin 0

reset run

disconnect & connect the USB cable on the STM8S
You are done :-)

Quote:

Modifying the STM32VL

This was a bit more difficult (programming) , as the JTAG pins weren't connected to any headers.
But there was access to SWD on the backside of the PCB. Via some Solderbridges (SB)
SB6 is STM_JTCK (SWCLK)
SB10 is STM_JTMS (SWDIO)
So i soldered some thin wires on the part of the solderbridge that was closest to the pinheaders.

At first i had hoped to use my newly build STM8S SWD progger to program the JTAG chip on the STM32 , but no matter what i did i couldb't get
vsprog to do it. vsprog reckognized the chip , but couldn't read/write it. I found out the chip was locked/protected , and as the "OOCD" i build above , using Simons script. Still have some problems with the vsllink hardware , i gave up on that.

I booted into windows , and used a "Genuine ST-Link" to unprotect & flash the JTAG chip.
Now ... I actually wonder if another STM32VL would have worked instead of a "Genuine ST-Link"

When i booted back into Linux the onboard JTAG worked fine , and i now could program the value-line chip on the board from the onboard JTAG.

Quote:

Note !!!
For both the above solutions , there is another option :
Use the buildin serial bootloader (if you can solder wires on a chip w. 0.5mm spacing)
Serial-Loader program : http://code.google.com/p/stm32flash/
http://gostm32.blogspot.com/2010/09/better-program-for-bootloader.html

Try it out if you like

I'll upload the changes to Simon (Versaloon) as soon as the OOCD problems are fixed

/Bingo.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yess

OpenOCD works now

http://www.versaloon.com/bbs/viewtopic.php?p=63#p63

Ans source uploaded in the above thread

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The discovery(s) firmware , made Versaloon SVN trunk (rev 688+)

svn checkout http://vsprog.googlecode.com/svn/trunk/

And a buildscript for a working OpenOCD (the trunk is quite unstable atm.)
http://www.versaloon.com/bbs/viewtopic.php?p=74#p74

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Goodnight mr. Bingo600, I have a little STM32 discovery board, and after much reading I have just assembled a toolchain using CodeSourcery as its base, reading this tutorial:
http://fun-tech.se/stm32/index.php

I am now asking you if there is a tool similar to ST-Link to upload code to the STM32 discovery board, I think that the solution that you posted here will do that, but I dont really want to get the soldering iron near my board, because I know that I will break it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

keepcool wrote:

I am now asking you if there is a tool similar to ST-Link to upload code to the STM32 discovery board, I think that the solution that you posted here will do that, but I dont really want to get the soldering iron near my board, because I know that I will break it.

There is no way to load the Versaloon firmware into the STM32VL ST-Link part , without using the SB6 & SB10 solderpads.

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just fixed a serious reset problem on the STM32VL-Discovery board , when using OOCD

Get the new firmware

http://www.versaloon.com/bbs/viewtopic.php?f=2&t=17

Edit: Tim made a nice explanation on how to use one STM32VL to convert another to Versaloon
http://takenapart.com/?p=82

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just got the $8 Versaloon dongle to program & debug a LPCXpresso-1768 , via SWD. (hint..hint Leon) :-)

I'm using Codesourcery , NXP's CMSIS & OpenOCD...

All is fully opensource

It's quite easy to remove the solderbridges that connects the "Unusable/Locked NXP CodeRed debugger" to the MCU board.

Then either cut the boards , or just solder in a dual-row pinheader.

/Bingo

..
..
..

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Unusable/Locked NXP CodeRed debugger

True, the debugging dongle is locked (up to 128kB, only LPC-s, and AFAIK only Code Red (win+linux) environment).
Alongside with LPC1768/9 (and you know what I mean) I cannot imagine a better starter kit for the price of 25$.

However your cracked STM32 SWD dongle looks interesting as well.

No RSTDISBL, no fun!