Author Topic: Atmega8 Clock Question  (Read 2677 times)

0 Members and 1 Guest are viewing this topic.

Offline spizzakTopic starter

  • Full Member
  • ***
  • Posts: 102
  • Helpful? 1
Atmega8 Clock Question
« on: September 22, 2011, 10:03:45 AM »
Can anyone tell me what the Atmega8 is clocked at by default, and how to set the fuses to use an external oscillator?

Also, I have a board that has an oscillator on it but I'm not sure if the chip was configured to use it. Is there anyway to check what freq it's running at?
« Last Edit: September 22, 2011, 10:08:53 AM by spizzak »

Offline joe61

  • Supreme Robot
  • *****
  • Posts: 417
  • Helpful? 16
Re: Atmega8 Clock Question
« Reply #1 on: September 22, 2011, 04:39:27 PM »
The data sheet is at http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf

In the section "System Clock and Clock Options" it says that the factory default is 1MHz. If you're using avrdude to program the part, the option to set the low fuse byte is -U lfuse:w:<value>:m

The <value> part of that specifies the bits you want to set, and must be given as a hex number prefixed by '0x'. Read the section in the data sheet called "Memory Programming" to see what the options are. I won't give you a value because putting the wrong thing there could make the chip unresponsive. Read the section carefully and decide what you want it set to.

You can check the current setting of the lfuse byte with avrdude by doing the following - this is with an atmega328p, and using a USBtiny programmer:

Code: [Select]
opus$ avrdude -c usbtiny -P usb -p m328p -t

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude> dump lfuse
>>> dump lfuse
0000  e2                                                |.               |

avrdude> q
>>> q

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

The value 'e2' shows what bits are set in the lfuse byte.

Edit: I noticed in the other thread about this that you're using AVR Studio. Can't help you there, sorry.

Joe
« Last Edit: September 22, 2011, 04:43:40 PM by joe61 »

Offline joe61

  • Supreme Robot
  • *****
  • Posts: 417
  • Helpful? 16
Re: Atmega8 Clock Question
« Reply #2 on: September 23, 2011, 05:43:54 PM »
I ran across this and thought you might find it useful. I haven't used it, but it was linked to from a reliable source ...

http://www.engbedded.com/fusecalc/

Joe

 

SMF spam blocked by CleanTalk