How to program at91sam7s256 with ARM-USB-OCD-H

Started by ajunquera, December 23, 2013, 07:05:07 pm

Previous topic - Next topic

ajunquera

Dear All.

I have always programmed my at91sam7s256 with my old ARM-USB-OCD debugger. For that I was using:

openocd-r520-20080322

With this files:

config.cfg
script.ocd

The file "config.cfg" is:

------------------------------------------------------------------------------------------------------------
#define our ports
telnet_port 4444
gdb_port 3333

#commands specific to the Amontec JTAGKey
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout olimex-jtag
ft2232_vid_pid 0x15BA 0x0003
jtag_speed 2
jtag_nsrst_delay 200
jtag_ntrst_delay 200

#reset_config <signals> [combination] [trst_type] [srst_type]
reset_config srst_only srst_pulls_trst

#jtag_device <IR length> <IR capture> <IR mask> <IDCODE instruction>
jtag_device 4 0x1 0xf 0xe

#daemon_startup <'attach'|'reset'>
daemon_startup reset

#target <type> <endianess> <reset_mode> <jtag#> [variant]
target arm7tdmi little run_and_init 0 arm7tdmi_r4

#run_and_halt_time <target#> <time_in_ms>
run_and_halt_time 0 30



#flash bank at91sam7 0 0 0 0 <target#>
flash bank at91sam7 0 0 0 0 0


# commands below are specific to AT91sam7 Flash Programming

#target_script specifies the flash programming script file
target_script 0 reset script.ocd

#working_area <target#> <address> <size> <'backup'|'nobackup'>
working_area 0 0x40000000 0x4000 nobackup

#flash bank at91sam7 0 0 0 0 <target#>
flash bank at91sam7 0 0 0 0 0

------------------------------------------------------------------------------------------------------------

And the file "script.ocd" is:

------------------------------------------------------------------------------------------------------------
#   OpenOCD Target Script for Atmel AT91SAM7S256
#
#   Programmer: James P Lynch
#

#Uncomment both lines if the lock bits are enable
#mww 0xffffff64 0xA5000004  # clear lock bit 0
#mww 0xffffff64 0xA5002004  # clear lock bit 1

flash banks

wait_halt                     # halt the processor and wait
armv4_5 core_state arm            # select the core state
mww 0xffffff60 0x00320100         # set flash wait state (AT91C_MC_FMR)
mww 0xfffffd44 0xa0008000         # watchdog disable (AT91C_WDTC_WDMR)
mww 0xfffffc20 0xa0000601         # enable main oscillator (AT91C_PMC_MOR)
wait 100                     # wait 100 ms
mww 0xfffffc2c 0x00480a0e         # set PLL register (AT91C_PMC_PLLR)
wait 200                     # wait 200 ms
mww 0xfffffc30 0x7               # set master clock to PLL (AT91C_PMC_MCKR)
wait 100                     # wait 100 ms
mww 0xfffffd08 0xa5000401         # enable user reset AT91C_RSTC_RMR
flash write_bank 0 main.bin 0x00   # program the onchip flash
reset run                     # reset processor
shutdown                     # stop OpenOCD
-----------------------------------------------------------------------------------------------------------

With this configuration, everything is OK.

But recently I have bought the new ARM-USB-OCD-H Debugger, and i'm not able to program the chip with this Debugger.
I don't know how i must modify the configuration files for programm using this new Debugger.

Can anybody help me?

The drivers seems to be quite installed, and i'm using the same computer for bouth Debuggers.
With OpenOCD version i should use?
How i must modify the files for the nue OpenOCD version?


Kinds Reagards.



LubOlimex

Hey there,

ARM-USB-OCD and ARM-USB-OCD-H have different descriptions and different product IDs.

This part of your configuration is not suitable for ARM-USB-OCD-H:

#commands specific to the Amontec JTAGKey
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout olimex-jtag
ft2232_vid_pid 0x15BA 0x0003
jtag_speed 2
jtag_nsrst_delay 200
jtag_ntrst_delay 200


Specifically the device description should be "Olimex OpenOCD ARM-USB-OCD-H" and the VID and PID should be respectively: 0x15BA and 0x002b.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

ajunquera

Thank you very much for your reply.

I have change this values, but now the problem is in the next line; jtag_speed 2

Could you help me with the whole configuration for this new ARM-USB-OCD-H debugger?

Kinds Regards

LubOlimex

The jtag_speed parameter is outdated. The newer OpenOCD revisions use jtag_khz. The current official version is 0.7.0 and it also uses jtag_khz. I recommend you to use the latest version.

The whole thing should look like this:

interface ft2232
ft2232_device_desc "Olimex OpenOCD ARM-USB-OCD-H"
ft2232_layout olimex-jtag
ft2232_vid_pid 0x15ba 0x002b
jtag_khz 2000
jtag_nsrst_delay 200
jtag_ntrst_delay 200

Note that jtag_khz depends on the target processor.

I recommend you to refer to the official documentation: http://openocd.sourceforge.net/doc/pdf/openocd.pdf.

The mailing lists might provide useful information also: http://openocd.sourceforge.net/discussion/mailing-lists/

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

ajunquera

Hello all:
More than 6 years later I'm in the predicted problem. My old Olimex ARM-USB-OCD has broken and I want to use the Olimex ARM-USB-OCD-H to program my device based on the at91sam7s256.
With the configuration of my first old post, I was able to program the unit using m old Olimex, but I can do that using the ARM-USB-OCD-H.
I have done the changes on the script proposed upwords:

The file "config.cfg" is:

------------------------------------------------------------------------------------------------------------
#define our ports
telnet_port 4444
gdb_port 3333

#commands specific to the Amontec JTAGKey
interface ft2232
ft2232_device_desc "Olimex OpenOCD ARM-USB-OCD-H"
ft2232_layout olimex-jtag
ft2232_vid_pid 0x15BA 0x002b
jtag_khz 2000
jtag_nsrst_delay 200
jtag_ntrst_delay 200

#reset_config <signals> [combination] [trst_type] [srst_type]
reset_config srst_only srst_pulls_trst

#jtag_device <IR length> <IR capture> <IR mask> <IDCODE instruction>
jtag_device 4 0x1 0xf 0xe

#daemon_startup <'attach'|'reset'>
daemon_startup reset

#target <type> <endianess> <reset_mode> <jtag#> [variant]
target arm7tdmi little run_and_init 0 arm7tdmi_r4

#run_and_halt_time <target#> <time_in_ms>
run_and_halt_time 0 30


#flash bank at91sam7 0 0 0 0 <target#>
flash bank at91sam7 0 0 0 0 0


# commands below are specific to AT91sam7 Flash Programming

#target_script specifies the flash programming script file
target_script 0 reset script.ocd

#working_area <target#> <address> <size> <'backup'|'nobackup'>
working_area 0 0x40000000 0x4000 nobackup

#flash bank at91sam7 0 0 0 0 <target#>
flash bank at91sam7 0 0 0 0 0

-----------------------------------------------------------------------------------

But don't work. Anyone knows how can I program my device using "ARM-USB-OCD-H".

Thank you so much.

JohnS

I suspect, avoid the deprecated ft2232 things, use the newer ones.

If still in trouble, ask in an openocd place (such as the ML).

John

LubOlimex

What is the voltage of at91sam7s256? One difference between ARM-USB-OCD-H and ARM-USB-TINY-H is the bottom voltage threshold, ARM-USB-TINY-H works with targets powered by 2V or above (ARM-USB-OCD-H works with 1.65V targets and above).
Technical support and documentation manager at Olimex