Вы находитесь на странице: 1из 13

Jkx@home

Titanium Expos Find


Go

Home About Blogroll Tag Cloud Hot links Photos Google search

Howto recover wrong fuses settings on a AVR


Yesterday, I ran into a issue with an ATMega32. In fact, I wanted to disable the Jtag support on the chips because I need to use the pins used by the Jtag (PC2-PC5). To disable the Jtag, you simply need to change some fuses. I changed the fuses with the help of the Avr Fuse Calculator, but I messed my ATMega with the wrong clock source. I dont know how, but I choose the low freq clock. So my ATMega was totally frozen, as the clock settings was wrong, I was unable to reflash it, and worst, unable to change the fuses. After a little googling, I found there is 3 ways to fixe this kind of issue:

Use a Jtag (as it doesnt need a clocked micro) Use a high voltage programmer (you can erase the fuse, with a programmer that do a parallel programming with RESET plug to a 12v PSU). This kind of programmer arent really easy to find. The only one I know right now is the STK500 Use an external clock (This is what I used, and describe here)

As, I dont have any Jtag, or STK500, the only way to fix that is to use an external clock. In fact, I decided to ask on the #avr channel on freenode. And a really kool guy (rue_mohr) give me this tips. On every AVR micro, you can use a external clock if you messed the fuses settings. Simply plug a external clock on the clock pin (XTAL1 on the Mega32), and changes the fuses by this way. Of course, you need a external clock at something like 1Mhz. Of course I dont have this kind generator at home, but this can be easily done with another AVR micro this something like this:

void main() { DDRA = 0xFF; while (1) { PORTA = ~PINA; nop(); // added some nop, to slow the clock a bit nop(); } }
Tags: avr, diy, jtag

Related posts : IV-18 VFD vacuum Russian Clock (part 1) Nixie clock at home ? IV-18 VFD vacuum Russian Clock (part 2) IVL1-7/5 Russian Vacum Tube (VFD) Clock Part 1 Lumex Graphic LCD 12864 (S12864GSF) + AVR (Atmega32)

admin April 15th, 2007 Electronics Comments(37)

37 Responses to Howto recover wrong fuses settings on a AVR


1.
# madeon 26 Jul 2007 at 5:05 am

How i have the same thanks.


2.
# Jkxon 09 Jan 2008 at 7:40 pm

about problem but i

my use atmega8535,

problem? assembly.

Moses just me this link on his weblog, but due to baysien filters, the url have been filtered. This post fix that issue. Evil Mad Scientist Thanks Mose
3.
# kalandaon 01 Feb 2008 at 12:44 am

This really works, Thanks. I tried with an attiny13 and this code to simulate 1Mhz clock. Only i needs to set the ISP Freq. on the programmer to lowest rate (51.1hz) that is more slower but works.

// Library includes #include #include int main() { DDRB = 0xFF; while (1) { PORTB = ~PINB; asm volatile("nop"); asm volatile("nop"); // _delay_ms(1000); // Uncomment this line to probe if something is live :) } return 0; }
4.
# nmcon 22 May 2008 at 4:24 am

Thanks a lot for the tip. It really helped!


5.
# Santiagoon 09 Jul 2008 at 2:55 am

id like to know if I need only set the external clock and the default values back, or I need make anything else
6.
# adminon 09 Jul 2008 at 9:14 am

Santiago, you need to set the right fuse (clock, reset flag etc ..)
7.
# Danielon 23 Aug 2008 at 3:26 am

I was wondering.. can I use a similar method if I can only get a 32hz instead of 1mhz input? I have 3 atmega168 AVR that are unusable due to some fuse setting.. We switched tabs between fuse writes & now we cant program/erase the chips any more.
8.
# Danielon 23 Aug 2008 at 3:27 am

I meant 32khz not 32hz..


9.
# adminon 23 Aug 2008 at 1:11 pm

I dont know .. You should give it a try.


10. # Natureon 31 Aug 2008 at 7:32 pm

What do you mean? You only have to feed EXTCLK on X1 & thats it or you has to do so when you gonna program it?
11. # pragon 07 Oct 2008 at 7:13 am

i am using atmega 1281 with stk500/501. Kindly clear me, how to configure fuse bits.

i am not able to download my program onto the chip, as i have changed some fuse settings.. Thanks.
12. # adminon 07 Oct 2008 at 10:05 pm

prag, re-read this howto perhaps :)


13. # Gabrison 20 Nov 2008 at 1:35 am

Its possible to have this code (down) in assebly????? // #include #include Library includes

int { DDRB while { PORTB asm asm // } return } thanks


14. # saraon 02 Mar 2009 at 12:45 pm

main()

0xFF; (1)

~PINB; volatile(nop); volatile(nop);

_delay_ms(1000);

//

Uncomment

this

line

to

probe

if

something

is

live

:)

0;

hi thanks for your greatfull website; i want to khnow how can i access to the program of locked ic(atmega8l) &my programmer is universal2000. thanks
15. # jXP3on 12 Mar 2009 at 2:47 pm

For me it worked perfectly just using CKOUT of another microcontroller(attiny2313).


16. # jejenon 13 Apr 2009 at 10:51 am

I do not have any other microcontroller, what if using the LPT printer port? please give this code to generate clock using LPT parallel port thanks
17. # ckeayson 30 May 2009 at 2:55 am

I found a website that sells a programmer to fix any avr. It only cost $29 and I fixed all of my locked atmegas! http://www.microcontrollerprog.com
18. # Dolphinon 14 Jul 2009 at 11:31 am

I had used this way to recover wrong fuses settings on my AVR (ATmega8, ATtiny13) and it had worked perfectly. After then, I set wrong fuses again, I used this way to recover but it didnt worked. I dont know why, could you help me?
19. # arimarjulon 21 Jul 2009 at 1:48 pm

HI! I have a worst problem. I work with a atmega 8/16/32 and use a AVRISPmkII to program them. But the problem occurs when some uC has the SPIEN fuse in 1.(serial programming disabled).

What

can

do

to

fix

this

problem?

have

great

amount

of

this

uC.

Please help me!!!


20. # adminon 21 Jul 2009 at 11:06 pm

Dolphin : Perhaps you need to explain, what you screw up .. Arimarjul : You have to use a parallel programming mode .. this can be done with a STK500, or a JTAG if you dont break the Jtag enable fuse .. The parallel flash is the ultimate one, but this require to have a special programmer like the STK500..
21. # Dolphinon 22 Jul 2009 at 11:32 am

I mean that I cant use this way to recover my AVR which has been recovered before (more clearly, I can use this way only one time). This is my programmer : http://www.lancos.com/prog.html . So, this is my problem. Thanks.
22. # VidProon 21 Oct 2009 at 9:12 pm

I had bricked 2 Atmega8s and used the external clock method with this code running on another atmega8: #define F_CPU 1000000UL /* 1 MHz CPU clock */ #include int main { DDRC = _BV (PC0); /* PC0 is digital output */ while { /* set PC0 on PORTC (digital high) */ (1) /* loop forever */ (void)

PORTC &= ~_BV(PC0); } return } I then connected pin 23 if the working avr to pin 9 of the bricked avr and then restored the fuses. Worked for me on the 2 I screwed up maybe it will help others used AVR studio to compile.
23. # VidProon 21 Oct 2009 at 9:15 pm

