SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
User avatar
By ntfreak
#42378
Try the following to recover - as a last resort.
Normally you should not get this problem with the str9, we have quite e few people using the comstick.

# config script
flash bank str9xpec 0x00000000 0x00080000 0 0 0

# then try unlock
str9xpec enable_turbo 0
str9xpec unlock 0

then cycle board power.

Are you sure you have killed it, post the openocd log - openocd -d3
you could even try a lock/unlock sequence.

Cheers
Spen
By plavko61
#48111
@ntfreak

I use openocd-r520-20080322 and olimex ARM-USB-OCD

When i try lock i get:
Debug: 96 91189 command.c:375 command_run_line(): str9xpec enable_turbo 0
Debug: 97 106892 command.c:375 command_run_line(): str9xpec lock 0
Debug: 98 106892 str9xpec.c:180 str9xpec_isc_status(): status: 0x2e
Debug: 99 106892 str9xpec.c:209 str9xpec_isc_enable(): ISC_MODE Enabled

and there OpenOCD hangs but str912 is locked.

When i try unlock i get:
Debug: 2764 38998 str9xpec.c:180 str9xpec_isc_status(): status: 0x2a
Debug: 2765 38998 str9xpec.c:180 str9xpec_isc_status(): status: 0x2a
Debug: 2766 39013 str9xpec.c:180 str9xpec_isc_status(): status: 0x2a
...

and there OpenOCD hangs repeating ..., and str912 is still locked.

Maybe you can tell me what is wrong or is there another way to full erase the str9
By plavko61
#49490
I have tested the openocd-r657 and i succeeded to erase the STR9 from telnet.

If i try to run unlock from auto load "target script" i get :
User: target.c:435 target_process_reset(): Timed out waiting for halt after reset

and the script don't execute.

Can someone confirm this?
User avatar
By ntfreak
#49550
There has been a few changes with the reset handling, depending on what jtag interface you are using, try the latest from svn.

could you post the full log?

