CAN WE USE JTAGICE MK-II for programming Mega48 ?

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

Can we use JTAGICE MK-II for programming Mega48.

Is any emulator for Mega48 available other than Jtagice Mk-II.

Thanks

Fascinating Mega AVR series

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

You can use the JTAGICE to program the Mega48 - if the JTAGEN fuse is programmed.

Dave

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

The fuse is called DWEN. DebugWire Enable

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

jonhelge wrote:
The fuse is called DWEN. DebugWire Enable

Oops - my bad; you're absolutely right. I had assumed that the Megas all had JTAG. It looks like the Mega48 is different in this respect. Sorry for the misinformation.

Dave

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

Quote:
The fuse is called DWEN. DebugWire Enable

Can you program with DW? I was under the impression that you cannot, as when I asked at the Atmel seminar a while ago they told me it was impossible to program with DW.

-Colin

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

c_oflynn wrote:

Can you program with DW? I was under the impression that you cannot, as when I asked at the Atmel seminar a while ago they told me it was impossible to program with DW.

Good question. Full disclosure: I haven't fired up my MarkII and/or DebugWire yet for my Mega48 apps.

The datasheet says (paraphrased):

Quote:

debugWIRE On-chip Debug System (page 246 in Rev. D datasheet)
... Programming of Non-Volatile Memories
... and to program the various non-volatile memories.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Mon. Oct 25, 2004 - 09:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dharper wrote:
jonhelge wrote:
The fuse is called DWEN. DebugWire Enable

Oops - my bad; you're absolutely right. I had assumed that the Megas all had JTAG. It looks like the Mega48 is different in this respect. Sorry for the misinformation.

Dave


Wheter an AVR has JTAG inteface or not depends on the number of pins and FLASH size of the AVR.
Many of the newest (and smaller) AVRs doesn't have JTAG. Attiny13, Attiny2313, ATmega48/88/168 doesn't have JTAG, but a the new pin saving debugWIRE interface instead.

JTAG: Supported by AVR devices with 16K or more Program Memory and 40 or more pins.

debugWIRE: Supported by new AVR devices with up to 16K Program Memory and 32 or fewer pins.

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

The MkII doesn't remove the content in the flash when you end a debug-session. I have experienced that the program still run on the part when you take away the MkII. I don't know what happens if you end the session with breakpoints set though.

But you need ISP to enable debugwire, so you can't get rid of the ispheader anyway

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

But it's still not possible to program through debugWire after it's enabled is it?

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

AndersAnd wrote:
But it's still not possible to program though debugWire after it's enabled is it?

The Mega48/88/168 datasheet says that you can program--see my parapharasing above.

The Tiny2313 datasheet says the same:

Quote:
The debugWIRE On-chip debug system uses a One-wire, bi-directional interface to control the program flow, execute AVR instructions in the CPU and to program the different non-volatile memories.

However, the mkII Quick Start Guide seems to support your observation:
http://www.atmel.com/dyn/resourc...

Quote:
The JTAGICE mkII does not support ISP as a general programming interface, but has got limited ISP support for handling the DWEN fuse and Chip Erase.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Yes, you can programmed Mega48 with debugWire. The code will be downloaded (programmed) to the flash everytime you run debug in studio when you are debugging using debugWire and if you exit studio at any time, the content of the flash stays. All you have to do is cycle the target power.

The drawback is that you are pretty much stuck with debugWire because you cannot use isp anymore to program the flash or fuse. The only way to re-enable isp is through high voltage parallel programming method which sucks if your target is QFP.

According to the manual you are supposed to be able to re-enable isp by disabling debugWire from debug menu of studio but I have never got it to work. I also read some conflicting information regarding the ability to re-enable isp.

Has anybody successfully re-enable isp using debugWire?

TJ

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

The JTAGICE mkII has limited SPI functionality, allowing it to enable the debugWIRE interface when you start a debug session (assuming SPI is enabled, which I believe is default). You can also disable debugWIRE (reverting back to SPI) when you're done, using the options dialog. High voltage programming is not required for this.

You are limited to modifying the DWEN fuse, and lockbits can't be modified. Thus it is not a complete programming tool for debugWIRE devices at the moment.

Tore
mkII software guy

Last Edited: Tue. Oct 26, 2004 - 05:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tolsen2 wrote:
The JTAGICE mkII has limited SPI functionality...

