1
\$\begingroup\$

Could anyone tell me how I could change the fuse bit, so that my ATmega162 uses 12 MHz external crystal.

Once, I made the changes in the AVR fuses wrong the AVR went dead.

That is why I need supervision of an expert.

Below is images from Datasheet

enter image description hereenter image description hereenter image description here

\$\endgroup\$
4
  • \$\begingroup\$ Do you have a detailed datasheet for this microcontroller? You only select external clock, no need to specify the rate. However, in the program itself you #define F_CPU 12000000L. How do you program the device? Ones you set fuses to external clock, you need to provide it in order to make further changes. \$\endgroup\$
    – Nazar
    Commented Jan 30, 2015 at 13:19
  • \$\begingroup\$ @Naz I have got datasheet that typical for beginner to understand I have used the #define F_CPU 12000000UL. I tested it with buzzer. delay_ms(1000); gives 12 sec beep. Is my AVR working fine with 12Mhz ? \$\endgroup\$
    – Naqi
    Commented Jan 30, 2015 at 13:31
  • \$\begingroup\$ delay of 1000ms is 1s, so if you "beep on" -> delay "beep off", the beep should be 1s (as long as the delay). It looks like your clock (internal) is running at 1MHz, which is the default setting in the device. Actually, the internal clock runs at 8MHz, but the is also clock divider fuse set to div8. Do you use Atmel Studio to program the device? You should post the datasheet. \$\endgroup\$
    – Nazar
    Commented Jan 30, 2015 at 14:06
  • \$\begingroup\$ @Naz I use AVR studio 4 for programming. I have CKDIV8 fuse 0, I think my AVR is working on 1MHz, Could you please tell me fuse setting for 12Mhz external Oscillator \$\endgroup\$
    – Naqi
    Commented Jan 30, 2015 at 14:54

1 Answer 1

1
\$\begingroup\$

All you have to do is select one of the 8MHz external clocks SUT_CKSEL fuse depending on your external clock type (your datasheet explains how to select the setting depending on the clock type) and make sure to unselect the CKDIV8.

This is from Atmel Studio 6.1

enter image description here

\$\endgroup\$
8
  • \$\begingroup\$ I have applied changes with my data sheet and also changes CKDIV8 to 0 but now problem is that my eFuse got 00 automatically(default efuse=FF). and my avr has stuck on a long beep. \$\endgroup\$
    – Naqi
    Commented Jan 30, 2015 at 15:44
  • 1
    \$\begingroup\$ To check if your device is running on the external clock properly, you can program it again setting the CKOUT fuse. This will output the system clock on the designated pin (should say on the datasheet). You can measure this with oscilloscope and see if the clock times are correct. \$\endgroup\$
    – Nazar
    Commented Jan 30, 2015 at 15:48
  • \$\begingroup\$ My problem has diverted from the question, I changed CKOUT=0,CKDIV8=0 SUT10=11 CKSEL0123=1111 Now I am just getting a long beep. program is stuck on delay. Don't have oscilloscope. \$\endgroup\$
    – Naqi
    Commented Jan 30, 2015 at 16:00
  • \$\begingroup\$ If you are sure that the fuses are indeed set to the values you said, then all should be fine. If CKOUT is set and your buzzer is connected to the pin on which this system clock is outputed - it will beep continuously since it will take 12MHZ as a DC voltage. Also, check your oscillator connection, what kind of osc. is it? Make sure it is "parallel" type, not "series" type. Play with F_CPU number and delay numbers to see if it makes a difference. Try connecting the beeper to a different pin. \$\endgroup\$
    – Nazar
    Commented Jan 30, 2015 at 16:14
  • \$\begingroup\$ Buzzer is connected to PORTC while CKOUT port is PORTB. I am stuck in new problem, Just tell me How could i reset my fuses to default, Because resting fuses to default has solution to get bak to the state where my question was. \$\endgroup\$
    – Naqi
    Commented Jan 30, 2015 at 16:37

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.