Bricked AVR's

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

Hi, I bricked some of my AVR's trying to write the fuses using AVRdude through an Arduino as an ISP, no I've been looking at getting the AVRISP mkII from atmel and want to know if I can fix my AVR's using the AVRISP mkII? From what I've read you need a high voltage serial/parallel programmer to re-set the fuses. On atmel's site they say the AVRISP mkII supports fuses and lock-bit programming but not sure if it'll fix a bricked AVR because they say the supported target voltages are 1.8v - 5.5v and from what I've read, to unbrick devices you need 12v on the reset pin. So can I unbrick my devices using the AVRISP mkII?

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

You carefully omitted to say which AVRs you have "bricked".

If your particular AVR has a RSTDISBL fuse, and you have chosen to set it, then you need HVPP or HVSP.

Any other fuse setting can be recovered by using an external clock or a watch crystal. You can even recover from DWEN with another AVR.

Since you possess an Arduino, you can produce an external clock.

No, an AVRISP-2 will be no better than your ArduinoISP for programming or recovering fuses.

Read Cliff's Tutorial.

Incidentally, if you have set RSTDISBL on several PDIP chips, ask nicely, and mail them to a fellow Freak in your (undisclosed) country.

David.

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

Quote:

From what I've read you need a high voltage serial/parallel programmer to re-set the fuses.

The usual case is that you mis-program the clock selection fuses. To solve this there is usually no need for high-voltage - try to inject a clean square clock signal on the clock pin indicated in the data sheet and try to program the fuses back to default.

What can generate a clock signal? MAny things. One alternative is another AVR.

Do go over to the Tutorials forum and read the tutorial on "bricked AVRs" (or whatever it is called).

While now perhaps moot: No, the AVRISP mkII won't do high-voltage programming. Interestingly, the cheaper AVR Dragon will. But I think there is a fair chance you will not need high-voltage programming so don't take that as an advice on buying a Dragon to fix your bricked AVRs. At least not until you've tried the clock-injection trick.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Depending on what you did to the fuses it could be as simple as injecting an external clock into the AVR. Look here https://www.avrfreaks.net/index.p...

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

Well the AVR's I have are 2x attiny48 and 1x atmega328p. Yes I bricked them trying to set the fuses to use an external clock instead of the internal clock and I am till this day very confident that I'm doing it right with avrdude but it clearly didn't work :(

@dksmall I read that tutorial and I see that I should not program cksel to use an external oscillator because an external oscillator is not an xtal... !?!? So even though I believed I was doing it right, I wasn't. Now the only problem is: I can only generate a clock source using the arduino but I need to use it to program the chip once a clock source is applied. Going to try and find a way now, thanks for all the help guys!

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

As mentioned above, where do you live?
(City, Country?)

If you have one remaining AVR you can program it to be a clock. Configure a pin as an output. Set pin high, NOP, set pin low, NOP, Loop.

JC

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

Quote:

I can only generate a clock source using the arduino

Only?

I said that there are "many things" that can generate a good clock signal. It all depends on what you have lying around.

I believe that there should be mention of several methods in or near Cliffs "bricked" tutorial.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

What frequency do I need?
And the only equipment I have lying around is some resistors, capacitors, diodes, transistors and 12mhz xtals. Can I somehow create a clock source using this equipment?

And I live in South Africa.

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

Quote:
What frequency do I need?

Something that is at least 4 times as high as the frequency of the programming clock (in the ISP interface). Other than that, I'd keep it low. E.g. injected CPU clock at 2 MHz, and program clock at or below 500 KHz.

You say you have an Arduino that you use as a programmer, right?

Well, it should not be impossible to augment the Arduino sketch so that you get a square wave out on one of the digital I/O pins. (I assuma that you use some Arduino "sketch" and have gotten that into the Arduino by means of the Arduino IDE and bootloader, and this bootloader is still intact. Please inform if this is not so.)

