avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avrdude-dev] [patch #7876] JTAGICE mkII fails to connect to attiny if d


From: Malte
Subject: [avrdude-dev] [patch #7876] JTAGICE mkII fails to connect to attiny if debugwire is enabled AND target has a very slow clock
Date: Fri, 26 Oct 2012 19:39:45 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1

URL:
  <http://savannah.nongnu.org/patch/?7876>

                 Summary: JTAGICE mkII fails to connect to attiny if debugwire
is enabled AND target has a very slow clock
                 Project: AVR Downloader/UploaDEr
            Submitted by: damaltor
            Submitted on: Fri 26 Oct 2012 07:39:44 PM GMT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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!!



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 26 Oct 2012 07:39:44 PM GMT  Name: jtagmkII.c  Size: 104kB   By:
damaltor
 see lines 821 and 846/850 for the changes.
<http://savannah.nongnu.org/patch/download.php?file_id=26833>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?7876>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]