custom M3 board, key tiny=> JTAG com failure. What is wrong?

Hi people,

first i would like to apologize for any rudeness or agressive looking post. I am french, and although i can write in English, i still have problems with the way it should be used :lol:

First a little intro. I am a software developer, and usually work on preconfigured toolchains. Most of the time i work on airplane embedded systems, but i happen to also work on standard stuff sometimes. The last time it happened, i worked on setting the str935 board linux bsp (forgive me if that was not a good work, i did not know anything about arm at this time :o )

the thing is that i liked it quite. And i also happen to have hobbies such as racing. I kind of needed some electronic gizzmos to monitor the car sensors and sound alarms (and also to remove the speed limiter), but this kind of components is really expensive (around 1K£ for a complete system with 10Hz GPS tracking) . So i thought “hey, let’s build one myself!”

So i searched for a convenient development board. Olimex one, with the prototype area caught my eyes, but i ended up buying something with hugely higher value for the money (or so i thought). Well, the board itself is nice and packed with features but … it comes with chinese docs. The only valuable things in there are some code snippets and the electric schemes.

anyway, for around 50£, i got an stm32f103RBT6 based board with a VGA tft touchscreen, usb, serial, spi, adc and MMC slot. Did i mention it was cheap ? And compact too. You can find it on ebay by looking for “stm32 2.8 tft” . I can paste the link here but i guess that for a first post, it would be considered as spam :mrgreen: if people want the link i will post it though. I found another guy who sells the same board, but with a J-link module, for 100$ too.

Now that you basically know what i want and can do, lets go to the facts.

I followed the instruction from stf12developer to install a developement system. Tried on linux (and failed), tried on windows XP and somewhat succeeded after numerous attemps.

I am now using eclipse (i always hated it, but hey, it works), code sourcery compilers and openOCD v0.10 (and v0.20) .

i installed the amontec key tiny using their drivers, and from what i have read around it might be the source of the problem, but anyway …

The thing is that i cant make the key work with openOCD. I tried both 0.10 and 0.20 version and i always end up with errors. here is the last error log (v0.20):

jtag_nsrst_delay: 100

jtag_ntrst_delay: 100

Info : device: 4

Info : deviceID: 67358712

Info : SerialNumber: T1SYDBDEA

Info : Description: Amontec JTAGkey A

Error: JTAG communication failure: check connection, JTAG interface, target power etc.

Error: trying to validate configured JTAG chain anyway…

Error: Could not validate JTAG scan chain, IR mismatch, scan returned 0x07FF. tap=stm32.cpu pos=0 expected 0x1 got 3

Warn : Could not validate JTAG chain, continuing anyway…

Warn : Invalid ACK in SWJDP transaction

Warn : Invalid ACK in SWJDP transaction

Warn : Invalid ACK in SWJDP transaction

Warn : Invalid ACK in SWJDP transaction

Warn : Block read error address 0xe000ed00, count 0x1

Warn : Invalid ACK in SWJDP transaction

1000 kHz

Warn : Invalid ACK in SWJDP transaction

Error: JTAG communication failure: check connection, JTAG interface, target power etc.

Error: trying to validate configured JTAG chain anyway…

Error: Could not validate JTAG scan chain, IR mismatch, scan returned 0x07FF. tap=stm32.cpu pos=0 expected 0x1 got 3

Warn : Could not validate JTAG chain, continuing anyway…

Warn : Invalid ACK in SWJDP transaction

Warn : Invalid ACK in SWJDP transaction

Warn : Invalid ACK in SWJDP transaction

Warn : Invalid ACK in SWJDP transaction

Error: can’t request a halt while in reset if nSRST pulls nTRST

Warn : Invalid ACK in SWJDP transaction

Runtime error, file “embedded:startup.tcl”, line 222:

expected return code but got ‘TARGET: stm32.cpu - Not halted’

Runtime error, file “stm32_gdb.cfg”, line 11:

i tried adapting the config files to my setup, but i cant see what is wrong with them. Or is something wrong with me ?

here is the command used : openocd.exe -f jtagkey.cfg -f stm32_mdBZ.cfg -fstm32_program_eclipse.cfg

here are my config files :

jtag_key.cfg

default ports

telnet_port 4444

gdb_port 3333

tcl_port 6666

interface configuration

interface ft2232

ft2232_device_desc “Amontec JTAGkey A”

ft2232_layout jtagkey

ft2232_vid_pid 0x0403 0xcff8

stm32_mdBZ.cfg

for stm32 medium density RevB and Z

set _CHIPNAME stm32

set _ENDIAN little

reset_config trst_and_srst srst_pulls_trst

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 29.6.3

set _CPUTAPID 0x3ba00477

}

jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID

if { [info exists BSTAPID ] } {

set _BSTAPID $BSTAPID

} else {

See STM Document RM0008

Section 29.6.2

Medium Density RevA

set _BSTAPID 0x06410041

Rev B and Rev Z

set _BSTAPID 0x16410041

My board is a Rev Z with strange TAPID

set _BSTAPID 0x06414041

}

jtag newtap $_CHIPNAME bs -irlen 5 -ircapture 0x1 -irmask 0x1 -expected-id $_BSTAPID

set _TARGETNAME [format “%s.cpu” $_CHIPNAME]

target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME

$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 16384 -work-area-backup 0

flash bank stm32x 0 0 0 0 0

For more information about the configuration files, take a look at:

openocd.texi

stm32_program_eclipse.cfg

default ports

telnet_port 4444

gdb_port 3333

tcl_port 6666

init

jtag_khz 1000

reset init

verify_ircapture disable

halt

wait halt

poll

stm32x mass_erase 0

flash write_image ./RTOSDemo/RTOSDemo.bin 0x8000000 bin

reset run

shutdown

can anyone see what is wrong here ? I am getting desperate, i started this a month ago and i still cant have jtag working :confused:

ok guys, i found the problem …

and the culprit was … the USB hub i was using !!! it now works.