JTAGMKII and ATMEGA128L-8AI

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

Hi,

I try to use the JTAGMKII debug interface on ATMEGA128L-8AI (2,7V-5,5V version)

Clock: Ext cristal 3,864MHz.

I tryed different Target Clock freq and Com port settings with no effect.

The program is loading, but when running with the JTAGMKII connected the program restarts frequently, there are no flags set in MCUCSR. If i remove the JTAG itf the program runs without a problem.

I made a small testprogram to toggle one output.

It happens also that in AVRSTUDIO the program is stopped, but the output keeps toggling.

I have the impression that there is a compatibilitie error between ATMEGA128L-8AI and JTAGMKII.

In AVR Studio you kan select serveral ATMEGA128 Versions.
ATMEGA128, ATMEGA1280, ATMEGA1281, ATMEGA1284P, ATMEGA128A.

What is the difference between these versions?

I use also a ATMEGA128-16AU, with this processor there is no problem using the JTAGMKII.

With an ATMEGA162, also a 2,5-5V version, there is no problem using the JTAGMKII.

Has someone expierece with ATMEGA128L-8AI togheter with the JTAGMKII debug interface?

Thanks in advance,
Fabrizio

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

Have you turned off the Mega 103 compatibility fuse??

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I've spent a lot of time with the M128. It's NOT a 1280, those other parts are not "versions of the M128".

As John said, program the 103 compatibility fuse (on by default) to off. Then program the CKOPT fuse (on by default) to off.

Set the clock fuses for external crystal, low speed.

Just for grins, make sure that none of your hardware is using the I/O lines that the jtag connects to.

At that point, see how things look.

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

Thanks for reply's

The only Fuses marked are
- JTAGEN
- SPIEN
- EESAVE

SUT_CHKSEL
Ext Cristal/Resonator Low Freq startup time 16Kch +64

Is also tryed the High Freq startup Setting.

JTAG Pins are not double used.

Still the same result, with JTAGMK2 connected the processor restarts Frequently, there is no pattern,
there is nothing marked in the MCUCSR Flags.

The same program is working fine in debug mode on a ATMEGA128 (The 5V version)

I use the same testboard to debug an ATMEGA162 (3,7V target), without problem.

I need the ATMEGA128L-8AI because ATM162 is short of memory for my application.

I need two usarts.

To sumerize,
- We get restars on ATM128L when JTAGMK2 is connected in debug mode. Without JTAGMK2 there is no problem.

- Same JTAGMK2 is used to debug ATM128 & ATM162.

I will try to change the processor.

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

I tryed another processor.
On the case it is written ATMEGA128L-8AI

The signature byte = 98 02

This belongs to ATMEGA2561 !!!!!

I understand that ATM2561 is probably the replacement of ATM128L-8AI. But i asked for the 8AI type !!!!

I can try with a 3 processor.

Or i need to upgrade to ICCV7 compiler to handle the ATM2561

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

Very strange and nothing much anyone can do remotely.

Anyway if you need 2 USARTs and more memory you can just switch to the Mega324p or Mega644p or even the Mega1284. Unfortunately they are not pin compatible with the Mega162 but if you are prepared to go to the Mega128 then you have a few more choices.

Are you checking if the power supply droops when the JTAG is plugged in?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Have you checked the reset line?

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

The JTAG ICE is not powered from the Circuit, Vsupply, is unconnected on the Jtag interface connector. The JTAG is powered with an external power supply.

There is a pullup connected to the reset line and directly connected to the JTAG interface connector. No external resets are present.

I upgraded to ICCV7 compiler to handle ATM2561v. I have the impression that the processor is not restarting. I will check further and keep you updated.

If atm2561v is stable, then i will continue with this controller. VCC = 2,5 - 5V, he has 2 usarts and plenty of memeory.

Regards,
Fabrizio

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

The JTAGICE MKii probe VTref (pin 4) must be connected to the target Vcc. This is what the JTAGICE MKii level shifters use to to interface the MKii logic voltage level to the target logic voltage level. Also, is the "Indicates Target Power" JTAGICE MKii green LED illuminated? Do the other two MKii LEDs indicate normal operation?