Cheers
Spen
By plavko61
#49589
DebugLog:
Debug: 4 0 command.c:425 command_run_line(): script openocd_confUNLOCK.cfg
Debug: 5 0 configuration.c:87 open_file_from_path(): opened openocd_confUNLOCK.cfg
Debug: 6 0 command.c:425 command_run_line(): telnet_port 4444
Debug: 7 0 command.c:425 command_run_line(): gdb_port 3333
Debug: 8 0 command.c:425 command_run_line(): gdb_memory_map enable
Debug: 9 0 command.c:425 command_run_line(): gdb_flash_program enable
Debug: 10 0 command.c:425 command_run_line(): interface ft2232
Debug: 11 0 command.c:425 command_run_line(): ft2232_device_desc "Olimex OpenOCD JTAG A"
Debug: 12 0 command.c:425 command_run_line(): ft2232_layout "olimex-jtag"
Debug: 13 0 command.c:425 command_run_line(): ft2232_vid_pid 0x15BA 0x0003
Debug: 14 0 command.c:425 command_run_line(): jtag_speed 1
Debug: 15 0 jtag.c:1850 handle_jtag_speed_command(): handle jtag speed
Info: 16 0 options.c:50 configuration_output_handler(): jtag_speed: 1, 1
Debug: 17 0 command.c:425 command_run_line(): jtag_nsrst_delay 100
Debug: 18 0 command.c:425 command_run_line(): jtag_ntrst_delay 100
Debug: 19 0 command.c:425 command_run_line(): reset_config trst_and_srst
Debug: 20 0 command.c:425 command_run_line(): jtag_device 8 0x1 0x1 0xfe
Debug: 21 0 command.c:425 command_run_line(): jtag_device 4 0x1 0xf 0xe
Debug: 22 0 command.c:425 command_run_line(): jtag_device 5 0x1 0x1 0x1e
Debug: 23 0 command.c:425 command_run_line(): daemon_startup reset
Info: 24 0 options.c:50 configuration_output_handler(): Open On-Chip Debugger (2008-05-16 20:15) svn: 657
Debug: 25 0 command.c:425 command_run_line(): target arm966e little run_and_init 1 arm966e
Debug: 26 0 arm966e.c:141 arm966e_target_command(): chain_pos: 1, variant: arm966e
Debug: 27 0 command.c:425 command_run_line(): run_and_halt_time 0 30
Debug: 28 0 command.c:425 command_run_line(): target_script 0 reset confUNLOCK.script
Debug: 29 0 command.c:425 command_run_line(): working_area 0 0x50000000 16384 nobackup
Debug: 30 0 command.c:425 command_run_line(): flash bank str9xpec 0x00000000 0x00080000 0 0 0
Debug: 31 0 command.c:425 command_run_line(): init
Debug: 32 0 openocd.c:102 handle_init_command(): target init complete
Debug: 33 0 ft2232.c:1368 ft2232_init_ftd2xx(): 'ft2232' interface using FTD2XX with 'olimex-jtag' layout (15ba:0003)
Debug: 34 32 ft2232.c:1457 ft2232_init_ftd2xx(): current latency timer: 2
Debug: 35 32 ft2232.c:1804 olimex_jtag_init(): 80 08 1b
Debug: 36 32 ft2232.c:1847 olimex_jtag_init(): 82 09 0f
Debug: 37 32 ft2232.c:253 ft2232_speed(): 86 01 00
Debug: 38 47 openocd.c:109 handle_init_command(): jtag interface init complete
Debug: 39 47 jtag.c:1524 jtag_init_inner(): Init JTAG chain
Debug: 40 47 jtag.c:319 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 41 47 jtag.c:1282 jtag_reset_callback(): -
Debug: 42 47 jtag.c:1282 jtag_reset_callback(): -
Debug: 43 47 jtag.c:1282 jtag_reset_callback(): -
Debug: 44 47 jtag.c:319 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 45 47 jtag.c:1282 jtag_reset_callback(): -
Debug: 46 47 jtag.c:1282 jtag_reset_callback(): -
Debug: 47 47 jtag.c:1282 jtag_reset_callback(): -
Info: 48 47 jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x04570041 (Manufacturer: 0x020, Part: 0x4570, Version: 0x0)
Info: 49 47 jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x25966041 (Manufacturer: 0x020, Part: 0x5966, Version: 0x2)
Info: 50 47 jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x2457f041 (Manufacturer: 0x020, Part: 0x457f, Version: 0x2)
Debug: 51 47 jtag.c:319 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 52 47 jtag.c:1282 jtag_reset_callback(): -
Debug: 53 47 jtag.c:1282 jtag_reset_callback(): -
Debug: 54 47 jtag.c:1282 jtag_reset_callback(): -
Debug: 55 47 openocd.c:116 handle_init_command(): jtag init complete
Debug: 56 47 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000000
Debug: 57 63 openocd.c:119 handle_init_command(): jtag examine complete
Debug: 58 63 openocd.c:126 handle_init_command(): flash init complete
Debug: 59 63 openocd.c:130 handle_init_command(): NAND init complete
Debug: 60 63 openocd.c:134 handle_init_command(): pld init complete
Debug: 61 63 gdb_server.c:2036 gdb_init(): gdb service for target arm966e at port 3333
Debug: 62 63 command.c:425 command_run_line(): reset
Debug: 63 63 target.c:1830 handle_reset_command(): -
Debug: 64 63 ft2232.c:253 ft2232_speed(): 86 01 00
Debug: 65 63 jtag.c:1568 jtag_init_reset(): Trying to bring the JTAG controller to life by asserting TRST / tms
Debug: 66 63 jtag.c:989 jtag_add_reset(): SRST line released
Debug: 67 63 jtag.c:1008 jtag_add_reset(): TRST line asserted
Debug: 68 63 jtag.c:319 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 69 63 jtag.c:1282 jtag_reset_callback(): -
Debug: 70 63 jtag.c:1282 jtag_reset_callback(): -
Debug: 71 63 jtag.c:1282 jtag_reset_callback(): -
Debug: 72 63 jtag.c:985 jtag_add_reset(): SRST line asserted
Debug: 73 63 jtag.c:1008 jtag_add_reset(): TRST line asserted
Debug: 74 63 jtag.c:319 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 75 63 jtag.c:1282 jtag_reset_callback(): -
Debug: 76 63 jtag.c:1282 jtag_reset_callback(): -
Debug: 77 63 jtag.c:1282 jtag_reset_callback(): -
Debug: 78 63 jtag.c:985 jtag_add_reset(): SRST line asserted
Debug: 79 63 jtag.c:989 jtag_add_reset(): SRST line released
Debug: 80 63 ft2232.c:1031 olimex_jtag_reset(): trst: 1, srst: 0, high_output: 0x08, high_direction: 0x0f
Debug: 81 172 ft2232.c:1031 olimex_jtag_reset(): trst: 1, srst: 1, high_output: 0x0a, high_direction: 0x0f
Debug: 82 172 ft2232.c:1031 olimex_jtag_reset(): trst: 0, srst: 1, high_output: 0x0b, high_direction: 0x0f
Debug: 83 266 ft2232.c:1031 olimex_jtag_reset(): trst: 0, srst: 0, high_output: 0x09, high_direction: 0x0f
Debug: 84 469 jtag.c:1524 jtag_init_inner(): Init JTAG chain
Debug: 85 469 jtag.c:319 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 86 469 jtag.c:1282 jtag_reset_callback(): -
Debug: 87 469 jtag.c:1282 jtag_reset_callback(): -
Debug: 88 469 jtag.c:1282 jtag_reset_callback(): -
Info: 89 469 jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x04570041 (Manufacturer: 0x020, Part: 0x4570, Version: 0x0)
Info: 90 469 jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x25966041 (Manufacturer: 0x020, Part: 0x5966, Version: 0x2)
Info: 91 469 jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x2457f041 (Manufacturer: 0x020, Part: 0x457f, Version: 0x2)
Debug: 92 469 jtag.c:319 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 93 469 jtag.c:1282 jtag_reset_callback(): -
Debug: 94 469 jtag.c:1282 jtag_reset_callback(): -
Debug: 95 469 jtag.c:1282 jtag_reset_callback(): -
Debug: 96 485 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000000
Debug: 97 485 arm7_9_common.c:736 arm7_9_assert_reset(): target->state: unknown
Debug: 98 485 jtag.c:985 jtag_add_reset(): SRST line asserted
Debug: 99 485 ft2232.c:1031 olimex_jtag_reset(): trst: 0, srst: 1, high_output: 0x03, high_direction: 0x0f
Debug: 100 625 arm7_9_common.c:789 arm7_9_deassert_reset(): target->state: reset
Debug: 101 625 jtag.c:989 jtag_add_reset(): SRST line released
Debug: 102 625 ft2232.c:1031 olimex_jtag_reset(): trst: 0, srst: 0, high_output: 0x01, high_direction: 0x0f
Debug: 103 828 target.c:410 target_process_reset(): Waiting for halted stated as approperiate
Debug: 104 828 arm7_9_common.c:926 arm7_9_halt(): target->state: running
Debug: 105 828 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000002
Debug: 106 828 target.c:424 target_process_reset(): Polling target
Debug: 108 1328 target.c:424 target_process_reset(): Polling target
Debug: 110 1844 target.c:424 target_process_reset(): Polling target
Debug: 112 2344 target.c:424 target_process_reset(): Polling target
Debug: 114 2844 target.c:424 target_process_reset(): Polling target
Debug: 116 3360 target.c:424 target_process_reset(): Polling target
Debug: 118 3860 target.c:424 target_process_reset(): Polling target
Debug: 120 4360 target.c:424 target_process_reset(): Polling target
Debug: 122 4860 target.c:424 target_process_reset(): Polling target
Debug: 124 5360 target.c:424 target_process_reset(): Polling target
Debug: 126 5860 target.c:424 target_process_reset(): Polling target
User: 127 5875 target.c:435 target_process_reset(): Timed out waiting for halt after reset
Debug: 128 5875 ft2232.c:253 ft2232_speed(): 86 01 00
as you see my script don't get executed:
My script:
str9xpec options_read 0
str9xpec unlock 0
shutdown
User avatar
By ntfreak
#49591
log looks ok.
what hardware are you running on - clock speed etc.

