Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Dead ATTiny45 - reasons ?

Status
Not open for further replies.

captainhannes

New Member
Hi all,

I've been doing AVR stuff for quite some time, but 2 weeks ago
I had a strange issue:

I had an ATTiny45, programmed it as usual with my programmer
(fuses unchanged - so it ran on internal clock) with a simple
test prg. (compiler cdk-avr):
int main(void) {
sbi(DDRB,PB2);
while (1) {
cbi(PORTB,PB2);
sbi(PORTB,PB2);
}
}

All worked well, then I changed the fuses to external clock (Xtal).
I verified that the oscillator is working (scope) - all seemed normal.
Then I tried to shoot a new program, but avrdude said:

avrdude: AVR device not responding
avrdude: initialization failed, rc=-1

I then checked my programmer - all my devel boards with the
ATmega16/32 responded (I use this programmer since 5 years).

Now, I can't get it to respond, nor shoot a new prg. Assuming
that avrdude didn't overwrite the flash, the old simple prg.
should be still there, but there is no sign of activity on PB2.
(Xtal osc. is still working)

I know that the ATtiny45 is an el-cheapo device, so buying a
new one is no problem, but I'm curious what went wrong.
Any thoughts very welcome.

Thanks! :)
 

dougy83

Well-Known Member
What's the oscillator frequency? (the XTAL)

The cpu clock has to be greater than twice the programming clock.
 

captainhannes

New Member
Thanks Dougy for your reply,

the clock is 32768Hz. I "told" avrdude with -i flag to
"wait". I tried "ISP Clock Delay" with all kind of values,
but didn't help.
(Sorry, should have mentioned earlier)

Thanks! :)
 

dougy83

Well-Known Member
I tried "ISP Clock Delay" with all kind of values,
but didn't help.
For 32kHz, the delay should not be < 122 us, but I'd set it larger than that just to get it working. So try 255 for a start, maybe larger if avrdude will let you.
 

captainhannes

New Member
For 32kHz, the delay should not be < 122 us, but I'd set it larger than that just to get it working. So try 255 for a start, maybe larger if avrdude will let you.

Hi Dougy,

thanks! Been there - done that. I tried values (verified with
the scope) from nothing to 10000(!).
I now consider the bug dead and buy a new one for devel.

Thanks again,
cheers.
 

Sceadwian

Banned
Slow down your programming clock rate as much as your programmer will allow you. It may be your programmer being out of limits that's the problem not the device itself. I think SPI was / clock by 4 not 2 for reliability. Much like Nyquist. 2 is the theoretical maximum, not a useful limit.
 
Last edited:

tytower

Banned
Funnily enough I have something similar on an ATMega8. Same message ,its pretty common if you google it . Some guy posted he turned everything off then shorted all the pins to ground and awat it went. Now I did that too with my penknife and away it went but I think wrap it in silver foil would be safer
 

captainhannes

New Member
Sceadwian, Tytower, thanks for your replies! :)

Sceadwian, I told avrdude to slow down with the "-i" flag and
tried almost any value up to 10000(!) - that is 10000 us delay
between each programming clock cycle.

Tytower,
you said: "...shorted all the pins to ground..."
Errr... but without any current flowing, how would that help ?

Thanks!
 
All worked well, then I changed the fuses to external clock (Xtal).
Now, I can't get it to respond, nor shoot a new prg.

if you programmed the CKSEL fuses to use an external clock, do you have an external clock connected to the avr? Perhaps you can try connecting an oscillator to xtal1. That should get you back in.

these threads may help you:
https://www.electro-tech-online.com/threads/help-setting-the-correct-fuses-in-avr-studio-4.94643/

https://www.electro-tech-online.com/threads/avr-studio-entering-programming-mode-failed.94463/
 
Last edited:

tytower

Banned
Tytower,
you said: "...shorted all the pins to ground..."
Errr... but without any current flowing, how would that help ?

Thanks!
Well try it and find out.. I told you it fixed mine and others .
I reason that it lets any charge held by internal capacitors attached to high resistances go After all most of the I/O pins are high impedance.
 
Well try it and find out.. I told you it fixed mine and others .
I reason that it lets any charge held by internal capacitors attached to high resistances go After all most of the I/O pins are high impedance.

There is NO WAY this will ever work. You need to supply the right clock source according to what the CKSEL fuse settings are.

You should always be able to "get back in" by injecting a square wave to xtal1.

You can use an oscillator, or another avr programmed to output a square wave on one of the I/O pins. Almost any frequency should work. I have been successful in fixing messed up avr's using a 1 MHz square wave, less will also work.

Failing the above, a parallel programmer or High Voltage Serial Programmer (the attiny13 needs the HV Serial programmer) will always fix the problem. One in particular is this one here:

Atmega AVR ATtiny Fuse Repair Programmers

Best of Luck
 

tytower

Banned
Well you know it all .
Cant tell you anything about boats.
Fact is I have used similar on numerous apparently dead or damaged IC's
Didn't say it would definately fix your problem I said it might. Certainly it fixed my problem.

What you do with proffered information is up to you . If you don't want to drink so be it.
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top