The JTAGICE MKii probe Vsupply (pin 7) isn't connected inside the JTAGICE MKii.

fabrizio wrote:
There is a pullup connected to the reset line and directly connected to the JTAG interface connector. No external resets are present.
What is the value of this pull up? Did you try an external capacitor on the reset line as additional noise filtering?

If MCUCSR doesn't show any reset source, this typically means your software has crashed and there never was any reset. If VTref isn't connected then you are in real trouble and the MKii can't function correctly no matter what.

This thread reported the OCDEN fuse wasn't enabled causing strange JTAGICE MKii behavior:
https://www.avrfreaks.net/index.p...

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

Mike B wrote:
The JTAGICE MKii probe VTref (pin 4) must be connected to the target Vcc. This is what the JTAGICE MKii level shifters use to to interface the MKii logic voltage level to the target logic voltage level. Also, is the "Indicates Target Power" JTAGICE MKii green LED illuminated? Do the other two MKii LEDs indicate normal operation?

VTref is connected. The green led is ON.

What is the value of this pull up? Did you try an external capacitor on the reset line as additional noise filtering?

10K pullup. No extra capacitor present. I will add one 100nf

This thread reported the OCDEN fuse wasn't enabled causing strange JTAGICE MKii behavior:
https://www.avrfreaks.net/index.p...

Verry interresting Treat. Especially the last post added, that you need a strong 5V power supply when programing fuses on the target.

My Target is powerd with a Li-ION battery on the testboard were i have the problem. I should have mentioned it earlier. Probably this can be the reason
that the OCDEN fuse is not properly programmed in debug mode. I will look further in this direction.

Thanks for ALL reply's.

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

Quote:
you need a strong 5V power supply when programing fuses on the target.
??? That makes NO SENSE. I can understand this being an issue with a junk programmer but the JTAG Ice MK2 should work the same down to 1.8V.

From the JTAG Mk2 help file

Quote:
The level converter is designed to support target voltages from 1.8V to 5.5V.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

hi Js,

You are absolutely wright. Suppose, like in my case you have ATMxx working on 3,7V in a 3,7V environment. How can you connect 5V to program the debug Flags???

Anyhow i tried it but with the same result. Processor is restarting/crashing.

I found something that caused to problem.

A clocking problem is the cause of the problems i have.

Mike B. wrote

Quote:

"If MCUCSR doesn't show any reset source, this typically means your software has crashed and there never was any reset. "

I was sure about my program, because it runs on another processor without any problem. What could else cause a crash?

I changed for testing the clock source from external Cristal osc -> internal 1MHz osc.

The processor was not restarting/crashing anymore.

I changed even to internal osc 2 and 4 MHz, without any problem. The processor was running stable.

Then i changed back to external clock 3,6864MHZ AND I PROGRAMMED THE CKOPT FUSE.

-> The processor is running stable.

I switched back to 3,7V battery, and also here the processor is running stable with the JTAGMK2 connected.

Datasheet extract

Quote:

When CKOPT is programmed, the Oscillator output
will oscillate will a full rail-to-rail swing on the output. This mode is suitable when operating
in a very noisy environment or when the output from XTAL2 drives a second clock
buffer. This mode has a wide frequency range. When CKOPT is unprogrammed, the
Oscillator has a smaller output swing. This reduces power consumption considerably.

I measured the power consumption. With CKOPT programmed the ATM consumes +- 1ma more than with CKOPT unprogrammed.

What do you think about the fact the CKOPT 'Solved' the problem?

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

Quote:
What do you think about the fact the CKOPT 'Solved' the problem?
Not surprised at all even though it is supposed to work ok up to 8MHz with it unckecked.

Another user (David Van Horn) will swear by it and at it. :lol: it has been his personal crusade now for a while as he has had more strange problems with low power oscillators that you can poke a stick at.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly