ATMEGA644p Can't connect through JTAG

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

Hi all,

 

 

I'm trying to connect through JTAG for the first time with a new Atmega644p.

When I load a simple blinking led  program into the MCU it seems nothing happens. Then  when I start the debugger I get the following message:


 

 

I have no idea what happens. 

It's the first time I'm testing this layout, So I connected a 16Mhz clock to the MCU.

 

When I go through the setting of the MCU, I setted these:

 

 

Anybody an idea what goes wrong?

 

Kind regards,

Toon Mertens

 

This topic has a solution.
Last Edited: Sat. Mar 18, 2017 - 10:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So I connected a 16Mhz clock to the MCU.

But you still have the CKDIV8 fuse enabled so you are running at 2MHz at best,

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

that's true, my bad, I changed it but still no success

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

So you can program but not debug using the Atmel ICE?

 

Have you set the ICE as your debugger in the project's properties?

 

Do you have the reset pin wired up in the JTAG header? Sometimes it helps.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

No I can't program as well. 

When I try to program the MCU, nothing happens. In my program I set PD4 high. when I measure on this pin it stays low.

But I got no error at all.

 

Then when I try to debug I get the message as described above.

 

Yes the Reset pin is connected to the MCU.

 

Kind regards

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

No I can't program as well

WHAT?? How did you program the fuse then??

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Thats the strange thing. I can program the fuses without any problem, but when I run this program, nothing happens.

I'm getting crazy! maybe I should take a nap first and start after again.

 

 

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

but when I run this program,

What program? Does it assemble/compile correctly? Do you select the correct ELF or hex file to program?

 

Post your code using the code tags <> next to the Omega letter.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Hi,

 

This is the code 

 

#ifndef F_CPU
#define F_CPU 16000000UL // 16 MHz clock speed
#endif

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
	DDRA = 0b00000001; 
	while(1) 
	{
		PORTA = 0b00000001; 
	}
}

 

Following images are printscreens of the settings I use.

Below you can see that I'm using the Atmega644p. Now the complete number is Atmega 644p-A15AZ. I don't think this is the problem, or is it?

 

 

 

So I can verify the target voltage ...

 

Following is the tool information

 

These are the fuses

 

 

Lockbits

 

 

production file

 

 

I'm a beginner with this, so maybe I made a mistake somewhere here?

 

 

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

You have killed your clock by selecting external clock, maybe you can change the fuse back with jtag but we don't know anything about your board to advice any further.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

PORTA must be powered by AVCC. If AVCC is not connected, PORTA will not work.
.
Note that your program would not do anything anyway. Either write to PINA to toggle a pin or XOR the PORTA to do the toggling.
I would add a delay so that you can see an LED for reassurance.
.
David.
.
Edit. Yes, you can program with JTAG without a clock. The program can not run without a clock. Restore the Internal 8MHz RC to get back to life. If you have a crystal, you set the fuses for crystal oscillator. If you have an external clock module, these normally have 4 pins.

Last Edited: Sat. Mar 18, 2017 - 09:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How do you mean, killed your clock?

 

This is the connection to the microcontroller.

 

 

 

This is the connection to the jtag connector.

 

 

Now I tested this schematic with an Atmega16 without any problem. With Atmega644p I can't find the solution.

 

 

 

 

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

As js said.   You have select EXT Clock (clock modules have 4-pins).   Your schematic shows a crystal (2 pins)
 

You can kill an ATmega16 in exactly the same way.  i.e. by selecting EXT CLOCK.

 

You can recover by changing the fuses for XTAL OSC or RC via JTAG.

 

David.

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

Hi guys,

 

Problem solved thanks for the explanation!!

 

Kind regards,

Toon Mertens