AT91SAM7S32

Hello,

i have troubles to flash my AT91SAM7S32 device. (an AT91SAM7S256 works without problems):

This is openocds answer to my flash commands:

Info: openocd.c:93 main(): Open On-Chip Debugger (2007-12-30 17:00 CET) svn: 247

Info: openocd.c:94 main(): $URL: http://svn.berlios.de/svnroot/repos/ope … /openocd.c $

Info: jtag.c:1291 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too

Info: target.c:233 target_init_handler(): executing reset script ‘sam7flash.script.txt’

Info: configuration.c:50 configuration_output_handler(): requesting target halt…

Warning: arm7_9_common.c:941 arm7_9_halt(): target was already halted

Info: configuration.c:50 configuration_output_handler(): target already halted

Info: configuration.c:50 configuration_output_handler(): waiting for target halted…

Info: configuration.c:50 configuration_output_handler(): target halted

Info: configuration.c:50 configuration_output_handler(): sector number(s) invalid

Info: configuration.c:50 configuration_output_handler(): dcc downloads are enabled

Info: configuration.c:50 configuration_output_handler(): flash ‘at91sam7’ found at 0x00100000

Error: arm7_9_common.c:571 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0

Error: arm7_9_common.c:571 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0

Error: arm7_9_common.c:571 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0

Error: arm7_9_common.c:571 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0

Error: at91sam7.c:266 at91sam7_wait_status_busy(): status register: 0x9

Error: at91sam7.c:270 at91sam7_wait_status_busy(): Invalid command and/or bad keyword, Operation Abort

Info: configuration.c:50 configuration_output_handler(): failed writing file rm.elf.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 9008 byte from file rm.elf.bin to flash bank 0 at offset 0x00000000 in 21s 250000us

At first i thought it would be a problem with the LockBits - for this i cleared them in my cmd-file but with no sucess. Also i reduced the working size in RAM from 0x4000 to 0x2000 - no success.

Can anyone give me a hint, whats wrong with this AT91SAM7? Btw. with “SAM-BA” it can be programmed without problems and with “SAM-PROG” + SAM ICE also…

But i want to use the openocd+Olimex JTAG Tiny also for this device…

This are my cfg and script configurations:

#daemon configuration

telnet_port 4444

gdb_port 3333

#interface

interface ft2232

ft2232_device_desc “Olimex OpenOCD JTAG TINY A”

ft2232_layout “olimex-jtag”

ft2232_vid_pid 0x15ba 0x0004

jtag_speed 2

jtag_nsrst_delay 200

jtag_ntrst_delay 200

#use combined on interfaces or targets that can’t set TRST/SRST separately

reset_config srst_only srst_pulls_trst

#reset_config trst_and_srst separate

#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

#target arm7tdmi

target arm7tdmi little run_and_init 0 arm7tdmi

run_and_halt_time 0 30

flash-options AT91

target_script 0 reset sam7flash.script.txt

working_area 0 0x00200000 0x2000 nobackup

flash bank at91sam7 0 0 0 0 0

Information:

erase command (telnet-interface) for complete flash:

flash erase 0 numlockbits-1 (can be seen from output of flash info 0)

SAM7S64 with 16 lockbits and bank 0: flash erase 0 0 15

set/clear NVM-Bits:

at91sam7 gpnvm <set|clear>

disable locking from SAM-BA

flash protect 0 0 1 off

For more information about the configuration files, take a look at:

http://openfacts.berlios.de/index-en.ph … p+Debugger


halt

sleep 10

wait_halt

Init - taken form the script openocd_at91sam7_ecr.script

mww 0xfffffd44 0x00008000 # disable watchdog

#mww 0xfffffd08 0xa5000001 # enable user reset

mww 0xfffffc20 0x00000601 # CKGR_MOR : enable the main oscillator

sleep 10

mww 0xfffffc2c 0x00481c0e # CKGR_PLLR: 96.1097 MHz

sleep 10

mww 0xfffffc30 0x00000007 # PMC_MCKR : MCK = PLL / 2 ~= 48 MHz

sleep 10

mww 0xffffff60 0x003c0100 # MC_FMR: flash mode (FWS=1,FMCN=60)

#clear lockbits - atsam7s32 has 256 pages a 128 Bytes & 8 Lockbits for protecting each 32 pages

mww 0xffffff64 0x5a000004 # clear lockbit input page number (0-256) region 0

mww 0xffffff64 0x5a002004 # clear lockbit input page number (0-256) region 1

