OpenOCD does not detect my JTAGkey.

Hi all,

I’m having a hard time getting OpenOCD to detect my JTAGkey (or any jtag).

pieterb@WS1976:~/small_demo$ openocd -f jtag/stm32.cfg
Test Build


BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS


$URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $
500 kHz
Error: unable to open ftdi device: 2
Error: ListDevices: 0

Runtime error, file "command.c", line 456:
    pieterb@WS1976:~/small_demo$

Here is my config file:

# script for stm32

if { [info exists CHIPNAME] } {	
   set  _CHIPNAME $CHIPNAME    
} else {	 
   set  _CHIPNAME stm32
}

if { [info exists ENDIAN] } {	
   set  _ENDIAN $ENDIAN    
} else {	 
   set  _ENDIAN little
}

telnet_port 4444
gdb_port 3333

# jtag speed
jtag_khz 500

jtag_nsrst_delay 100
jtag_ntrst_delay 100

#interface
#interface amt_jtagaccel
#parport_port 0x378
interface ft2232
ft2232_layout jtagkey
ft2232_vid_pid  0403 cff8 
ft2232_device_desc "Amontec JTAGkey A"
#ft2232_serial 40RH5KMD

# tell gdb our flash memory map
# and enable flash programming
gdb_memory_map enable
gdb_flash_program enable

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

#jtag scan chain
if { [info exists CPUTAPID ] } {
   set _CPUTAPID $CPUTAPID
} else {
  # See STM Document RM0008
  # Section 26.6.3
   set _CPUTAPID 0x3ba00477
}
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID

if { [info exists BSTAPID ] } {
   set _BSTAPID $BSTAPID
} else {
  # See STM Document RM0008
  # Section 26.6.2
  # Medium Density RevA
  set _BSTAPID 0x06410041
  # Rev B and Rev Z
  set _BSTAPID 0x16410041
  # High Density Devices, Rev A
  set _BSTAPID 0x06414041
}   
jtag newtap $_CHIPNAME bs  -irlen 5 -ircapture 0x1 -irmask 0x1 -expected-id $_BSTAPID

set _TARGETNAME [format "%s.cpu" $_CHIPNAME]
target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME

$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 16384 -work-area-backup 0

#flash bank stm32x 0 0 0 0 0
flash bank stm32x 0x08000000 0x00080000 0 0 0 

# For more information about the configuration files, take a look at:
# openocd.texi

I have build openOCD with options:

./configure --enable-ft2232_ftd2xx --with-ftd2xx-linux-tardir=/home/pieterb/libftd2xx0.4.16

I don’t know why ListDevices: 0, I’ve tried running sudo openocd with the same result.

Does anyone have a clue? :?

Thanks,

Pieter.

Just to add more info.

I’m working on a Ubuntu 8.10 box.

The JTAGkey is plugged in and detected by Ubuntu:

pieterb@WS1976:~/openocd$ lsusb
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 0403:cff8 Future Technology Devices International, Ltd 
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

I’m urgently looking for answers, any suggestions welcome.

Thanks,

Pieter.

Hi,

I am experiencing exactly the same problem with an STM32-PerformanceStick. The stick is based on an FTDI FT2232D chip and should work with either libftd2xx or libftdi.

The package that comes with ubuntu gives the following:

Open On-Chip Debugger 1.0 (2008-06-22-10:53) svn:unknown
$URL: http://svn.berlios.de/svnroot/repos/openocd/trunk/src/openocd.c $
Debug:   3 0 command.c:425 command_run_line(): script openocd.cfg
Debug:   4 0 configuration.c:87 open_file_from_path(): opened openocd.cfg
Debug:   5 0 command.c:425 command_run_line(): interface ft2232
Debug:   6 0 command.c:425 command_run_line(): ft2232_device_desc "STM32-PerformanceStick"
Debug:   7 1 command.c:425 command_run_line(): ft2232_layout stm32stick
Debug:   8 1 command.c:425 command_run_line(): gdb_port 4789
Debug:   9 1 command.c:425 command_run_line(): init
Debug:   10 1 openocd.c:102 handle_init_command(): target init complete
Debug:   11 1 ft2232.c:1504 ft2232_init_libftdi(): 'ft2232' interface using libftdi with 'stm32stick' layout (0403:6010)
Error:   12 236 ft2232.c:1516 ft2232_init_libftdi(): unable to open ftdi device: device not found
Debug:   13 236 command.c:382 find_and_run_command(): Command failed with error code -100

When compiling the source tarball of openocd with libftd2xx support, the compilation works fine. But when I run it:

Open On-Chip Debugger 0.1.0 (2009-02-26-13:48) Release


BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS


$URL: https://kc8apf@svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.1.0/src/openocd.c $
User : 5 0 command.c:494 command_run_line(): 
Debug: 6 0 configuration.c:88 find_file(): found openocd.cfg
Debug: 8 0 command.c:91 script_command(): script_command - interface
Debug: 9 0 command.c:108 script_command(): script_command - interface, argv[0]=ocd_interface
Debug: 10 0 command.c:108 script_command(): script_command - interface, argv[1]=ft2232
Debug: 12 0 command.c:91 script_command(): script_command - ft2232_device_desc
Debug: 13 0 command.c:108 script_command(): script_command - ft2232_device_desc, argv[0]=ocd_ft2232_device_desc
Debug: 14 0 command.c:108 script_command(): script_command - ft2232_device_desc, argv[1]=STM32-PerformanceStick
Debug: 16 0 command.c:91 script_command(): script_command - ft2232_layout
Debug: 17 0 command.c:108 script_command(): script_command - ft2232_layout, argv[0]=ocd_ft2232_layout
Debug: 18 0 command.c:108 script_command(): script_command - ft2232_layout, argv[1]=stm32stick
Debug: 20 0 command.c:91 script_command(): script_command - gdb_port
Debug: 21 0 command.c:108 script_command(): script_command - gdb_port, argv[0]=ocd_gdb_port
Debug: 22 0 command.c:108 script_command(): script_command - gdb_port, argv[1]=4789
User : 23 1 command.c:494 command_run_line(): 
Debug: 25 1 command.c:91 script_command(): script_command - init
Debug: 26 1 command.c:108 script_command(): script_command - init, argv[0]=ocd_init
Debug: 27 1 openocd.c:144 handle_init_command(): target init complete
Debug: 28 1 ft2232.c:1463 ft2232_init_ftd2xx(): 'ft2232' interface using FTD2XX with 'stm32stick' layout (0403:6010)
Error: 29 230 ft2232.c:1506 ft2232_init_ftd2xx(): unable to open ftdi device: 2
Error: 30 231 ft2232.c:1521 ft2232_init_ftd2xx(): ListDevices: 0

Debug: 31 231 command.c:427 run_command(): Command failed with error code -100
User : 32 231 command.c:626 openocd_jim_vfprintf(): Runtime error, file "command.c", line 456:
    User : 33 231 command.c:626 openocd_jim_vfprintf():

Somehow that leads to the conclusion that the STM32-PerformanceStick cannot be found. But I don’t really see what I am doing wrong. I followed all the tutorials there are and it shows up fine in lsusb or usbviewer (even though it’s red in usbviewer, whatever that means…). Can anybody help me? Has anybody used this hardware with Ubuntu 8.10?

Thanks a lot

Talarion

try adding the following for the stm32 comstick - linux requires it.

ft2232_vid_pid 0x0640 0x002d

decided to post full config aswell

# debug options
debug_level 3

# daemon configuration
telnet_port 4000
gdb_port 2000

# comstick ftdi device
interface ft2232
ft2232_layout stm32stick
ft2232_device_desc "STM32-PerformanceStick"
ft2232_vid_pid 0x0640 0x002d	# stm32 comstick

jtag_khz 500
jtag_nsrst_delay 100
jtag_ntrst_delay 100

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

jtag newtap stm32 cpu -irlen 4 -ircapture 0x1 -irmask 0xf
jtag newtap stm32 bs -irlen 5 -ircapture 0x1 -irmask 0x1
jtag newtap str750 unknown -irlen 4 -ircapture 0x1 -irmask 0x0f
target create stm32.cpu cortex_m3 -endian little -chain-position stm32.cpu
stm32.cpu configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 0x4000 -work-area-backup 0

flash bank stm32x 0 0 0 0 0

you have to remember the stm32 stick has a str750 onboard aswell.

There is also a script in the openocd svn:

http://svn.berlios.de/svnroot/repos/ope … 2stick.cfg

you may also have to be root (or sudo) depending on system setup.

Cheers

Spen

The standard linux kernel… driver… dos not have the USB ID for the comstick str912 in the usb device list… so it wont be regnized. when you plug it in…

so you have to add the USB id… to… the linux kernal files…

and tell it, not to treat the them as 2 serail ports. but only one…

This mode is for… comstick str912 of corse…

Oh Im running linux 2.6.30.5… by the way on debain…

2 files to add/change

linux/drivers/usb/serial/ftdi_sio.h


/* Hitex Development Tools Comstick str912 */

#define HITEX_VID 0x0640

#define HITEX_ARM_USB_COMSTICK_PID 0x002C


and… ftdi_sio.c

add this too the table… at end… some where…


static struct usb_device_id id_table_combined = {

.

… !!! all the other USB ID’s !!

…!

{ USB_DEVICE(HITEX_VID, HITEX_ARM_USB_COMSTICK_PID),

.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },


do the recompile kernel nightmare… and install…

and it should work !!

… maybe… work for me any way…

, anuf to get the openocd to work sort of…

and show it has a bug… doing reset on the comstick board… which Im tying to fix… :frowning:

Lachlan

recompiling the kernel driver is not required to use openocd under linux.

All you need is either libusb/libftdi or libftdi2xx.

Cheers

Spen

Yes. but if you wont to use the serial port on the comstick str912 you need too…

Lachlan

For something like olimex maybe, as far as i know this is not connected on the comstick.

Cheers

Spen