Issue with JTAG-ICE and ATtiny24A

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

I am modifying an existing ATtiny13A design to the ATtiny24A. I updated the JTAG-ICE firmware to Version 7.25 and connected it to the 24A on a breadboard using only the 6 wire ISP interface. Running Atmel Studio 6, through the Device Programming window, I set the ISP Clock, read the target voltage and device signature with no problems. The lock bits are set to NO_LOCK. When I select fuses and check DWEN, the green circle next to DWEN turns yellow. When I select program, I get an error window, "cannot enter programming mode". After this happens the device signature disappears and cannot be read again even after cycling power and reloading Studio 6. I tried another 24A and got the exact same sequence. I would greatly appreciate some advice.

This topic has a solution.
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

and check DWEN

Never do that! Just enter into a debug session and let Studio handle the DW fuse and FOLLOW the prompts.  Once you have finished debug (a minute, an hour or a year) disable DW from WITHIN the debug session.

 

Once the chip is in DW mode you can no longer use ISP until you exit DW as above.

 

You don't need to program or reprogram code with ISP while in DW mode as it handles the chip programming when you "Start debug".

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Sat. Oct 4, 2014 - 02:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are correct. Thank you very much. The Atmel FAE that told me that faulty procedure also told me the 3 wire debug doesn't work unless all 6 ISP wires are connected. Is that true?

Thanks again.

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

unless all 6 ISP wires are connected. Is that true?

You only need all 6 wires to enter and exit DW mode. Once in DW you only need GND, VCC and reset.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Hi,

All was well yesterday. Today I attempted to see what you meant by "Once you have finished debug (a minute, an hour or a year) disable DW from WITHIN the debug session", but I could not get back into debug session.

I loaded my project, went to debug, was prompted to connect ICE, and got the attached error message. I also tried the device programmer window and got the same error message. Still need your help?

 

Am I correct in assuming the chip needs to have DW disabled so that it can later be ISP programmed? If so, how do I disable DW from within the debug session?

 

Thank you.

 

 

Attachment(s): 

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

the chip needs to have DW disabled so that it can later be ISP programmed?

Correct.

how do I disable DW from within the debug session?

From Debug go to  JTAG-ICE options, you should find a "Disable DW" button. I don't have a JTAG-ICE or use AS6 so it may be a little different.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Ok a little confused here..... You say you are using a JTAG-ICE but the photo shows a JTAG-ICE Mk2? Which one do you have? And is it a real Atmel unit?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

My mistake. I am using JTAG-ICE MK2. It is an original Atmel unit, H/W version 0 (serial # starts with A).

I see the "disable debugwire" option but it is grayed out and I still cannot get into debug.

When I select "start debugging" I get the attached.

 

Just to clarify, I am NOT:

1. Selecting TOOLS

2. Selecting DEVICE PROGRAMMING

3. Applying JTAGICE MK2

4. Reading Target Voltage

5. Reading Device Signature

6. Setting ISP Frequency

 

Instead, I am:

1. Loading project

2. Selecting DEBUG, Start Debugging

3. At this point yesterday, I was prompted to connect a device. I would select JTAGICE MK2, set ISP Frequency, and enter. There were no requests to read target.

4. When I do 1 & 2 now, there is NO prompt to connect a device. Instead I get the attached error message.

 

Thank you.

Attachment(s): 

Last Edited: Sun. Oct 5, 2014 - 03:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Selecting DEBUG, Start Debugging

Does your code compile correctly before this step? ie is it producing .hex and .ELF files?

set ISP Frequency,

I never seen that bit.

When I do 1 & 2 now, there is NO prompt to connect a device.

I guess that's because the project has now a debugger linked to it.

Instead I get the attached error message.

That's strange as the JTAGICE MK2 is a DEBUGGER. However I see that the screen shot is talking about ISP which is NOT what you want to do, so maybe you are still doing something wrong.

 

So basically what you need to do:

 

Compile your code.

When "no errors" are reported then start a debug session with all 6 wires the first time around and follow the prompts. (If no prompts to enable DW are issued then the chip is already in DW and you can just use the 3 wires as above. No problems leaving the 6 wires connected unless you need to use the SPI.)

 

Edit By the way make sure that the JTAG is on before the target is on and before you start debug. Of course your target needs it's own power supply as it is not provided by the JTAG.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Sun. Oct 5, 2014 - 09:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The code assembles without error however there is NO .elf file.

It is strange if an .elf is required because after you first advised me, I did get into debug and successfully setup and used the a/d converter.

I watched the Atmel video on creating an .elf file, but it only shows a compiler version, not assembler. The video does show connecting the JTAGICE MK2

using the Device Programmer, and reading the target voltage and signature. I did this once successfully prior to speaking with you, and I was able to

read the signature correctly. Since then, I have tried 3 more brand new chips going straight to debug mode as advised and got attached errors cap0 & cap1.

I tried to connect through Dev Prog as shown in the Atmel video and I get an error reading the signature, cap2.

 

1) If the missing .elf file is my problem, perhaps you can advise on how to activate that function. Is it a post-build option?

2) Do you think it would be of any value to ask the Atmel FAE to look up the error messages I am getting?

 

Thank you very much for your assistance. I have been programming & debugging microcontrollers since the 8048 in the mid 70's, but I am clearly struggling

to get the AVR environment setup.

 

 

Attachment(s): 

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

I tried to connect through Dev Prog as shown in the Atmel video and I get an error reading the signature, cap2.

You cannot do device programming while in DW mode. Anyway the ISP frequency is far too high , set it at 125KHz to be safe instead of 1MHz once you manage to  exit DW.

 

So you are using the GCC assembler and not the Atmel assembler, not too sure how different the outputs are but it seems to generate all the necessary files for debugging.

 

The ELF file is something of a new thing and it is not generated by the Atmel assembler so it may not be necessary. cap0 & cap1 are not showing any errors as far as I can see.

 

Unfortunately my JTAG Mk2 is only allowed to work with AS4 so I may not be able to help further, perhaps someone with JTAG Mk2 connected to AS6 may be able to shed more light.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I was thinking about what you said regarding there is a debugger attached to the project and wondered if it had an error.

I erased the project and started a new one, attached the MK2 in debugwire mode. It is working consistently now.

 

I am using the Atmel assembler and cannot find any .elf files, apparently debug works without it.

 

Thanks so much for all your knowledge and help.

 

 

Last Edited: Mon. Oct 6, 2014 - 08:55 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AFIK,   the AS4 ad AS6 debuggers can work with several formats. e.g.

 

OBJ         from Atmel Assembler.

ELF         from GCC Compilers, Assembler

COFF      from Codevision, Bascom, Imagecraft, ...

UBROF8  from IAR tools

 

I presume that the debugger parses the file to get the necessary information into its own format.

And you see the results.

 

I really would not lose any sleep over it.     Just use your Assembler as intended.

 

David.

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

Yes, apparently AS6 is using the obj file.

My main problem was something was stored incorrectly when the device was attached to the project preventing debugwire from working.

Erasing and re-creating the project and re-attaching the device cleaned things up.

Thank you.

 

Ron