(0);

The #include should be &lt avr/io.h &gt


24. # Ben Ryveson 26 Oct 2009 at 1:21 am

Thank you for posting this! Rather than program another microcontroller, you can use a standard crystal oscillator circuit, such as one of these http://z80.info/uexosc.htm to coax the AVR back to life.
25. # farezon 09 May 2010 at 1:25 pm

can i use oscillator 1mhz ?


26. # Sandeep Kumaron 20 Aug 2010 at 7:03 am

Hi, I was using UniPro10 programmer from ucmicrosystems for programming of ATmega32. But this programmer went bad. I tried to program the same ATmega32 chip with PonyProg (Through Serial Port of PC). It is giving error Device missing (-24). Also I am not able to erase it. But the same programmer i.e. Pony Prog is working well with fresh Atmega32. Can I recover my old Atmega32? Plz help.
27. # sanjayon 11 Sep 2010 at 9:37 am

Thanks I required

,thanks 2Atmega16 and

, 2

thanks atmega 32 with

a this

lot. method.

Perfectly worked for me .


28. # sanjayon 11 Sep 2010 at 9:38 am

sorry for mistake in above comment, i recovered 4 microcontroller using this method .
29. # shrison 05 Jan 2011 at 3:12 pm

How to recover locked ATMEGA644???


30. # Harleyon 06 Feb 2011 at 12:43 am

Thanks heaps! I found it was to also easy to use a spare 8mhz clock crystal lying around. Just manually touch the 2 pins of the crsytal to your xtal pins and then set the fuses. I wiped the fuses on four 44TQFP AVRS on assembled boards with a dodgy elf file, and with a little squinting could fix them just by holding the clock crystal pins against the soldered joints just long enough to change the clock back to internal RC.
31. # josephon 03 Mar 2011 at 4:44 am

i have programmed the above program in atmega32 from where i can take the clock output to give into another atmega as a external clock
32. # brownon 06 Apr 2011 at 5:59 pm

i am using extreme burner to burn the program(written using codevision compiler) into an atmel mega 32 chip. i dont have a clue as to how to set the low and high fuse bits in the extreme burner. how to understand which clock frequency must be set?? i am new to this. please help !!
33. # Kpaxon 06 Jun 2011 at 2:54 pm

Thanks a Ton guys, this just works perfect, awesome find, i just recovered my bricked Atmega32 soldered on a board by touching the XTAL 1 pin to another uC generating a 4 MHz clock and re writing the Fuse using using the SPI programmer. Great work.
34. # Malon 10 Jun 2011 at 5:22 pm

This

did

not

work

for

me

on

ATtiny2313

with

either

1Mhz

or

4Mhz.

I accidentally inverted the low/high fuses (wrote L:DF, H:64), thus disabling the external reset. Anyone with a similar scenario have any success ?
35. # bmx64on 26 Jun 2011 at 11:41 am

hi kpax, I am a newbie to uC, I have bricked a quadcontroller board with atmega48pa .can you help by submitting a detailed schematic diagm of how you actually do this, and what frequency is required for atmega48pa.
36. # Andriansahon 16 Aug 2011 at 6:52 pm

Thank you very much, my three chips can now be used again, This code in Bascom: $regfile $crystal = 16000000 Ddrc.5 = 1 Do Portc.5 nop nop Loop End
37. # karthik con 08 Oct 2011 at 9:35 pm

m8def.dat

Not

Portc.5

Pardon for my ignorance,One of my atmega32 is not working when i tried to set fuse bits in extreme burner AVR software.I tried to set fuse bits such that it uses an external crystal clock source. i.e. set Powering cannot and please thanks in advance. Comments RSS i tell able to does how high byte 89 on communicate not to with changed recover target SPIEN the and low byte FF. failed chip value, chip.

but after programming

when i tried to read

contents the software shows error like this

Leave a Reply
Name (required) Mail (hidden) (required) Website

Submit Comment

o o o o o o o o o o o o o o

Categories
Blog (23) Electronics (23) Fun stuff (5) Hardware (22) Computers (13) Other (9) Hifi (4) Misc (6) Music (7) Orage (6) Projects (1) Python (62) Misc (40) Network (10) Webware (6) Zope (5) Unix (13) Utils (21) Web (23) Wifi (31) Antennas (9) AP (7) Cards (11) Software (3)

Archives

o o o

Links

Friends
Base-Art Hack a Day

Infos
Log in Entries RSS

Comments RSS

WordPress.org
Jkx@home. 2011 All rights reserved. WordPress Themes based on a design by NodeThirtyThree

Crystal Oscillator Circuits

A well-designed crystal oscillator will provide good performance with TTL gates. Two types of crystal oscillator circuits can be used: One with series resonance, or one with parallel resonance.

The Figure above shows implementation of a parallel resonant oscillator circuit. The circuit is designed to use the fundamental frequency of the crystal. The 74AS04 inverter performs the 180-degree phase shift that a parallel oscillator requires. The 4K7 resistor provides the negative feedback for stability. The 10K potentiometer biases the 74AS04 in the linear region. This could be used for external oscillator designs.

The Figure above shows implementation of a series resonant oscillator circuit. The circuit is also designed to use the fundamental frequency of the crystal. The inverter performs a 180-degree phase shift in a series resonant oscillator circuit. The 330 Ohm resistors provide the negative feedback to bias the inverter in their linear region.

The Figure above shows implementation of a series resonant oscillator circuit, using TTL NAND GATES. This circuit is tested by me and found working with the following IC types: 7400 Total current consumption is 21 mA. 74LS00 Total current consumption is 15 mA. 74HCT00 Don't use this type, it will NOT work, because the HCT type is too fast. 7400 PIN 6 SCOPE PICTURE 7400 PIN 11 SCOPE PICTURE 74LS00 PIN 6 SCOPE PICTURE 74LS00 PIN 11 SCOPE PICTURE The parallel resonator above doesnt work with 74HCT04. Well, in fact it doesnt. But it's not because the HCT technology is faster than LS, or, too fast. In fact the propagation delay is similar in HCT and LS. What really happens is that the HCT technology has a higher gain, that is, the inverter has a mutch sharper characteristic than LS devices. So, with that configuration, it gets very dificult do biase the inverter in the liner or high gain region. Nevertheless, because the HCT is a low power technology, and nowadays preferable, there's a very simple circuit to build clocks with HCT. I think that you know the configuration, yet I leave it here just in case you dont. Note that this configuration doesnt work with LS because of the gain being to low to biase the inverter.

Thanks to J.A.Serralheiro for this information and the good picture Links:

Crystal Oscillators Distributor

Вам также может понравиться