On-Chip-Debugging/Programming through JTAG on the Yun is not working

Hi all,
After a lot of trial and error and reading, I am running out of ideas how to make OCD work through JTAG on the yun! I hope some of you, more experienced users, could help me see what I am doing wrong?

What I am trying to do?
I am trying to debug a project by using on-chip-debugging through a JTAG connection with the following setup

  • Arduino Yun
  • Atmel Studio 6.2.1153
  • AVR Dragon (Firmware Version 7.26, Hardware Version 17):
  • ATmega fuses setup (these should be correct esp. JTAGEN and OCDEN):
BODLEVEL 	= 2V6
HWBE 		= [ ]
OCDEN 		= [ ]
JTAGEN 		= [ ]
SPIEN 		= [X]
WDTON 		= [ ]
EESAVE 		= [ ]
BOOTSZ 		= 2048W_3800
BOOTRST 	= [X]
CKDIV8 		= [ ]
CKOUT 		= [ ]
SUT_CKSEL 	= EXTXOSC_8MHZ_XX_16KCK_65MS

EXTENDED 	= 0xFB (valid)
HIGH 		= 0xD8 (valid)
LOW 		= 0xFF (valid)
  • ATmega lockbits setup (these should also be correct like this):
LB 	= NO_LOCK
BLB0 	= NO_LOCK
BLB1 	= NO_LOCK

LOCKBIT = 0xFF (valid)

What goes wrong?
When trying to read the target device (the yun), I get the following error:

[ERROR] JTAGID not valid. Debugger command enterProgMode failed., ModuleName: TCF (TCF command: Device:startSession failed.)

And this is a screenshot of it:

As you can see, it does read the voltage, but fails to start the debug session?! And more specifically, the programming, because I get the same error when I try to start it even without debugging.

Why I think it should work?
In theory:

In practice:

  • my Dragon is working properly because, In-System-Programming (through the ISP header) is working fine. I am able to read out the voltage, the memory, fuses etc and reprogram. (that is how i obtained the settings mentioned above).
  • the Yun itself (and thus the ATmega) is also working properly because I have been able to program it both from Atmel Studio and Arduino IDE with different projects/sketches and they all run fine
  • the wires are also not at fault because I used the same wires for the ISP connection and that worked. In addition, I have quadripple checked the pin connections of both ends of the JTAG connection

In my efforts, I have also tried a number of different setups, none of which worked:
= powering the yun in 3 different ways - the usb, the dragon Vcc, an external regulated power supply. In all three cases the error remains the same
= varied the JTAG clock speeds anything from 32kHz (lowest possible) to 250kHz (should be lower than 1/4 the board clock speed)

I hope you can help me out with what I'm doing wrong or should try next?

Cheers,
Anguino

1 Like