Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Programming atmega32 clock source

  1. Mar 18, 2013 #1
    iam using atmega 32 and i want to use external 16MHZ crystal I have figured out the fuse setting for this as lowbuyte=0xFF and highbyte=0Xc9
    what i cannot understand is should i set fuse bits before programming or after programming? because as i have specified external crystal as clock source if i set fuse bits before programming it will require external crytal to be programmed (iam assuming controller requires clock source to be programmed does it?)and if i set the fuse bits after programming how will i reprogram it?

    Iam using a universal burner to programme atmega32
  2. jcsd
  3. Mar 19, 2013 #2
    As I remember, the Atmega 32 latches the fuses when you leave the programming mode. So even if you program the fuse bits, they wont have effect until you leave the programming mode. So the answer to your question is that, you don't need the external crystal before you leave the programming mode.

    And yes the controller needs a clock source to be able to program the flash.

    If you want to reprogram the fuse bits, there is something about the Lock bits that you need to do. So read up on the lock bits in the user manual.

    Sidenote: I heard of some guys who programmed the fuse bit for an external crystal, left the programming mode, but they had no external crystal, so the controller didn't do anything. So be sure the crystal is connected and all before you program the fuse bits and leave programming mode. :D
  4. Mar 19, 2013 #3
    thanks runie I have an external crystal so that won't be a problem but can i reprogram the flash (not the fuse bits ) without using external crystal?since i have set the fused bits to external crystal from where will it get the clock to reprogram flash?
  5. Mar 19, 2013 #4
    I believe it will need the clock from the external source then. So if you remove the crystal, then you can't program the flash.

    However, some microcontrollers do it, such that when you enter programming mode, it switches to the internal oscillator. Thus you can always program the flash. But I don't know if this is the case with the ATmega 32.

    The User Manual should tell you more.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook