AT91SAM9263 with JLink and openocd

Hello,

I am using OpenOcd on Windows XP 32bit. I can use JLink and OpenOcd with STM32 without problems. But I can not connect to AT91SAM9263 at all. I shrinked config file to following:

telnet_port   4444
gdb_port   3333

interface jlink

set  _CHIPNAME at91sam9263
set  _ENDIAN little
set _CPUTAPID 0x0792603f

# jtag speed. We need to stick to 16kHz until we've finished reset.
jtag_rclk 16

reset_config trst_and_srst separate trst_push_pull srst_open_drain

jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0x0f -expected-id $_CPUTAPID

jtag_nsrst_delay 300
jtag_ntrst_delay 200

#target configuration
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME arm926ejs -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm926ejs

scan_chain

If I try to connect, I am getting following:

Open On-Chip Debugger 0.4.0 (2010-02-22-19:05)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.berlios.de/doc/doxygen/bugs.html
RCLK - adaptive
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
jtag_nsrst_delay: 300
jtag_ntrst_delay: 200
   TapName             Enabled  IdCode     Expected   IrLen IrCap IrMask
-- ------------------- -------- ---------- ---------- ----- ----- ------
 0 at91sam9263.cpu        Y     0x00000000 0x0792603f     4 0x01  0x0f
Info : J-Link initialization started / target CPU reset initiated
Info : J-Link ARM V8 compiled DEC  1 2009 11:42:48
Info : JLink caps 0xb9ff7bbf
Info : JLink hw version 80000
Info : JLink max mem block 9576
Info : Vref = 3.274 TCK = 1 TDI = 0 TDO = 1 TMS = 0 SRST = 0 TRST = 0

Info : J-Link JTAG Interface ready
Error: jlink_usb_message failed with result=1)
Error: jlink_tap_execute, wrong result -107 (expected 1)
Info : RCLK (adaptive clock speed)
Error: jlink_usb_message failed with result=1)
Error: jlink_tap_execute, wrong result -107 (expected 1)
Error: jlink_usb_message failed with result=1)
Error: jlink_tap_execute, wrong result -107 (expected 1)
Command handler execution failed
Warn : jtag initialization failed; try 'jtag init' again.

debug looks like following:

Info : 154 750 jlink.c:306 jlink_init(): J-Link JTAG Interface ready
Debug: 155 750 jlink.c:451 jlink_reset(): trst: 0, srst: 0
Debug: 157 766 core.c:1523 jtag_khz_to_speed(): convert khz to interface specific speed value
Debug: 158 766 core.c:1527 jtag_khz_to_speed(): have interface set up
Error: 159 797 jlink.c:967 jlink_usb_message(): jlink_usb_message failed with result=1)
Error: 160 797 jlink.c:790 jlink_tap_execute(): jlink_tap_execute, wrong result -107 (expected 1)
Debug: 161 813 core.c:1523 jtag_khz_to_speed(): convert khz to interface specific speed value
Debug: 162 813 core.c:1527 jtag_khz_to_speed(): have interface set up
Info : 163 813 core.c:1353 jtag_interface_init(): RCLK (adaptive clock speed)
Debug: 164 813 openocd.c:122 handle_init_command(): jtag interface init complete

Debug: 165 813 command.c:133 script_debug(): command - ocd_command ocd_command type ocd_jtag init
Debug: 166 828 command.c:133 script_debug(): command - ocd_jtag ocd_jtag init
Debug: 168 828 tcl.c:854 handle_jtag_init_command(): Initializing jtag devices...
Debug: 169 828 jlink.c:451 jlink_reset(): trst: 0, srst: 0
Debug: 170 828 core.c:672 jtag_add_reset(): SRST line released
Debug: 171 828 core.c:697 jtag_add_reset(): TRST line released
Debug: 172 828 core.c:321 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 174 1375 command.c:133 script_debug(): command - ocd_command ocd_command type ocd_jtag arp_init
Debug: 175 1375 command.c:133 script_debug(): command - ocd_jtag ocd_jtag arp_init
Debug: 176 1391 core.c:1364 jtag_init_inner(): Init JTAG chain
Debug: 177 1391 core.c:321 jtag_call_event_callbacks(): jtag event: TAP reset
Error: 178 1422 jlink.c:967 jlink_usb_message(): jlink_usb_message failed with result=1)
Error: 179 1422 jlink.c:790 jlink_tap_execute(): jlink_tap_execute, wrong result -107 (expected 1)
Debug: 180 1422 command.c:133 script_debug(): command - ocd_command ocd_command type ocd_jtag arp_init-reset
Debug: 181 1438 command.c:133 script_debug(): command - ocd_jtag ocd_jtag arp_init-reset
Debug: 182 1438 core.c:1451 jtag_init_reset(): Initializing with hard TRST+SRST reset
Debug: 183 1438 jlink.c:451 jlink_reset(): trst: 1, srst: 0
Debug: 184 1453 core.c:692 jtag_add_reset(): TRST line asserted
Debug: 185 1453 jlink.c:451 jlink_reset(): trst: 1, srst: 1
Debug: 186 1453 core.c:667 jtag_add_reset(): SRST line asserted
Debug: 187 1453 jlink.c:451 jlink_reset(): trst: 0, srst: 1
Debug: 188 1453 core.c:697 jtag_add_reset(): TRST line released
Debug: 189 1469 core.c:321 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 190 1688 jlink.c:451 jlink_reset(): trst: 0, srst: 0
Debug: 191 1688 core.c:672 jtag_add_reset(): SRST line released
Debug: 193 2016 core.c:1364 jtag_init_inner(): Init JTAG chain
Debug: 194 2016 core.c:321 jtag_call_event_callbacks(): jtag event: TAP reset
Error: 195 2047 jlink.c:967 jlink_usb_message(): jlink_usb_message failed with result=1)
Error: 196 2047 jlink.c:790 jlink_tap_execute(): jlink_tap_execute, wrong result -107 (expected 1)
Debug: 197 2047 command.c:620 run_command(): Command failed with error code -4
User : 198 2063 command.c:824 openocd_jim_vfprintf(): Command handler execution failed
User : 201 2063 command.c:824 openocd_jim_vfprintf():
User : 203 2063 command.c:824 openocd_jim_vfprintf():
Warn : 204 2063 openocd.c:137 handle_init_command(): jtag initialization failed; try 'jtag init' again.

If I try GDB server from Segger, it gets connected without problems. Does anybody have a clue, what is the problem ? I would use Openocd as I have configuration of SDRAMC etc. So for me it is enough to run main() from the SDRAM in the debugger…

I have some update. I run logic analyzer and noticed that Segger GDB server does not use nor nSRST neither nTRST during JTAG init. And Segger SW connects to target MCU properly. Just after RESET, I am getting zero on TDO.

If I desoldered nSRST and nTRST, now I can connect to the AT91SAM9263. But do not understand, why. Can TDO signal be disabled after RESET ?

“reset_config” does not work properly for JLink interface in my version of OpenOcd. Even if I use “reset_config none”, on LA I see that RESET signals are both used with some default values. Is it repaired in some newer version of OpenOcd ?

Thank you for feedback.