OpenOCD Multiple USB Programmers

Hello,

We are using OpenOCD r253 with the Olimex ARM-USB-OCD and the AT91SAM7X. Everything works like clockwork. We actually use this for the AT91SAM7S as well. However, we are programming multiple boards all the time and I was wondering if there was a way to tell OpenOCD which USB Device to use. EDIT: We are using Ubuntu 7.10 (Gutsy).

I want to hook up two (or more) ARM-USB-OCDs to one computer system and have potentially two (or more) configuration files or two (or more) different calls to OpenOCD to program. I don’t really care about the debugging aspect, just the programming.

Thanks in advance,

Tim

One idea we have had is to try a different JTAG number. Instead of using JTAG device 0, try device 1. We haven’t tested this yet. Does anyone have any comments on that approach?

I solved this problem with the Amontec JTAGkey-Tiny by giving OpenOCD a serial number. Presently I have two operating at once but if Amontec ever sends more Tiny, I will have 4-6 working simultaneously.

Search for my name in this forum for my prior post.

Thanks smead for pointing us in the right direction.

The ARM-USB-OCD does not have any serial numbers programmed in. However you can change this using the FTDI provided MProg program. The MProg program can be found at http://www.ftdichip.com/Resources/Utilities.htm.

Although we are using linux, we installed the MProg (3.0a at the time) on a laptop using XP. We also installed OpenOCD, so that we could get the ARM-USB-OCD drivers for XP. Then you can plug in your ARM-USB-OCD and run MProg.

  1. Select File->New

  2. Select Tools->Read and Parse

  3. Uncheck the “Disable USB Serial Number”

  4. Check “Use Fixed Serial Number”

  5. Insert a fixed serial number in the box

  6. Select File->Save As…

Save the file, we just saved it as “olimex.ept”

  1. Select File->Open

  2. Open your template

  3. Be sure the “Only Program Blank Devices” is unchecked

  4. Select Device->Program

If you are using linux, you can now plug the device in and run “lsusb -v” and see that the SerialNumber is no longer blank.

Here is the openocd config file we are using:

#daemon configuration

telnet_port 4444

gdb_port 3333



#interface

interface ft2232

ft2232_device_desc "Olimex OpenOCD JTAG"

ft2232_layout olimex-jtag

ft2232_vid_pid 0x15ba 0x0003

ft2232_serial "00000002"



ft2232_latency 10

jtag_speed 0

jtag_nsrst_delay 100

reset_config srst_only



#jtag scan chain

jtag_device 4 0x1 0xf 0xe



#target configuration

daemon_startup reset

target arm7tdmi little run_and_init 0

run_and_halt_time 0 30

target_script 0 reset sam7.script

working_area 0 0x00200000 0x10000 nobackup



flash bank at91sam7 0 0 0 0 0

Here is our script file for those interested:

# 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)



# AT91SAM7 flash command-"batch"

arm7_9 dcc_downloads enable

arm7_9 fast_memory_access enable

sleep 10

poll

flash probe 0

flash write 0 main.bin 0x0



# flash write is deprecated but still available. 

# Update to flash write_binary 0 main.bin 0x0

reset run

sleep 10

shutdown

DISCLAIMER: I/We are not responsible for erasure of the FTDI EEPROM chip on your ARM-USB-OCD. Please be careful when using the MProg program.

debaillie:

I joined the forum just for the purpose of finding out how to drive two instances of ARM-USB-OCD from the same host at the same time. Before posting, I took a chance searching on the keyword “multiple” and I found your solution. I’ll be baptizing my second pod ASAP.

One addition: I needed to enable “edit mode” in order to untick “only program blank devices”.

After the “read and parse” step, it populated many fields with Olimex parameters.

Device Type: FT2232C

Own VID & PID

Vendor ID: 15BA

Product ID: 0003

Manufacturer: Olimex

Product Description: Olimex OpenOCD JTAG

Bus powered 300mA

Side A RS232 UART/D2XX

Side B RS232 UART/Virtual COM Port

When programming completed, it displayed the message “Programmed xSerial Number: 12349876” in the status box.

My changed pod as reported by “USB Device Viewer” (a Microsoft tool available from the FTDI web site):

Device Descriptor:
bcdUSB:              0x0200
bDeviceClass:          0x00
bDeviceSubClass:      0x00
bDeviceProtocol:      0x00
bMaxPacketSize0:      0x08 (8)
idVendor:           0x15BA
idProduct:          0x0003
bcdDevice:          0x0500
iManufacturer:        0x01
0x0409: "Olimex"
iProduct:             0x02
0x0409: "Olimex OpenOCD JTAG"
0x0409: "Olimex OpenOCD JTAG"
0x0409: "Olimex OpenOCD JTAG"
iSerialNumber:        0x03
0x0409: "12349876"
bNumConfigurations:   0x01

In my unchanged ARM-USB-OCD pod, the iSerialNumber is 0, and the line following is not displayed.

iSerialNumber:        0x00

After programming the serial number, the USB wizard enumerated my device (the annoying three pass process).

Something I should point out: without the serial number, the “wiz” will run the device driver installation process whenever the pod is moved to a different USB port.

After programming the serial number, I’ve been able to move the pod to different USB ports and NOT have the nasty wiz repeat the driver install. So there’s a small benefit even if you have only a single device.

(update)

I’ve now programmed both pods with distinct serial numbers and verified the JTAG and serial port functionality. Everything is fine. FTDI has a nice tool.

Needed to append the letter A to the serial number in the ft2232_serial directive before the device scan was successful.

Under Device Manager, Serial port properties, Details tab, Device Instance ID property, the assigned serial number can be associated with the assigned COM port.

FTDIBUS\VID_15BA+PID_0003+12349876B\0000

Under Port Settings tab, Advanced, the COM assignment can be manually changed. I set mine up so my serial numbers and port settings are in a known correspondence. For a long time I didn’t know Windows offered this little bread-crumb of self empowerment. I had become too discouraged to look.

Now with my Olimex pods, more guessing which pod has which serial port after every USB connection event. Nice.