could try slowing the jtag speed down to say 10.
Are you certain the board implements srst and trst?

Cheers
Spen
User avatar
By ntfreak
#49596
yes but what hardware?

Cheers
Spen
By plavko61
#49603
I have a custom made HW, sorting like STR91X-SK from ST.
User avatar
By ntfreak
#49605
have you validated the hardware on other software?

also how are you running openocd?
from your log the first line is:
script openocd_confUNLOCK.cfg

Cheers
Spen
By plavko61
#49607
I have tested the HW with jlink and it works perfectly.

I am running this script:
#daemon configuration
telnet_port 4444
gdb_port 3333

# tell gdb our flash memory map
# and enable flash programming
gdb_memory_map enable
gdb_flash_program enable

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

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
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 8 0x1 0x1 0xfe
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 arm966e little reset_halt 1 arm966e
target arm966e little run_and_init 1 arm966e
#target arm966e little reset_init 1 arm966e

run_and_halt_time 0 30

target_script 0 reset confUNLOCK.script


working_area 0 0x50000000 16384 nobackup

#flash bank str7x <base> <size> 0 0 <target#> <variant>

flash bank str9xpec 0x00000000 0x00080000 0 0 0

#flash bank str9x 0x00000000 0x00008000 0 0 0
#flash bank str9x 0x00080000 0x00080000 0 0 0

# For more information about the configuration files, take a look at:
# http://openfacts.berlios.de/index-en.ph ... p+Debugger
User avatar
By ntfreak
#49610
The first line of your log is:
Debug: 4 0 command.c:425 command_run_line(): script openocd_confUNLOCK.cfg

This does not make sense, also it does not match your posted config.
How are you invoking openocd?

Sorry i can be of no more help.

Cheers
Spen
By plavko61
#49655
openocd_confUNLOCK.cfg is my config

confUNLOCK.script is my reset script

I start openocd from windows Command promt:
openocd-ftd2xx.exe -foopenocd_confUNLOCK.cfg

I think that openocd has problems with locked str9 handling, because str9 responses
only to unlock command when it it locked. Openocd probably try execute some other commands.

When locking the str9 openocd also hangs after executing the lock command, because str9
don't response to other commands any more but openodc probably try to stay attached.
User avatar
By ntfreak
#49684
you never mentioned that the device was locked.
The makes a big difference, for a start the reset script will never get executed because openocd cannot get control of the cpu.

basically run openocd, it will time out while waiting to halt - this is normal.
at a telnet prompt type:
str9xpec enable_turbo 0
str9xpec unlock 0

the core will then be unlocked/erased.

Cheers
Spen
By plavko61
#49719
I left out str9xpec enable_turbo 0 because if i unlock from telnet it goes without it. I get the same log with and without enable_turbo when execut my cfg-script.