mww 0xffffff64 0x5a004004 # clear lockbit input page number (0-256) region 2

mww 0xffffff64 0x5a006004 # clear lockbit input page number (0-256) region 3

mww 0xffffff64 0x5a008004 # clear lockbit input page number (0-256) region 4

mww 0xffffff64 0x5a0A0004 # clear lockbit input page number (0-256) region 5

mww 0xffffff64 0x5a0C0004 # clear lockbit input page number (0-256) region 6

mww 0xffffff64 0x5a0E0004 # clear lockbit input page number (0-256) region 7

arm7_9 force_hw_bkpts enable # program resides in flash

flash erase 0 0 15

AT91SAM7 flash command-“batch”

arm7_9 dcc_downloads enable

flash probe 0

flash write 0 rm.elf.bin 0x0

sleep 10

reset run

sleep 10

shutdown

Thank you very much!

Another answer of openocd (without any changes) :

Info: openocd.c:93 main(): Open On-Chip Debugger (2007-12-30 17:00 CET) svn: 247

Info: openocd.c:94 main(): $URL: http://svn.berlios.de/svnroot/repos/ope … /openocd.c $

Info: jtag.c:1291 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too

Info: target.c:233 target_init_handler(): executing reset script ‘sam7flash.script.txt’

Info: configuration.c:50 configuration_output_handler(): requesting target halt…

Warning: arm7_9_common.c:941 arm7_9_halt(): target was already halted

Info: configuration.c:50 configuration_output_handler(): target already halted

Info: configuration.c:50 configuration_output_handler(): waiting for target halted…

Info: configuration.c:50 configuration_output_handler(): target halted

Info: configuration.c:50 configuration_output_handler(): sector number(s) invalid

Info: configuration.c:50 configuration_output_handler(): dcc downloads are enabled

Info: configuration.c:50 configuration_output_handler(): flash ‘at91sam7’ found at 0x00100000

Error: arm_jtag.c:38 arm_jtag_set_instr_error_handler(): setting the new JTAG instruction failed, debugging is likely to be broken

Error: at91sam7.c:266 at91sam7_wait_status_busy(): status register: 0x200000db

Error: at91sam7.c:270 at91sam7_wait_status_busy(): Invalid command and/or bad keyword, Operation Abort

Error: at91sam7.c:272 at91sam7_wait_status_busy(): Security Bit Set, Operation Abort

Info: configuration.c:50 configuration_output_handler(): failed writing file rm.elf.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 9008 byte from file rm.elf.bin to flash bank 0 at offset 0x00000000 in 0s 812500us

and

Info: openocd.c:93 main(): Open On-Chip Debugger (2007-12-30 17:00 CET) svn: 247

Info: openocd.c:94 main(): $URL: http://svn.berlios.de/svnroot/repos/ope … /openocd.c $

Info: jtag.c:1291 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

Warning: arm7_9_common.c:742 arm7_9_assert_reset(): srst resets test logic, too

Info: target.c:233 target_init_handler(): executing reset script ‘sam7flash.script.txt’

Info: configuration.c:50 configuration_output_handler(): requesting target halt…

Warning: arm7_9_common.c:941 arm7_9_halt(): target was already halted

Info: configuration.c:50 configuration_output_handler(): target already halted

Info: configuration.c:50 configuration_output_handler(): waiting for target halted…

Info: configuration.c:50 configuration_output_handler(): target halted

Info: configuration.c:50 configuration_output_handler(): sector number(s) invalid

Info: configuration.c:50 configuration_output_handler(): dcc downloads are enabled

Info: configuration.c:50 configuration_output_handler(): flash ‘at91sam7’ found at 0x00100000

Warning: arm7_9_common.c:1909 arm7_9_read_memory(): memory read caused data abort (address: 0xffffff68, size: 0x4, count: 0x1)

Warning: arm7_9_common.c:2074 arm7_9_write_memory(): memory write caused data abort (address: 0x00100400, size: 0x4, count: 0x20)

Error: at91sam7.c:266 at91sam7_wait_status_busy(): status register: 0x200000db

Error: at91sam7.c:270 at91sam7_wait_status_busy(): Invalid command and/or bad keyword, Operation Abort

Error: at91sam7.c:272 at91sam7_wait_status_busy(): Security Bit Set, Operation Abort

Info: configuration.c:50 configuration_output_handler(): failed writing file rm.elf.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 9008 byte from file rm.elf.bin to flash bank 0 at offset 0x00000000 in 0s 281250us

The Security Bit is NOT set…because with sam-ba i can erase and unlock the whole mem…