patchAVR Downloader/UploaDEr - Patches: patch #7876, JTAGICE mkII fails to connect to...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #7876: JTAGICE mkII fails to connect to attiny if debugwire is enabled AND target has a very slow clock

Submitter:  Malte <damaltor>
Submitted:  Fri 26 Oct 2012 07:39:44 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  joerg_wunsch Open/Closed:  Closed

Fri 17 May 2013 04:26:18 PM UTC, comment #3: 

I tried it with an ATtiny4313 mounted in an STK500.  I could not
really recover from a too slow clock, because I always ran into a
"debugwire sync failed" situation.  Had to use HVPP to recover the
chip.

Anyway, I think it's a good idea to retry with ISP immediately, so
I added the patch.  I added a "safety belt" retry counter to avoid
the situation where it infinitely goes back and forth.  I also added
a similar change to stk500v2.c for the JTAGICE3.

Joerg Wunsch <joerg_wunsch>
Group administrator
Fri 17 May 2013 11:13:41 AM UTC, comment #2: 

I hate nabble, really.  They are presenting other people's
content, but no reference to the original discussion, not
even a timestamp. :-((

FWIW, here's the link to our own mailinglist archive:

http://lists.nongnu.org/archive/html/avrdude-dev/2010-12/msg00001.html

Joerg Wunsch <joerg_wunsch>
Group administrator
Fri 26 Oct 2012 07:44:19 PM UTC, comment #1: 

Also, i forgot to mention that the idea came from here:
http://avr.2057.n7.nabble.com/Dragon-DW-gt-ISP-USB-reset-question-td4.html
so, kudos go to John McCorquodale.

Malte <damaltor>
Fri 26 Oct 2012 07:39:44 PM UTC, original submission:  

It is impossible to connect to attiny targets under said circumstances.

this is the procedure that made it possible to reproduce (for me). tested on 10 attiny13 chips:

-target: attiny13
-lowest possible internal clock speed selected
-CLKDIV8 enabled
-DWEN enabled

if i try to flash the chip now, avrdude states that the chip might be in debugwire mode (which is correct), that it is now put to isp mode, and asks me to restart without power cycling the target (which is the correct way to reflash a target with DWEN set).
doing so results in - nothing. on every run of avrdude, i get the same result and the same message.

i did also try to revive the chip inside avr studio, without (!) success.

after searching quite a while on google, i found out that this problem is (kinda) known, but more or less unsolved. the essence: due to the ultra slow clock of the attiny (1 MHz / 8 = 125 kHz), the debugwire connection is very slow. this somehow makes the chip reset when closing the connection to the jtagice. so, as the jtagice mkii tells the chip to switch to isp mode, it "forgets" that and starts up again in debugwire mode as soon as the jtagice disconnects. i could not verify if this problem persists with all attiny13 and all jtagice mkII. i can verify that the problem exists with at least some jtagice mkII (as i did find a few others with that problem) and 10 of 10 attiny13  which i put onto a pcb exactly for testing this. that means, i could lock all 10 up using the above procedure, and i could recover all of them using the patch provided. the 10 attiny13 are a random picked subset of 500 pcs i ordered around June 2011.


this can be fixed if the jtagice opens the connection, notices that the device does not respond to isp, connects via debugwire to put the chip into isp mode, and IMMEDIATELY retries isp connection (that means, before using jtagmkII_close() so that the jtagice does not power off).

the fix is easy, as the jtagmkII.c already has a bunch of labels and gotos, i just added another label and goto to make avrdude retry the isp connection immediately after switching the target to isp via debugwire.

this is more like a hack than a fix, because it might lock up avrdude when the target (1) does not accept isp and (2) does not accept debugwire. avrdude would then try both again and again.

see lines 821 and 846/850 for the changes.

the most interesting thing about this: i managed to revive ALL attiny chips which were not even recoverable by avr studio!!

Malte <damaltor>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #26833:  jtagmkII.c added by damaltor (104KiB - text/x-csrc - see lines 821 and 846/850 for the changes.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by damaltor (Submitted the item)
  • -email is unavailable- added by damaltor
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-05-17 joerg_wunsch StatusNone Done
        Assigned toNone joerg_wunsch
        Open/ClosedOpen Closed
    2012-10-26 damaltor Attached File- Added jtagmkII.c, #26833
        Carbon-Copy- Added damaltor

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code