Page 1 of 1

OpenOCD with Olimex ARM-USB-OCD-H

Posted: Fri May 03, 2013 4:48 pm
by sparkying
Hello,

I'm having this problem to get OpenOCD working with this JTAG adapter and hope someone would help.

I downloaded followings tar bundles and compiled them on a linux machine.
libusb-1.0.9
libftdi1-1.0
openocd-0.6.1 ( ./configure ----enable-ft2232_libftdi1

Running OpenOCD :
Code: Select all
$ openocd -f interface/olimex-arm-usb-ocd-h.cfg  -f target/cs351x.cfg
Open On-Chip Debugger 0.6.1 (2013-04-15-21:39)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Error: The specified debug interface was not found (ft2232)
The following debug interfaces are available:
Runtime Error: /usr/local/share/openocd/scripts/interface/olimex-arm-usb-ocd-h.cfg:7:
in procedure 'script'
at file "embedded:startup.tcl", line 58
in procedure 'interface' called at file "/usr/local/share/openocd/scripts/interface/olimex-arm-usb-ocd-h.cfg", line 7
Code: Select all
usb 1-3: new high speed USB device using ehci_hcd and address 12
usb 1-3: New USB device found, idVendor=15ba, idProduct=002b
usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-3: Product: Olimex OpenOCD JTAG ARM-USB-OCD-H
usb 1-3: Manufacturer: Olimex
usb 1-3: SerialNumber: OLXXXXX
usb 1-3: configuration #1 chosen from 1 choice

Any idea what could be wrong?

Many Thanks

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Fri May 03, 2013 5:09 pm
by mlu
Quick reply

Seems the configuration of the ft2232_libftdi interface didnt work,
go back and check the meassages from the config/build of openocd.

/Magnus

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Fri May 03, 2013 6:11 pm
by sparkying
Looking at the config.log, it seems the ft2232_libftdi was not selected. Maybe the configure supports the arg as "--enable-ft2232_libftdi". I'd used --enable-ft2232_libftdi1 since I've libftdi1-1.0 version installed. Would this cause the configure not to select ft2232_libftdi?
Code: Select all
/usr/include/libftdi1
/usr/lib64/libftdipp1.so
/usr/lib64/cmake/libftdi1
/usr/lib64/libftdi1.so
/usr/lib64/libftdipp1.so.2
/usr/lib64/libftdi1.so.2
/usr/lib64/libftdipp1.so.2.0.0
/usr/lib64/libftdi1.a
/usr/lib64/pkgconfig/libftdi1.pc
/usr/lib64/pkgconfig/libftdipp1.pc
/usr/lib64/libftdi1.so.2.0.0
/usr/lib64/libftdipp1.a
/usr/bin/libftdi1-config

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Fri May 03, 2013 7:29 pm
by sparkying
I created sym links for libusb.* and libftdi.* . The ft2232 interface is available now.

Now I've to figure out how to get JTAG work -
Code: Select all
 openocd -f interface/olimex-arm-usb-ocd-h.cfg  -f target/cs351x.cfg
Open On-Chip Debugger 0.6.1 (2013-05-03-18:41)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
dcc downloads are enabled
Info : max TCK change to: 30000 kHz
Error: An adapter speed is not selected in the init script. Insert a call to adapter_khz or jtag_rclk to proceed.
in procedure 'init'

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Sat May 04, 2013 6:57 am
by hsutherl
I'm surprised you get an error rather than a warning. Anyway the syntax is
Code: Select all
adapter_khz 500
or similar. You can insert it in olimex-arm-usb-ocd-h.cfg, or create an openocd.cfg. Or you may be able to add it on the command line - not sure about syntax for that.

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Sat May 04, 2013 10:05 am
by sparkying
Using "adapter_khz 500", I get this error
Code: Select all
 openocd -f interface/olimex-arm-usb-ocd-h.cfg  -f target/cs351x.cfg
Open On-Chip Debugger 0.6.1 (2013-05-03-18:41)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
adapter speed: 500 kHz
dcc downloads are enabled
Info : max TCK change to: 30000 kHz
Info : clock speed 500 kHz
Error: couldn't read enough bytes from FT2232 device (0 < 81)
Error: couldn't read from FT2232
Error: Trying to use configured scan chain anyway...
Error: couldn't read enough bytes from FT2232 device (0 < 2)
Error: couldn't read from FT2232
Warn : Bypassing JTAG setup events due to errors
Error: couldn't read enough bytes from FT2232 device (0 < 6)
Error: couldn't read from FT2232
Polling target failed, GDB will be halted. Polling again in 100ms
Polling target failed, GDB will be halted. Polling again in 300ms
Polling target failed, GDB will be halted. Polling again in 700ms
Polling target failed, GDB will be halted. Polling again in 1500ms

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Sat May 04, 2013 8:14 pm
by sparkying
Never mind. I got it working by recompiling libusb, libftdi and openocd.

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Sat May 04, 2013 8:59 pm
by sparkying
Does anyone know why I don't see JTAG Tap Info?

Any idea as why the JTAG scan chain interrogation is failing?
Code: Select all
openocd -f interface/olimex-arm-usb-ocd-h.cfg  -f target/cs351x.cfg
Open On-Chip Debugger 0.6.1 (2013-05-04-20:46)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
adapter speed: 500 kHz
dcc downloads are enabled
Info : max TCK change to: 30000 kHz
Info : clock speed 500 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: cs351x.cpu: IR capture error; saw 0x0f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Embedded ICE version 15
Error: unknown EmbeddedICE version (comms ctrl: 0xffffffff)
Info : cs351x.cpu: hardware has 2 breakpoint/watchpoint units
Error: fa526_change_to_arm: there is no Thumb state on FA526
Warn : ThumbEE -- incomplete support

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Sun May 05, 2013 1:51 am
by mlu
So now OpenOCD talks to your ARM_USB_OCD_H adapter but the adapter only gets 1's
back from the target. So its down to: check the cables, the power, the JTAG port pins,
try reducing adapter clock speed, make sure there is not code running on your target that uses
the JTAG pins as GPIO, any on board jumpers to enable/disable jtag.

Best of luck
Magnus

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Sun May 05, 2013 9:21 am
by sparkying
I tried reducing the adapter clock speed upto 0 but didn't help. The cables, JTAG port ( Arm 20pin 3.3V ) seems okay as far as I can tell. There is no external power source to the adapter. With the adapter clock 500kHz, openocd starts and allows gdb connection. But I couldn't do target reset. There are no jumpers on the board.
Code: Select all
(gdb) mon targets
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* cs351x.cpu         fa526      little cs351x.cpu         halted
This is my first time, so please bear with me as it's all new to me. How do I check if the target is running some code which maybe using the JTAG port as GPIO?

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Sat May 11, 2013 8:06 pm
by hsutherl
This begins to sound like a hardware problem. Since the JTAG adapter is talking to openOCD, the first suspect might be the target. But the JTAG adapter could have hardware problems on the target side. I suppose you could check for activity on TCK, TDO, and TDI with a scope (or with a DMM at low clock speed) for clues. But it is much easier if you can obtain either a known-good target or a known good interface.

Does the target have any power LEDs or anything? Any way to tell if it is working?

It could be target code hijacking the JTAG pins. You can usually hold the target in reset while starting openOCD to circumvent that. If the target has no reset button you can make do with a piece of bus wire. (You may have to have a friend start openOCD - or hit the enter key with your nose.) :wink:

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Sat May 11, 2013 10:39 pm
by sparkying
hsutherl wrote:This begins to sound like a hardware problem. Since the JTAG adapter is talking to openOCD, the first suspect might be the target. But the JTAG adapter could have hardware problems on the target side. I suppose you could check for activity on TCK, TDO, and TDI with a scope (or with a DMM at low clock speed) for clues. But it is much easier if you can obtain either a known-good target or a known good interface.

Does the target have any power LEDs or anything? Any way to tell if it is working?

It could be target code hijacking the JTAG pins. You can usually hold the target in reset while starting openOCD to circumvent that. If the target has no reset button you can make do with a piece of bus wire. (You may have to have a friend start openOCD - or hit the enter key with your nose.) :wink:
Thanks for taking time to reply. The target has a power LED on it and a reset switch. I've access to the serial console. The target is working. I suspect the target code is hijacking the JTAG. I tried earlier nSRST delay (100/500 ) earlier but didn't do openocd restart. I tried as suggested now( openocd fire up ) but maybe I'm not doing it right way. With the reset switch pressed over 3 secs, the target reset and more than 5 secs it does FRESET ( full reset ). Would you mind to suggest a proper sequence of actions here?

Many Thanks!

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Sun May 12, 2013 6:01 pm
by sparkying
FRESET seems the factory reset. The 20-pin JTAG connector has :-

nTRST, TDI, TMS, TCK, DBGACK - pulled up with 4.7K
TDO, nRST - No pull up/down resistors
RTCK, DBGRQ - pulled down with 4.7K

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Tue May 14, 2013 5:28 pm
by hsutherl
Hmm. I've no idea.

It does sound like the reset switch is a soft key rather than a hardware reset. So I guess there is still a chance that gounding either nTRST or nRST or both (not trivial to do with the JTAG adapter installed) while starting openOCD might do the trick.

Re: OpenOCD with Olimex ARM-USB-OCD-H

Posted: Thu May 23, 2013 6:39 pm
by sparkying
I tried with proper pull up and pull down ( 4.7K ) on the JTAG signals per ARM specifications but it didn't help. http://infocenter.arm.com/help/index.js ... 02s01.html

I think I have to look at each signal and see what's going on. Is there a good logic analyzer supporting JTAG protocol out there which someone can recommend?

Thanks