I have a ATtiny2313 board which does not have a crystal installed. According to documentation it looks like it then runs by default on 1MHz. Because this board only allows ISP programming I thought about first testing the timer-related code on Arduino (with ATmega 328, but using only features which would also be available on the ATtiny2313).


  • How to disable the Arduino crystal (temporarily) without having to set fuses (don't want to send my AVR to hell)?
  • Is it possible to change the system clock prescaler by code, e.g. to change the system clock of the ATtiny2313 from 1MHz to 8MHz?

1 Answer 1


Yes, look at setting the fuse bits to use the internal oscillator rather than an external crystal. Using the OSCCAL register you can even fine tune the internal RC oscillator on the arduino to mimic your ATtiny2313. Once you have done this

If the Internal Calibrated RC Oscillator is used as chip clock source, PB7. . .6 is used as TOSC2...1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set.

See page 3 and page 84 of the datasheet for the ATmega328P which is the microcontroller on your arduino.

Response to Comment Oh, I might be misunderstanding your question. The fuses are 'one-time' with respect to your program in that once they're set and your program is running they can't be changed anymore until you reprogram. They are used to select which clock source is being used.

However, they can be set many times if you are trying to simulate your program at different clock frequencies. Oh and to the last part, I don't believe there is a way to change the fuses with an USB/FTDI programmer. For more information on fuses, see here.

If you're asking if there is a way to change the fuse settings through the arduino board I believe the answer is no. You need to use an something like the STK-500 or AVR-ISP mkII. Also note, these programmers also plugin to your USB port on your computer, but they do not use the FTDI chip like the arduino board does.

  • \$\begingroup\$ Aren't the fuses a one-time decision (and shouldn't be programmable from USB)? Maybe setting the register CLKPR? \$\endgroup\$
    – Mike L.
    Jul 7, 2011 at 13:22
  • \$\begingroup\$ @Mike L. see my edits in response to your comment \$\endgroup\$
    – NickHalden
    Jul 7, 2011 at 13:57
  • \$\begingroup\$ There are some exceptions though. Fuses that disable ISP and/or the reset pin can only be cleared using a special high-voltage programmer. \$\endgroup\$
    – drxzcl
    Jul 7, 2011 at 14:42
  • \$\begingroup\$ @Mike L. Yeah you should be careful when reprogramming your fuses. You can brick your ATmega328P and then like @Dr X said, the only option to revive it is a HVPP or HVSP \$\endgroup\$
    – NickHalden
    Jul 7, 2011 at 17:31
  • 1
    \$\begingroup\$ @Mike not to disable the external crystal, no. The fuses are what determine the clock source. \$\endgroup\$
    – NickHalden
    Jul 11, 2011 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.