Ok, I made the cable. I am using an Olimex ARM USB TINY:
http://www.olimex.com/dev/arm-usb-tiny.html
I'm on Ubuntu Linux 10.04. I got the OpenOCD software working - had to install version 0.4.0 from source, and use the Open Source libftdi. My configure line for OpenOCD looks like this:
./configure --enable-ft2232_libftdi --enable-usbprog
After installing a udev rules file like this:
SYSFS{idProduct}=="0004", SYSFS{idVendor}=="15ba", MODE="666", GROUP="plugdev", SYMLINK+="ft2232"
I am able to see the device via lsusb:
Bus 002 Device 033: ID 1eaf:0004
Bus 002 Device 023: ID 15ba:0004 Olimex Ltd. OpenOCD JTAG TINY
OpenOCD recognizes the board, but when I run make jtag debug
using the main.cpp copied from the examples/blinky.cpp, I get the following error:
adamf@clay:~/src/libmaple$ make jtag debug
================================================================================
Build info:
BOARD: maple
MCU: STM32F103RB
MEMORY_TARGET: jtag
See 'make help' for all possible targets
================================================================================
openocd -f support/openocd/run.cfg
Open On-Chip Debugger 0.4.0 (2010-11-28-20:19)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.berlios.de/doc/doxygen/bugs.html
1000 kHz
jtag_nsrst_delay: 100
jtag_ntrst_delay: 100
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
Info : clock speed 1000 kHz
Info : JTAG tap: stm32.cpu tap/device found: 0x01b00037 (mfg: 0x01b, part: 0x1b00, ver: 0x0)
Warn : JTAG tap: stm32.cpu UNEXPECTED: 0x01b00037 (mfg: 0x01b, part: 0x1b00, ver: 0x0)
Error: JTAG tap: stm32.cpu expected 1 of 1: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : TAP stm32.bs does not have IDCODE
Warn : JTAG tap: stm32.bs UNEXPECTED: 0x00000000 (mfg: 0x000, part: 0x0000, ver: 0x0)
Error: JTAG tap: stm32.bs expected 1 of 5: 0x06412041 (mfg: 0x020, part: 0x6412, ver: 0x0)
Error: JTAG tap: stm32.bs expected 2 of 5: 0x06410041 (mfg: 0x020, part: 0x6410, ver: 0x0)
Error: JTAG tap: stm32.bs expected 3 of 5: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)
Error: JTAG tap: stm32.bs expected 4 of 5: 0x06414041 (mfg: 0x020, part: 0x6414, ver: 0x0)
Error: JTAG tap: stm32.bs expected 5 of 5: 0x06418041 (mfg: 0x020, part: 0x6418, ver: 0x0)
Warn : Unexpected idcode after end of chain: 33 0x0ff08000
Warn : Unexpected idcode after end of chain: 65 0xfc000000
Warn : Unexpected idcode after end of chain: 97 0xc0000001
Warn : Unexpected idcode after end of chain: 129 0xc000001f
Warn : Unexpected idcode after end of chain: 161 0xc000001f
Warn : Unexpected idcode after end of chain: 193 0xc000001f
Warn : Unexpected idcode after end of chain: 225 0xc000001f
Warn : Unexpected idcode after end of chain: 257 0xc000001f
Warn : Unexpected idcode after end of chain: 289 0xc000001f
Warn : Unexpected idcode after end of chain: 321 0xc000001f
Warn : Unexpected idcode after end of chain: 353 0xc000001f
Warn : Unexpected idcode after end of chain: 385 0xc000001f
Warn : Unexpected idcode after end of chain: 417 0xc000001f
Warn : Unexpected idcode after end of chain: 449 0xc000001f
Warn : Unexpected idcode after end of chain: 481 0xc000001f
Warn : Unexpected idcode after end of chain: 513 0xc000001f
Warn : Unexpected idcode after end of chain: 545 0xc000001f
Warn : Unexpected idcode after end of chain: 577 0xc000001f
Error: double-check your JTAG setup (interface, speed, missing TAPs, ...)
Info : JTAG tap: stm32.cpu tap/device found: 0x01b00037 (mfg: 0x01b, part: 0x1b00, ver: 0x0)
Warn : JTAG tap: stm32.cpu UNEXPECTED: 0x01b00037 (mfg: 0x01b, part: 0x1b00, ver: 0x0)
Error: JTAG tap: stm32.cpu expected 1 of 1: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : TAP stm32.bs does not have IDCODE
Warn : JTAG tap: stm32.bs UNEXPECTED: 0x00000000 (mfg: 0x000, part: 0x0000, ver: 0x0)
Error: JTAG tap: stm32.bs expected 1 of 5: 0x06412041 (mfg: 0x020, part: 0x6412, ver: 0x0)
Error: JTAG tap: stm32.bs expected 2 of 5: 0x06410041 (mfg: 0x020, part: 0x6410, ver: 0x0)
Error: JTAG tap: stm32.bs expected 3 of 5: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)
Error: JTAG tap: stm32.bs expected 4 of 5: 0x06414041 (mfg: 0x020, part: 0x6414, ver: 0x0)
Error: JTAG tap: stm32.bs expected 5 of 5: 0x06418041 (mfg: 0x020, part: 0x6418, ver: 0x0)
Warn : Unexpected idcode after end of chain: 33 0x0ff08000
Warn : Unexpected idcode after end of chain: 65 0xfc000000
Warn : Unexpected idcode after end of chain: 97 0xc0000001
Warn : Unexpected idcode after end of chain: 129 0xc000001f
Warn : Unexpected idcode after end of chain: 161 0xc000001f
Warn : Unexpected idcode after end of chain: 193 0xc000001f
Warn : Unexpected idcode after end of chain: 225 0xc000001f
Warn : Unexpected idcode after end of chain: 257 0xc000001f
Warn : Unexpected idcode after end of chain: 289 0xc000001f
Warn : Unexpected idcode after end of chain: 321 0xc000001f
Warn : Unexpected idcode after end of chain: 353 0xc000001f
Warn : Unexpected idcode after end of chain: 385 0xc000001f
Warn : Unexpected idcode after end of chain: 417 0xc000001f
Warn : Unexpected idcode after end of chain: 449 0xc000001f
Warn : Unexpected idcode after end of chain: 481 0xc000001f
Warn : Unexpected idcode after end of chain: 513 0xc000001f
Warn : Unexpected idcode after end of chain: 545 0xc000001f
Warn : Unexpected idcode after end of chain: 577 0xc000001f
Error: double-check your JTAG setup (interface, speed, missing TAPs, ...)
Command handler execution failed
Warn : jtag initialization failed; try 'jtag init' again.
Info : JTAG tap: stm32.cpu tap/device found: 0x01b00037 (mfg: 0x01b, part: 0x1b00, ver: 0x0)
Warn : JTAG tap: stm32.cpu UNEXPECTED: 0x01b00037 (mfg: 0x01b, part: 0x1b00, ver: 0x0)
Error: JTAG tap: stm32.cpu expected 1 of 1: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : TAP stm32.bs does not have IDCODE
Warn : JTAG tap: stm32.bs UNEXPECTED: 0x00000000 (mfg: 0x000, part: 0x0000, ver: 0x0)
Error: JTAG tap: stm32.bs expected 1 of 5: 0x06412041 (mfg: 0x020, part: 0x6412, ver: 0x0)
Error: JTAG tap: stm32.bs expected 2 of 5: 0x06410041 (mfg: 0x020, part: 0x6410, ver: 0x0)
Error: JTAG tap: stm32.bs expected 3 of 5: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)
Error: JTAG tap: stm32.bs expected 4 of 5: 0x06414041 (mfg: 0x020, part: 0x6414, ver: 0x0)
Error: JTAG tap: stm32.bs expected 5 of 5: 0x06418041 (mfg: 0x020, part: 0x6418, ver: 0x0)
Warn : Unexpected idcode after end of chain: 33 0x0ff08000
Warn : Unexpected idcode after end of chain: 65 0xfc000000
Warn : Unexpected idcode after end of chain: 97 0xc0000001
Warn : Unexpected idcode after end of chain: 129 0xc000001f
Warn : Unexpected idcode after end of chain: 161 0xc000001f
Warn : Unexpected idcode after end of chain: 193 0xc000001f
Warn : Unexpected idcode after end of chain: 225 0xc000001f
Warn : Unexpected idcode after end of chain: 257 0xc000001f
Warn : Unexpected idcode after end of chain: 289 0xc000001f
Warn : Unexpected idcode after end of chain: 321 0xc000001f
Warn : Unexpected idcode after end of chain: 353 0xc000001f
Warn : Unexpected idcode after end of chain: 385 0xc000001f
Warn : Unexpected idcode after end of chain: 417 0xc000001f
Warn : Unexpected idcode after end of chain: 449 0xc000001f
Warn : Unexpected idcode after end of chain: 481 0xc000001f
Warn : Unexpected idcode after end of chain: 513 0xc000001f
Warn : Unexpected idcode after end of chain: 545 0xc000001f
Warn : Unexpected idcode after end of chain: 577 0xc000001f
Error: double-check your JTAG setup (interface, speed, missing TAPs, ...)
error: -100
Command handler execution failed
make: *** [debug] Error 1
So it seems like there's something wrong with the JTAG communication. My run.cfg file looks like this:
# script for stm32
#interface ft2232
#ft2232_device_desc "Olimex OpenOCD JTAG"
#ft2232_layout olimex-jtag
#ft2232_vid_pid 0x15ba 0x0003
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG TINY"
ft2232_layout olimex-jtag
ft2232_vid_pid 0x15ba 0x0004
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME stm32
}
if { [info exists ENDIAN] } {
set _ENDIAN $ENDIAN
} else {
set _ENDIAN little
}
# jtag speed speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so ufse F_JTAG = 1MHz
jtag_khz 1000
jtag_nsrst_delay 100
jtag_ntrst_delay 100
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst
#jtag scan chain
if { [info exists CPUTAPID ] } {
set _CPUTAPID $CPUTAPID
} else {
# See STM Document RM0008
# Section 30.6.3
set _CPUTAPID 0x3ba00477
}
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
if { [info exists BSTAPID ] } {
# FIXME this never gets used to override defaults...
set _BSTAPID $BSTAPID
} else {
# See STM Document RM0008
# Section 29.6.2
# Low density devices, Rev A
set _BSTAPID1 0x06412041
# Medium density devices, Rev A
set _BSTAPID2 0x06410041
# Medium density devices, Rev B and Rev Z
set _BSTAPID3 0x16410041
# High density devices, Rev A
set _BSTAPID4 0x06414041
# Connectivity line devices, Rev A and Rev Z
set _BSTAPID5 0x06418041
}
jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
-expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
-expected-id $_BSTAPID4 -expected-id $_BSTAPID5
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 0x5000 -work-area-backup 0
#flash bank stm32x 0x08000000 0x00020000 0 0 $_TARGETNAME
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME stm32x 0x08000000 0x00020000 0 0 $_TARGETNAME
proc nopforever {} {
puts "Resetting the chip..."
reset run
}
init
nopforever
(Similar to structuresound's cfg file from http://forums.leaflabs.com/topic.php?id=532)
Anybody have any ideas what's wrong? Why can't I communicate with the Maple via JTAG?