SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By gigamega
#178407
I am very new to the world of microcontrollers and after messing around with the arduino ide with a uno development board I decided to make a breadboard development board in order to accelerate learning

I chose the atmega8 as it seemed like a popular choice for breadboard made development boards
I purchased a freetronics usbasp programmer and got hooking it all up
From what I understood the atmega8 has an internal oscillator??? I hooked up an 8MHz crystal anyway as that is what everyone else seemed to do to get it to work

The following is all using avrdude in linux

Initially it could not pick up the mcu, this was fixed by attaching jumper leads over slow clock pulse on the usbasp (why is this the case?)
Wrote a simple program in assembler to turn on an led, flashed the mcu, led comes on!!! Success!!!

Now here is where everything goes wrong.
So from what I understand even though I had an 8MHz crystal attached, without the appropriate fuse settings the mcu will not run at 8MHz
Anyway I used a fuse calculator and changed the low fuse setting through avrdude to accomodate an ext RC osc at 3-8MHz
Yes I know I am not using an RC osc, I am noob, I am assuming this is what has messed everything up and even worse I played around with the vout setting on the usbasp (3.3V - 5V) and I have heard if you are running higher frequencies at lower voltage bad things happen
From then on I can not get avrdude to recognise the atmega8, the odd thing is I keep getting different device signatures every time I try to get avrdude to recognise my device

Is there something I am missing to get this working again?
Is there a simple way to reset the fuse settings??

Thanks for any help, I apologise for my general cluelessness
By gigamega
#178439
Solved by adding an ext RC osc, then changed fuse settings for a crystal, then added an ext crystal

Is there a reason why the device signature changed when I had the wrong fuse settings for a crystal??
User avatar
By Ross Robotics
#178453
Guessing the internal osc wasn't running at spec. Probably due to poor voltage signal..
By monkeyxpress
#179879
Don't worry this happens to the best of us, even with lots of experience. I normally hook a signal generator (outputting a 0-5V square wave) and feed this into CLOCKIN through a 1K resistor to bring the chip back up until I can reset the fuses.

FYI the internal OSC is pretty good if you only need timing within around 5-10% (depends a lot on temperature range). I've found it is quite stable and unless you are doing precision timing it is good enough for most things, including serial comms up to around 19200 baud. On breadboard your external crystal is likely to cause you more trouble than good, especially if you don't have a scope to be able to quickly check it isn't the source of a mysterious bug you've wasted a day trying to figure out...