ARM-USB-OCD and STM32F103-STK not communicating

I just recently bought an ARM-USB-OCD and STM32F103-STK, but I can’t get it to connect using crossworks. I’ve changed the clock speed to 1/50 and tried all the other options but nothing works. This happens with Crossworks 1.7 and 2.0.

If I use Eclipse from the Olimex CD it seems to connect if I use Run-External Tools-Open OCD for STM32 but I have no idea how to use it.

I have your same board and JTAG probe.

I can use OpenOCD both from Eclipse and with some standalone scripts.

If you want to use it from the command line create the following three files into the directory containing your binary file, also make sure that openocd-ftd2xx.exe is reachable in the system path:

Run.bat

@echo off
start /MIN openocd-ftd2xx.exe
start telnet 127.0.0.1 4444

openocd.cfg

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003
jtag_speed 5

#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst separate

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe
jtag_device 5 0x1 0x1 0x1e

#target configuration
daemon_startup reset

#target <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
#target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
target cortex_m3 little run_and_init 0
run_and_halt_time 0 30

#working_area 0 0x40000000 0x40000 nobackup
working_area 0 0x20000000 16384 nobackup

#flash configuration
#flash bank lpc2000 <base> <size> 0 0 <target#> <variant>
#flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v2 14765 calc_checksum
#flash bank cfi 0x80000000 0x400000 2 2 0
flash bank stm32x 0x08000000 0x00010000 0 0 0

# For more information about the configuration files, take a look at:
# http://openfacts.berlios.de/index-en.phtml?title=Open+On-Chip+Debugger

run (without extension)

soft_reset_halt
wait_halt
poll
flash probe 0
stm32x mass_erase 0
flash write_bank 0 ch.bin 0
soft_reset_halt
resume

In “run” replace ch.bin with your binary file name.

From a command prompt launch openocd.bat, it will launch both OpenOCD and a telnet shell.

From the telnet shell type “script run”, it will flash the board and start the program.

I hope this helps, note this is for OpenOCD version r717 that is quite old, some settings may change for more recent versions.

regards,

Giovanni

Thanks, that was exactly what I needed. I managed to get crossworks working as well, I had selected the wrong chip type when creating a new project.