"Repairing" my ATMega8

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

Alright. Here's "my story". Two days ago I've flashed my ATMega8 for the first time using "Spark Fun" tutorial as a reference. When I got to oscilators ( see http://www.sparkfun.com/commerce... ) I wanted my atmega to run at 16Mhz too. So I decided to flash mine like they did.
I ran avrdude -c usbasp -p atmega8 -U lfuse:w:0xE6:m and the atmega got flashed. I connect my 16Mhz Crystal Oscilator, 2 x 22 pF and it is still not working. I tried to consult the datasheet to see what i've set... but I don't kinda understand what's going on there :(. But there is something interesting: if I make a connection(even by touching with my finger) between the case of the crystal and one pin of it(I guess it is XTAL1) the led I've connected to the atmega lights up (as supposed to).
so .. I'm here asking for someone's help to tell me what i've actually done with it, and if there is some way to recover it, because I've tried to remake the connections like 5 times and still doesn't work, only the interesting thing I've said before happens.

Best regards,
Nicu.

(I'll add some photos of my circuit on breadboard later when I get home)

Nicu reSpawn.

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

Quote:
-U lfuse:w:0xE6:m

CKSEL3..0 = 0b0110 which sets the mega8 up for an external RC oscillator in th 0.9 - 3.0 MHz range. If you want to use a crystal @ 16MHz try

-U lfuse:w:0xDF:m

As for your already burnt mega8, replace the crystal with an RC as per datasheet (look for the section "External RC Oscillator") and change the fuses.

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

Have you installed the 2 capacitors as shown in the sparkfun schematic? If so, then possibly your xtal requires a bit more capacitance or maybe the caps are not the right value.

Rick

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

I'm a bit confused now. MegaTorr are you saying that I haven't flashed my ATMega8 correctly, and I need to put a crystal between 0.8 - 3 Mhz to make it work?
RickB, I will try to put bigger caps. Can you sugest some bigger values?

Nicu reSpawn.

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

According to the datasheet you've set the fuses for an external RC oscillator, not a crystal. Check the datasheet under "System Clock and Clock Options".

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

I did a search on google abour RC oscillators, and it came up with this: http://www.atmel.com/dyn/resourc...
so basically, to make an RC Oscillator all I need to do is connect a resistor(1K should be fine, right?) and my 22pF capacitor to XTAL1 then to GND?

Nicu reSpawn.

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

MegaTorr wrote:
Quote:
-U lfuse:w:0xE6:m

CKSEL3..0 = 0b0110 which sets the mega8 up for an external RC oscillator in th 0.9 - 3.0 MHz range. If you want to use a crystal @ 16MHz try

-U lfuse:w:0xDF:m

As for your already burnt mega8, replace the crystal with an RC as per datasheet (look for the section "External RC Oscillator") and change the fuses.


Yeh! I did it with an RC oscillator! Thank you a lot man!
Now It's time to write the fuses for my 16mhz crystal.
Are you sure -U lfuse:w:0xDF:m will do it? :P

Nicu reSpawn.

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

reSpawn wrote:
Now It's time to write the fuses for my 16mhz crystal.
Are you sure -U lfuse:w:0xDF:m will do it? :P

Only one way to find out! Good luck and 16MHz speed :)

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

Works! Thank you a lot again :)
Now it's time to move on to more interesting things :D

Nicu reSpawn.

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

Maybe you could send Sparkfun an email and let them know.