OpenOCD, STR9, Flash erase problem, status 0xa2

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

I am running a str912faw44 rev.G with srst and trst implemented as page 28 of Datasheet.

http://www.st.com/stonline/products/lit … /13495.pdf

Speed slowing don’t help.

yes but what hardware?

Cheers

Spen

I have a custom made HW, sorting like STR91X-SK from ST.

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

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

#target arm7tdmi

#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 0 0 <target#>

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

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

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.

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

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.

The str9 needs to be in turbo mode for a unlock to work.

turbo mode will completely remove the str9 from the chain, this is what we want.

you may need to recycle the power after the unlock.

another option to try is asserting srst, we do not need the micro running:

jtag_reset 0 1
str9xpec enable_turbo 0
str9xpec unlock 0
str9xpec disable_turbo 0
jtag_reset 0 0

Provide a log of the above commands.

If you are still having trouble have you tried idealist:

http://www.st-angliamicro.com/software/ … EaliST.exe

This software will also allow you to unlock the str9.

Cheers

Spen

Try something like the following before unprotecting flash. The processor

must be halted and the the flash controller configured before the

unprotect command will work reliably.

monitor wait_halt

Set the flash config. This must be done prior to programming.

The target must be halted.

monitor str9x flash_config 0 4 2 0 0x80000

Check flash config

monitor flash banks

monitor flash probe 0

Unprotect sectors 0 through 7 of flash bank 0.

monitor flash protect 0 0 7 off

If the str9 is protected you cannot halt it.

The only solution you have to to assert srst, eg.

jtag_reset 0 1
str9xpec enable_turbo 0
str9xpec unlock 0
str9xpec disable_turbo 0
jtag_reset 0 0

we cannot use the str9x flash driver, the only solution is to use the str9xpec driver.

Basically talk to the flash controller directly - bypassing the arm9 core.

Cheers

Spen