Clearing flash protection on STR710

I have an older STR710 board that I can’t seem to write to the internal flash on. Here’s what OpenOCD 0.1.0 says:

> reset halt
JTAG tap: str710.cpu tap/device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)
JTAG Tap/device matched
srst pulls trst - can not reset into halted mode. Issuing halt after reset.
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x500000d3 pc: 0x00070dbc

> flash info 0 
#0: str7x at 0x40000000, size 0x00040000, buswidth 0, chipwidth 0
	#  0: 0x00000000 (0x2000 8kB) protected
	#  1: 0x00002000 (0x2000 8kB) protected
	#  2: 0x00004000 (0x2000 8kB) protected
	#  3: 0x00006000 (0x2000 8kB) protected
	#  4: 0x00008000 (0x8000 32kB) protected
	#  5: 0x00010000 (0x10000 64kB) protected
	#  6: 0x00020000 (0x10000 64kB) protected
	#  7: 0x00030000 (0x10000 64kB) protected
str7x flash driver info

> flash protect 0 0 7 off
cleared protection for sectors 0 through 7 on flash bank 0

> flash info 0           
#0: str7x at 0x40000000, size 0x00040000, buswidth 0, chipwidth 0
	#  0: 0x00000000 (0x2000 8kB) protected
	#  1: 0x00002000 (0x2000 8kB) protected
	#  2: 0x00004000 (0x2000 8kB) protected
	#  3: 0x00006000 (0x2000 8kB) protected
	#  4: 0x00008000 (0x8000 32kB) protected
	#  5: 0x00010000 (0x10000 64kB) protected
	#  6: 0x00020000 (0x10000 64kB) protected
	#  7: 0x00030000 (0x10000 64kB) protected
str7x flash driver info

> flash write_image erase image 0 elf
auto erase enabled
Could not probe bank
auto_probe failed -900

Could not probe bank
auto_probe failed -900

wrote 0 byte from file image in 0.136092s (0.000000 kb/s)

>

I also can’t write the external flash, an SST 16VF160, which seems to be CFI 1Mx16 according to some info I found online. Here’s the flash bank config I use. Any thoughts?

flash bank str7x 0x40000000 0x00040000 0 0 0 STR71x
flash bank str7x 0x400C0000 0x00004000 0 0 0 STR71x

flash bank cfi 0x60000000 0x200000 2 2 0

It doesn’t even recognize the external flash (flash probe/info just says it’s not there).

I got the internal flash to work by manually clearing the permanent debug protect. I wrote 0xfffffffe into flash address 0x4010dfbc (NVPROT), by manually twiddling the FCR/FAR/FDR regs to write to that flash address. I then reset, disabled the CFI flash bank config and wrote my image to 0x40000000. ‘flash info’ still says it’s protected though, but maybe this is just temporary protection.

you will need to call flash protect_check 0 before the str7 protection info is valid.

eg.

flash protect_check 0
flash info 0

The str7 does not support autoprobe - so would guess the cfi flash is failing.

Also to program using a elf just use:

flash write_image erase image

If you still have problems attach a full debug log.

Cheers

Spen