Electrical – JTAG, OpenOCD and Atmel SAM3X

atmelcortex-m3jtagopenocd

I'm trying to set up OpenOCD debugging through a JTAG port on a custom board with an Atmel ATSAM3X8E microcontroller.

OpenOCD is running on a Raspberry Pi using the bcm2835 native GPIO. The JTAG port of the SAM3X is broken out to a header – it has NRST, TCK, TMS, TDI, TDO, GND and 3.3V on it. NRST is pulled to 3.3V through 100k, while the others are directly connected.

OpenOCD comes with a target called at91sam3ax_8x.cfg which looks like it ought to be the right thing to use, but it seems to bear no resemblence to the part I'm using. That target script expects the device's TAPID to be 0x4ba00477, while the device I have reports 0x05b2b03f as its TAPID (and this matches what's in the SAM3X datasheet). Once I've fixed that, the IR check then fails (it expects 0x1 but sees 0x9). Having fixed that, this is then the output I get from OpenOCD:

Open On-Chip Debugger 0.10.0+dev-00093-g6b2acc0 (2017-03-17-16:47)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html
BCM2835 GPIO config: tck = 11, tms = 25, tdi = 10, tdo = 9
BCM2835 GPIO config: srst = 7
srst_only separate srst_gates_jtag srst_push_pull connect_deassert_srst
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
adapter speed: 500 kHz
RCLK - adaptive
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
cortex_m reset_config sysresetreq
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : JTAG only mode enabled (specify swclk and swdio gpio to add SWD mode)
Info : RCLK (adaptive clock speed) not supported - fallback to 10 kHz
Info : JTAG tap: sam3.cpu tap/device found: 0x05b2b03f (mfg: 0x01f (Atmel), part: 0x5b2b, ver: 0x0)
Error: Invalid ACK (7) in DAP response
Error: JTAG-DP STICKY ERROR
Error: Invalid ACK (7) in DAP response
Error: JTAG-DP STICKY ERROR
...repeated about 40 times...
Error: Could not initialize the debug port

What's going on here? Is there something wrong with my setup? Or is the AT91SAM3AX a different part to the ATSAM3X that I'm using?

Best Answer

Indeed, it is different.

But at91sam3XXX.cfg in recent versions of OpenOCD explicitly lists your SAM3X8E as supported.

This is presumably already present in your installation, probably right next to the mismatching file you are using.