Dragon can see the mega168 but not debug it

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I got my Dragon, and built a headder so it can plug into a breadboard. But cannot find how to get into debugwire mode and back...
1. Plugged in the dragon, installed the drivers automatically for Win7.
2. Launched AVR Studio, and upgraded the Dragon (which I mounted in a box to prevent any 'issues'.
3. Connect up target and try get into debug mode, chip is detected fine, and then I remember the DWEN fuse - OK, use the programmer screen to set DWEN, and cycle the target power... but that leaves me with a dead chip, so I swap another atmega168 in.
4. OK, try the demo program, build, then require about 5 mouse-clicks just to download, Download and verify, program OK.
5. Start debug,,, get cryptic error message
6. Cycle target power
7. Start debug,,, get message:
Failed to launch debug session with debugWIRE. THis could be caused by reset line circuitry or disabled debugWIRE interface. Make sure that the reset line is free before continuing. Do you want to use SPI to enable the DWEN fuse?

I had to go through above steps incorrectly a few times for some reason, the upshoot is it's working now.

Solved:
1. If using debugWIRE with the Dragon, there is no need to make a special 3-pin header.
2. You do not have to start out in ISP mode, but do need to disconnect the ISP, cycle the power on the target, and then re-connect the ISP when changing into ISP or DW. If you do not disconnect the target, the fuse will not take effect.
3. I suggest only having filter caps on the target, and nothing more than 10uF so it the target will discharge.
4. AVR Studio has a totally separate deliberate step for downloading, you have to select your programmer, then verify the chip is the one you expect, then select the hex file, and then hit the "program" flash button, Flashing is not a one-click affair!
5. After a debug session, you can leave the target in DWEN mode unless you want to download again.

This story has a happy ending, I just had to share and encourage others to just perservere a little longer.

Conrad Braam - www.softcircuitry.blogspot.com - www.plcsimulator.org
Always start off poorly, that way when you finally figure it out, you can get a few surprise hits in.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have the same problem but I couldn't solve it.
I've tried to use STK600, I've tried to connect Dragon directly to MCU pins without any capacitors. I've tried different frequencies. All my attempts were failed. Every time I've seen the same message - failed to launch ... with debugwire.
I've tried to use Dragon connected to STK600+ATmega2560 via JTAG. I can program the MCU but I can't debug. I see the same message about debugwire even with JTAG.
I'll be grateful if somebody helps me

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
All my attempts were failed.
Are you using Studio 5? I have no problems with DW and the Dragon with Studio 4.18.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I'm using Studio 5.
I agree, the new version could be reason of problem. But it strange that Dragon does not work properly even with JTAG. As for me it's too severe error for the commercial release.

I'll try Studio 4.18

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

See many, many threads about this serious AS5 bug in the AS5 forum - it simply cannot be relied on to do debugWire with a Dragon. All your problems will go away if you switch to 4.19 and wait until they finish developing AS5.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have not tried a ATmega2560, but the Dragon should debug all AVR chips under Studio 5. Both debugWire and JTAG. If downloading code to your chip works, you must have correctly connected the ISP / dW / JTAG lines.

There is an issue with 'disabling debugWire' if the Dragon is powering your target. Simply use external power for the target.

There are many 'features' of Studio 5 and the way it compiles code. The debugging experience is fairly pleasant.

You may feel 'safer' with Studio 4.18. It is stable and works.
I understand that v4.19 has its own set of 'features'. I cannot remember the details, and have chosen to continue with 4.18.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks a lot for advises.

I didn't find Studio 4.18. I've downloaded Studio 4.19 from Atmel's site. It was necessary to downgrade Dragon's firmware to work with Studio 4.19. The result was 50% successful. JTAG works, DW doesn't work.
Then I've tried to return back to Studio5. The result was the same - JTAG works, DW doesn't work.
Probably my Dragon has some internal bugs.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVRstudio 4.19 is 4.18 with service packs installed. You're golden.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
AVRstudio 4.19 is 4.18 with service packs installed
But doesn't the "toolchain" whatever that is :? come with 4.19? Are you forced to use it? Can you do without it? Is it an additional package to D/L?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

But doesn't the "toolchain" whatever that is Confused come with 4.19?

No.
Quote:

Are you forced to use it?

No.

The one annoying thing about the 4.18 and 4.19 is that if your PC has both WinAVR and Toolchain installed (separately) then when you start a new GCC project it uses Toolchain in preference to WinAVR so you have to remember to change it back for each new project.