Quote:
And I live in South Africa.

Any special physics laws present there that affects electrical circuits so that they can't produce square waves? :wink: I.e. what does living in South Africa have to do with generating a clock signal?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Hahaha, DocJC wanted to know where I live. The arduino sketch for ISP has delays in it and therefore I can't generate a fast enough signal, I already tried. Adding 'PORTD^=(1<<PORTD4)' to the 'while' loop only generates a frequency of approx. 500hz on PORTD4 if it even is that much. My friend does PIC programming, I'll borrow and program one of his PIC's to use as a clock source

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

Quote:

The arduino sketch for ISP has delays in it and therefore I can't generate a fast enough signal, I already tried.

The AVR on the Arduino has several timers. My suggestion would be to write a piece of "plain old C/C++" and call that from the Init. This code would set up a free timer to generate a clock signal.

Since Timers/Counters are hardware separate from the CPU, they will run regardless of if there are delays in the firmware.

I suppose You'd have to dig through the Arduino framework source code to find out what timers are free for you to use. After that it should be pretty straight forward.. :wink:

Perhaps the simplest way is to use the $ or Rands to buy another cheap(ish) AVR, not touch the fuses of it and use that to generate the clock signal.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Add this to setup() in the ISP sketch and you have a F_CPU/2 square wave on PD3 (digital 3) on the arduino (if it's megaxx8 based).

    // OC2B output mega xx8, D3 on Arduino
    DDRD |= 1<<3;
    // Mode 2, CTC, toggle OC2B on COMP match, TOP = 0CR2A
    TCCR2A = (1<<COM2B0) | (1<<WGM21);
    // Presc 1:1
    TCCR2B = (1<<CS20);
    // Max frequency F_CPU/2
    OCR2A = 0;
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tell us exactly what arduino board you have, so that we can make sure you get the right setup for the AVR that is on it. (E.g. newer Arduino Uno boards have an ATmega328 on them IIRC.)

And thank you, Snigelen!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

I forget whether the Arduino "system" uses Timer0 or Timer2 for its system timer. I think it is Timer0.

So you can add these lines to your ArduinoISP sketch setup() function:

Pin PORTD.3 is "Digital Pin #3" and also the OC2B pin.

  DDRD |= (1<<3);                    // make OC2B o/p
  OCR2A = F_CPU/2/1000000 - 1;       // CTC toggle @ 1MHz
  OCR2B = OCR2A;                     // match B 
  TCCR2A = (1<<COM2B0)|(1<<WGM21);   // Toggle OC2B in CTC mode
  TCCR2B = (1 << CS20);              // run timer2 at div1

Untested. But you should get a 1MHz clock out of DIGITAL#3 pin. Shout if it doesn't work.

There are several other 'options' like using OC1A pin (DIGITAL#9). Note that ArduinoISP uses this pin for the HeartBeat LED, so you would remove the heartbeat code if you want a 1MHz o/p on this pin.

  DDRB |= (1<<1);                    // make OC1A o/p
  OCR1A = F_CPU/2/1000000 - 1;       // CTC toggle @ 1MHz
  TCCR1A = (1<<COM1A0)|(1<<WGM11);   // Toggle OC1A in CTC mode
  TCCR1B = (1 << CS10);              // run timer1 at div1

David.

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

Ok cool, I'll play around with the different timers and see what I can do, I have the arduino uno with the atmega328p and if everything fails, I'll have to get a new avr to sort it out with unless my friend can get me his pic programmer and a pic or 2... :)

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

Otherwise, there are bazillions of simple oscillator circuits you can google that will do the job.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

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

David - thanks for this, it allowed me to recover a "bricked" Teensy++2.0 last night.

 

Although the Teensy uses a very small QFN64 package I was able to trace the tracks back to one of the capacitors linked to the crystal which gave me a large enough contact for me to hold a clock signal in place long enough to reset the fuses.