AHBAP, SWJ-DP Sticky and Read Mem Error

Hi everyone,

I’m using the STM32-P103 board with Eclipse and oocd 0.2.0.

my problem is that I can’t use debugging.

I use this for OpenOCD:

gdb_port 3333

Work-area size (RAM size) = 20kB for STM32F103RB device

set _WORKAREASIZE 0x5000

interface ft2232

ft2232_device_desc “Olimex OpenOCD JTAG TINY A”

ft2232_layout “olimex-jtag”

ft2232_vid_pid 0x15BA 0x0003

script for stm32

if { [info exists CHIPNAME] } {

set _CHIPNAME $CHIPNAME

} else {

set _CHIPNAME stm32

}

if { [info exists ENDIAN] } {

set _ENDIAN $ENDIAN

} else {

set _ENDIAN little

}

JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz

#jtag_khz 1000

jtag_speed 3

#jtag_device 4 0x1 0xf 0xe

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 26.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 26.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 -ircapture 0x1 -irmask 0x1 -expected-id $_BSTAPID1 -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 -expected-id $_BSTAPID4 -expected-id $_BSTAPID5

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 $_WORKAREASIZE -work-area-backup 0

flash bank stm32x 0 0 0 0 0

init

reset halt

For GDB:

target remote localhost:3333

break main

I got following Errors:

Open On-Chip Debugger 0.2.0 (2009-10-13-15:06) Release

$URL: http://svn.berlios.de/svnroot/repos/ope … /openocd.c $

For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS

jtag_speed: 3

jtag_nsrst_delay: 100

jtag_ntrst_delay: 100

Info : device: 4

Info : deviceID: 364511236

Info : SerialNumber: FTS92Y5TA

Info : Description: Olimex OpenOCD JTAG TINY A

Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)

Info : JTAG Tap/device matched

Info : JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)

Info : JTAG Tap/device matched

Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)

Info : JTAG Tap/device matched

Info : JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)

Info : JTAG Tap/device matched

target state: halted

target halted due to debug-request, current mode: Thread

xPSR: 0x01000000 pc: 0x20000010

Info : accepting ‘gdb’ connection from 0

Warn : acknowledgment received, but no packet pending

Info : device id = 0x20036410

Info : flash size = 128kbytes

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000012, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x202d0dd4

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000012, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x202d0dd4

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

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f64f

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f650

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000012, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x202d0dd4

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000012, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x202d0dd4

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

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f64f

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f650

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f653

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f654

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f657

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f658

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f65b

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f65c

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f65f

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f660

Error: AHBAP Cached values: dp_select 0x0, ap_csw 0xa2000010, ap_tar 0xffffffff

Error: SWJ-DP STICKY ERROR

Error: Read MEM_AP_CSW 0x23000050, MEM_AP_TAR 0x5214f663

I tried a to reduce the JTAG speed but it didn’t worked out for me… I Have no Idea what else I should do…

So any help would be much appreciated!

First of all - upgrade to the most recent OpenOCD release (0.4.0). Then use the STANDARD (don’t modify them!) config files! In the end - if the above still fails - start thinking about another solution.

4/3!!

Today I updated to the new version of openOCD (0.4.0) and I used the unmodified cfg files.

But now it changed from SWI-DP to JTAG-DP and I do not have any AHBAP errors…

Error: JTAG-DP STICKY ERROR

Error: MEM_AP_CSW 0x23000052, MEM_AP_TAR 0xfffffffc

Error: JTAG-DP STICKY ERROR

Error: MEM_AP_CSW 0x23000052, MEM_AP_TAR 0xfffffffc

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

Error: JTAG-DP STICKY ERROR

Error: MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x202d0d94

Error: JTAG-DP STICKY ERROR

Error: MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x202d0d94

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

Is nobody out there who got the same problems and solved them? Any suggestions what it might be?

Any help is much appreciated.

I presume you are using the olimex_stm32_h103.cfg cfg file?

Reduce the jtag clock speed, eg. adapter_khz 500 (in stm32.cfg)

if you still get problems provide a full debug log, eg. openocd -d 3 -l openocd.log

Cheers

Spen

I tried to reduce the JTAG Speed to 500kHz but it didn’t help… so there is something I found in the log file:

Error: 999 13781 core.c:193 get_flash_bank_by_addr(): No flash at address 0x08020000

Error: 3400 39766 arm_adi_v5.c:380 jtagdp_transaction_endcheck(): MEM_AP_CSW 0x23000052, MEM_AP_TAR 0xfffffffc

Debug: 3401 39781 arm_adi_v5.c:335 jtagdp_transaction_endcheck(): jtag-dp: CTRL/STAT error, 0xf0000021

Error: 3402 39781 arm_adi_v5.c:361 jtagdp_transaction_endcheck(): JTAG-DP STICKY ERROR

Debug: 3403 39781 arm_adi_v5.c:373 jtagdp_transaction_endcheck(): jtag-dp: CTRL/STAT 0xf0000001

Error: 3404 39781 arm_adi_v5.c:380 jtagdp_transaction_endcheck(): MEM_AP_CSW 0x23000052, MEM_AP_TAR 0xfffffffc

Warn : 3405 39781 arm_adi_v5.c:989 mem_ap_read_buf_u32(): Block read error address 0xfffffff8, count 0x1

I would really appreciate any help…

Good day,

I hope this solution is relevant to your problem. Please post a reply if you’ve managed to

solve your problem.

I’m running OpenOCD GIT (2011/03/03 commit 0123985abc88876ca8ecd03e9a5462cc8e911693)

and found errors on the OpenOCD console while busy debugging:

Error: JTAG-DP STICKY ERROR

Error: MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x33333338

Error: JTAG-DP STICKY ERROR

Error: MEM_AP_CSW 0x23000052, MEM_AP_TAR 0x33333338

Warn : Block read error address 0x33333334

Error: JTAG-DP STICKY ERROR

Error: MEM_AP_CSW 0x23000050, MEM_AP_TAR 0xfd243d76

My setup is an Amonte UsbTiny connected to a STM32 (ST Cortex M3)

I found that these problems went away when I’ve increased the JTAG speed from 1000kHz to 3000kHz in

/opt/openocd_git/share/openocd/scripts/target/stm32.cfg

Line 24: adapter_khz 3000

Regards,

Frikkie Thirion

Had the same problem with an STM32F107 on the Olimex Board. The 3Mhz fixed it 8)