Problems in programming my STR711

Hi folks,

today I’ve written some testprograms for my STR711 Evalboard - it worked proper, but now I am not able to flash my device anymore! This is the OOCD-Log:

Opening OOCD

unknown target request: 0f

Trying to flash

Flash Programming with OpenOCD...
'C:\Programme\openocd\bin\'openocd-pp.exe -f D:\Work\STR71x\Source\openocd-configs\str71x-configs\str71x_pp-flash-program.cfg
Info:    openocd.c:93 main(): Open On-Chip Debugger (2007-12-15 15:00 CET) svn: 231
Info:    openocd.c:94 main(): $URL: http://svn.berlios.de/svnroot/repos/openocd/trunk/src/openocd.c $
Info:    jtag.c:1291 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)
Error:   embeddedice.c:181 embeddedice_build_reg_cache(): unknown EmbeddedICE version (comms ctrl: 0x00000000)
Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   armv4_5.c:186 armv4_5_mode_to_number(): invalid mode value encountered
Error:   arm7_9_common.c:1083 arm7_9_debug_entry(): cpsr contains invalid mode value - communication failure
Error:   target.c:1208 handle_target(): couldn't poll target. It's due for a reset.
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   target_request.c:127 target_request(): unknown target request: 0f
Info:    target.c:233 target_init_handler(): executing reset script 'D:\Work\STR71x\Source\openocd-configs\str71x-configs\str71x_flashprogram.ocd'
Info:    configuration.c:50 configuration_output_handler(): waiting for target halted...
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   target_request.c:127 target_request(): unknown target request: 0f
Error:   armv4_5.c:186 armv4_5_mode_to_number(): invalid mode value encountered
Error:   arm7_9_common.c:1083 arm7_9_debug_entry(): cpsr contains invalid mode value - communication failure
Info:    configuration.c:50 configuration_output_handler(): target halted
Info:    configuration.c:50 configuration_output_handler(): 0x6c000000: 00008001 
Info:    configuration.c:50 configuration_output_handler(): 0x6c000004: 00008001 
Info:    configuration.c:50 configuration_output_handler(): probing failed for flash bank '#1' at 0x60000000
Info:    configuration.c:50 configuration_output_handler(): unknown error
Info:    configuration.c:50 configuration_output_handler(): sector number(s) invalid
Error:   str7x.c:355 str7x_erase(): error erasing flash bank, FLASH_ER: 0x40100004
Info:    configuration.c:50 configuration_output_handler(): flash erase error
Info:    configuration.c:50 configuration_output_handler(): sector number(s) invalid
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Warning: armv4_5.c:612 armv4_5_run_algorithm(): target reentered debug state, but not at the desired exit point: 0x2000c008
Error:   str7x.c:625 str7x_write(): flash writing failed with error code: 0xc2c2c2c2
Info:    configuration.c:50 configuration_output_handler(): failed writing file main.bin to flash bank 0 at offset 0x00000000
Info:    configuration.c:50 configuration_output_handler(): flash program error
Info:    configuration.c:50 configuration_output_handler(): wrote  4828 byte from file main.bin to flash bank 0 at offset 0x00000000 in 6s 468750us (0.728865 kb/s)
Info:    configuration.c:50 configuration_output_handler(): failed writing file main.bin to flash bank 1 at offset 0x00000000
Info:    configuration.c:50 configuration_output_handler(): unknown error
Info:    configuration.c:50 configuration_output_handler(): wrote  4828 byte from file main.bin to flash bank 1 at offset 0x00000000 in 0s 0us (1.#INF00 kb/s)
Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too


Flash Programming Finished.

What is my mistake?

rev 231 is very old.

Get a newer version from Yagarto for example, or build your own.

http://www.yagarto.de

Also when posting show config used etc, it helps in fixing your problem.

Cheers

Spen

I would like to use a newer version, but I am using the good old parallel-port wiggler, which isn’t supported by newer versions!

Here is my str71x_pp.cfg which makes Eclipse ready to “build target”:

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface parport
parport_port 0x378
parport_cable wiggler
jtag_speed 0


#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe

#target configuration
daemon_startup reset

#target <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm7tdmi little run_and_halt 0 arm7tdmi
run_and_halt_time 0 30

working_area 0 0x2000C000 0x4000 nobackup

#flash bank <driver> <base> <size> <chip_width> <bus_width>
flash bank str7x 0x40000000 0x00040000 0 0 0 STR71x
flash bank cfi   0x60000000 0x00400000 2 2 0

# For more information about the configuration files, take a look at:
# http://openfacts.berlios.de/index-en.phtml?title=Open+On-Chip+Debugger

And that’s the str71x_pp-flash-program.cfg (nearly the same)

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface parport
parport_port 0x378
parport_cable wiggler
jtag_speed 0
jtag_nsrst_delay 200
jtag_ntrst_delay 200

#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe

#target configuration
daemon_startup reset

#target <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm7tdmi little run_and_init 0 arm7tdmi
run_and_halt_time 0 30

working_area 0 0x2000C000 0x4000 nobackup

#flash bank <driver> <base> <size> <chip_width> <bus_width>
flash bank str7x 0x40000000 0x00040000 0 0 0 STR71x
flash bank cfi   0x60000000 0x00400000 2 2 0

#Script used for FLASH programming
target_script 0 reset D:\Work\STR71x\Source\openocd-configs\str71x-configs\str71x_flashprogram.ocd

And last but not least: str71x_flashprogram.ocd

wait_halt
mww 0xE0005000 0x000F
mww 0xE0005004 0x000F
mww 0xE0005008 0x000F
mww 0x6C000000 0x8001
mdw 0x6C000000
mww 0x6C000004 0x8001
mdw 0x6C000004
flash probe 1
sleep 1000
flash protect 0 0 9 off
flash protect 1 0 70 off
flash erase 0 0 9
flash erase 1 0 70
flash write 0 main.bin 0
flash write 1 main.bin 0
reset
shutdown

Is there any way to get my old PP-Wiggler working with a newer revision? (~ntfreak “…or build your own” << how?)

Building info can be found on the project page.

http://developer.berlios.de/projects/openocd/

The info in the wiki is outdated, but enough to build openocd from source:

http://openfacts.berlios.de/index-en.ph … ng_OpenOCD

or more recent pdf here: http://www.siwawi.arubi.uni-kl.de/avr_p … cd_556.pdf

Once you have openocd built you can refer to the latest openocd docs from the source tree.

It is always the best option, so you can test against the latest version.

Cheers

Spen

A newer Version doesn’t help my - it makes more trouble than the older one!

So I installed the older version (hours later) and tried to communicate with the Device over telnet - that works, but I couldn’t flash the device.

Is it possible, that the Mikrocontroller is actualy in a debug-mode? How can I go to the normal state? Is there an opportunity to restore “factory-settings”?

Now I have decided to use an other programmer: [USBProg

This is the logfile which was created by building up an oocd-connection:

Info:    usbprog.c:222 usbprog_init(): USB JTAG Interface ready!
Error:   jtag.c:1301 jtag_examine_chain(): number of discovered devices in JTAG chain (20) doesn't match configuration (1)
Error:   jtag.c:1302 jtag_examine_chain(): check the config file and ensure proper JTAG communication (connections, speed, ...)
Error:   jtag.c:1440 jtag_init(): trying to validate configured JTAG chain anyway...
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   embeddedice.c:181 embeddedice_build_reg_cache(): unknown EmbeddedICE version (comms ctrl: 0xfffffff1)
Warning: arm7_9_common.c:734 arm7_9_assert_reset(): srst resets test logic, too
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Warning: arm7_9_common.c:933 arm7_9_halt(): target was already halted

What are the reasons for all these errors? I am able to conntect to the device over telnet!](http://www.embedded-projects.net/index.php?page_id=175)

you need to validate your hardware.

if possible try changing the boot mode to internal ram, if you have existing code in the core you could be crashing it.

Cheers

Spen

The Evalboard worked fine until two days ago. The USBProg-board is brought, so it should work proper.

What does this line mean: ```
Error: jtag.c:1301 jtag_examine_chain(): number of discovered devices in JTAG chain (20) doesn’t match configuration (1)


---> I can't understand it, because I have only connected one JTAG Device.

It means that openocd has discovered more devices on the jtag chain than it expected.

This could be down to to fast a jtag clock or a hardware fault.

Have you tried changing the boot mode of the target?

Cheers

Spen

Ok I will change my Bootmode, but it is a little bit difficult, because at the moment my evalboards BOOTEN-Pin is connected to Ground and BOOT0/1 are connected to UART/LED, so I have to solder some things.

What should happen after setting the bootmode to ram?

Hi,

now I have changed the bootmode to ram (BOOTEN = 1, BOOT1 = 1, BOOT0 = 0) - what should I do at next? I have built up a telnet-connection, but there is a lot of errors:

  1. Flash probe 0 → works!

  2. Flash info 0 → works!

  3. Flash protect 0 0 9 off or Flash protect 0 0 0 off → Controller and promt don’t react anymore

This is the Logfile:

Info:    usbprog.c:222 usbprog_init(): USB JTAG Interface ready!
Error:   jtag.c:1301 jtag_examine_chain(): number of discovered devices in JTAG chain (20) doesn't match configuration (1)
Error:   jtag.c:1302 jtag_examine_chain(): check the config file and ensure proper JTAG communication (connections, speed, ...)
Error:   jtag.c:1440 jtag_init(): trying to validate configured JTAG chain anyway...
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   embeddedice.c:181 embeddedice_build_reg_cache(): unknown EmbeddedICE version (comms ctrl: 0xfffffff1)
Warning: arm7_9_common.c:734 arm7_9_assert_reset(): srst resets test logic, too
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Warning: arm7_9_common.c:933 arm7_9_halt(): target was already halted
Info:    server.c:67 add_connection(): accepted 'telnet' connection from 0
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm7_9_common.c:563 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: fffffff1
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm7_9_common.c:563 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: fffffff1
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken
Error:   arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken

What should I try at next? Is it possible that the STR711 is damaged by software (flashing)?!?