I guess you mean ISP and not SPI?

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

SPI and ISP are often interchanged, and I admit I'm not 100% sure when to use which.

As I understand it, ISP means In-System Programming, which describes a feature in the MCU, while SPI is referred to as the "SPI programming mode" or "Serial Peripheral Interface", or even "serial SPI bus". Thus, SPI can be used for doing ISP.

JTAG is another way of doing ISP, so I think it would be wrong of me to write that the JTAGICE mkII has limited ISP functionality (well, it is limited but only when using SPI).

Tore

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

Well, you can't have any SPI™ (Serial-Peripheral-Interface) functionality at all, with only one wire as the debugWire has, but you can have some ISP functionality, as ISP just means In-System Programming or In-System Programmer.
SPI is a trademark of Motorola (now Freescale Semiconductors), just as I²C is a trademark of Philips and Microwire is a trademark of National Semiconductor. SPI is a serial interface that requires 2-4 pins; it requires both clock singnal, data in and/or data out, as well as slave select in some cases. So to send SPI data you need at least a clock and a data wire, which is why you can't have any SPI functionality, with one wire interfaces such as debugWire. But it should be possible to implement some kind of ISP with only one wire.
So there's a big difference between SPI and ISP, allthough ISP is often implemented at the SPI interface; but ISP could also be inplemeneted with other interfaces such as JTAG, debugWire or another interface.

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

That is what is described in the manual (referring to re-enabling isp w/ debugWire) Unfortunately it does not work the way as described in the manual, at least it does not work for me :( and I did try many times.
Can anyone confirmed that debugWire is able to re-enable isp? :idea:

TJ

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

atmelavr wrote:
Can anyone confirmed that debugWire is able to re-enable isp?

Yes, but only if the ISP fuse is enabled. The "ISP reenable" is really a "DWEN disable".

-Geir

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

Waw, it won't work for me.. :? :?:

Here is what my setup:
Mega48-dip with internal rc enabled (8Mhz)
stk500
ISP is enabled.
No protection.
Verify & check squid cable connections.

What could be wrong? :roll:

TJ

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

Did you remember to reconnect the reset jumper on the STK500?

-Geir

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

Yes, I did.

TJ

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

As per the JtagIce-MK-II manual, I think it doesn't support ISP programming - Confusion still prevails

Fascinating Mega AVR series

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

The MK II downloads the program every time to debug it. So it is automatically programming the AVR. You will be able to disconnect the MK II and the AVR will still run with the last programmed code.
To turn the Debug wire off you need to go into the MK II option menu under the debug menu. It pops up a page where you can click a button to disable debug wire.
Then you can program the AVR with an ISP programmer.
You will need to do this if you wan to change fuses, because you cannot when the debug wire is enabled.

Hope this helps.

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

Okay, say you've used ISP (on a stk500) or the JTAGICEmk2 to enable the Debugwire fuse (DWEN), and now you want to go back to ISP to change a different fuse (which is the only reason I can see to go back).

What no one has mentioned, is that this jtagice2 option to re-enable the debug wire WILL NOT APPEAR unless you are in debug mode using the debugwire! I went through this last night at home, and found the solution is to load a COF file for the mega48 (that I make using the extcoff target in the most recent winavr gcc distribution). After loading this COF file, you can find the JTAGICEmk2 options under the DEBUG menu (not under the tools menu as the documentation erroneously states).
If you are not in debug mode (and you cant get in debug mode unless you load a COF file) the JTAGICEmk2 options DOES NOT APPEAR!.

Hopefully the next people that have this problem will find this posting.
Brynn

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

atmelavr wrote:
Yes, you can programmed Mega48 with debugWire. The code will be downloaded (programmed) to the flash everytime you run debug in studio when you are debugging using debugWire and if you exit studio at any time, the content of the flash stays. All you have to do is cycle the target power.

The drawback is that you are pretty much stuck with debugWire because you cannot use isp anymore to program the flash or fuse. The only way to re-enable isp is through high voltage parallel programming method which sucks if your target is QFP.

According to the manual you are supposed to be able to re-enable isp by disabling debugWire from debug menu of studio but I have never got it to work. I also read some conflicting information regarding the ability to re-enable isp.

Has anybody successfully re-enable isp using debugWire?

TJ

Re-enabling ISP works fine with the Tiny2313, at any rate.

Leon

Leon Heller G1HSM