Author Topic: How to change the clock frequency through PonyProg?  (Read 2961 times)

0 Members and 1 Guest are viewing this topic.

Offline joel_m_pintoTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
    • My blog
How to change the clock frequency through PonyProg?
« on: May 28, 2011, 11:35:32 AM »
The default clock frequency for an Atmega32 is 1MHz (from the datasheet). I want to change it to 8MHz as done in the UART tutorial. I think I have to change the Configuration and Security Bits from PonyProg for that. Can anyone tell me which bits do I have to check exactly. Or better if you teach me how to know which bits i have to program for any given frequency.

Thank you in advance

Joel

Offline rbtying

  • Supreme Robot
  • *****
  • Posts: 452
  • Helpful? 31
Re: How to change the clock frequency through PonyProg?
« Reply #1 on: May 28, 2011, 02:51:57 PM »
Take a look at a fuse calculator - it'll give you the correct hex values to burn onto the microcontroller for different xtal configurations.  On another note, you can't quite define arbitrary clock speeds - there's a divide-by-8 bit, and the internal RC oscillator runs at 8MHz, giving you 1MHz and 8MHz.  If you want other frequencies, you'll need to add in an appropriate external crystal. 

Offline joel_m_pintoTopic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
    • My blog
Re: How to change the clock frequency through PonyProg?
« Reply #2 on: May 29, 2011, 09:05:35 AM »
Thank you for the help.

Why don't I see any mention of divide clock by 8 bit(CKDIV8) in the fuse calculator. Why is it needed anyway?

Offline rbtying

  • Supreme Robot
  • *****
  • Posts: 452
  • Helpful? 31
Re: How to change the clock frequency through PonyProg?
« Reply #3 on: May 29, 2011, 10:11:30 AM »
Due to the inherent inaccuracy of the internal RC oscillator circuit (there's going to be some level of error), 8MHz isn't entirely reliable.  However, dividing by 8 to get 1MHz also divides the error by 8, so the 1MHz clock speed is probably more accurate than the 8MHz clock speed.

Also, not all AVRs have the same fuse bits - the ATMega32 might be one of the ones without a dedicated CKDIV8 bit, and instead just have clock selector options.  Use the dropdown menu in the calculator to configure the options for you - it's much easier.