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)
- JTAG ribbon connection from the Dragon to the Yun:
For the details refer to http://www.atmel.com/webdoc/avrdragon/avrdragon.section.wpr_osd_lc.html and http://www.arduinopassion.com/wp-content/uploads/2013/12/yun-pinout.pdf
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:
- the ATmega32u4 supports OCD through JTAG (http://www.atmel.com/Images/Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Summary.pdf)
- the Yun is wired to support the connection to the required signals too
- the Dragon supports JTAG programming and debugging on the ATmega32u4 (http://support.atmel.no/knowledgebase/avrstudiohelp/mergedProjects/AVRDragon/AVRDragon_Device_Support.htm)
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