How I change fuse settings without ever leaving the IDE...
The examples are based on a breadboard ATmega168 running from either an external 16 MHz crystal, or the internal oscillator at 8 MHz, or the internal oscillator at 1 MHz.
1. Ensure the Arduino IDE is
not running.
2. Add entries to "boards.txt"...
###########################################################################
bb168at16.name=ATmega168 @ 16 MHz
# The following MAY work (pick one)...
# bb168at16.upload.protocol=avrispv2
# bb168at16.upload.using=arduino:arduinoisp
bb168at16.upload.using=pololu
bb168at16.upload.maximum_size=16384
bb168at16.upload.speed=19200
# Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms; [CKSEL=1111 SUT=11]
# Brown-out detection level at VCC=4.3 V; [BODLEVEL=100]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]
# Serial program downloading (SPI) enabled; [SPIEN=0]
# Boot Flash section size=128 words Boot start address=$1F80; [BOOTSZ=11]
bb168at16.bootloader.low_fuses=0xFF
bb168at16.bootloader.high_fuses=0xD4
bb168at16.bootloader.extended_fuses=0x07
bb168at16.bootloader.path=empty
bb168at16.bootloader.file=empty168at16.hex
bb168at16.bootloader.unlock_bits=0x3F
bb168at16.bootloader.lock_bits=0x0F
bb168at16.build.mcu=atmega168
bb168at16.build.f_cpu=16000000L
bb168at16.build.core=arduino
###########################################################################
bb168at8.name=ATmega168 @ 8 MHz
# The following MAY work (pick one)...
# bb168at8.upload.protocol=avrispv2
# bb168at8.upload.using=arduino:arduinoisp
bb168at8.upload.using=pololu
bb168at8.upload.maximum_size=16384
bb168at8.upload.speed=19200
# Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms; [CKSEL=0010 SUT=10]; default value
# Brown-out detection disabled; [BODLEVEL=111]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]
# Serial program downloading (SPI) enabled; [SPIEN=0]
# Boot Flash section size=128 words Boot start address=$1F80; [BOOTSZ=11]
bb168at8.bootloader.low_fuses=0xE2
bb168at8.bootloader.high_fuses=0xD7
bb168at8.bootloader.extended_fuses=0x07
bb168at8.bootloader.path=empty
bb168at8.bootloader.file=empty168at8.hex
bb168at8.bootloader.unlock_bits=0x3F
bb168at8.bootloader.lock_bits=0x0F
bb168at8.build.mcu=atmega168
bb168at8.build.f_cpu=8000000L
bb168at8.build.core=arduino
###########################################################################
bb168at1.name=ATmega168 @ 1 MHz
# The following MAY work (pick one)...
# bb168at1.upload.protocol=avrispv2
# bb168at1.upload.using=arduino:arduinoisp
bb168at1.upload.using=pololu
bb168at1.upload.maximum_size=16384
bb168at1.upload.speed=19200
# Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms; [CKSEL=0010 SUT=10]; default value
# Divide clock by 8 internally; [CKDIV8=0]
# Brown-out detection disabled; [BODLEVEL=111]
# Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]
# Serial program downloading (SPI) enabled; [SPIEN=0]
# Boot Flash section size=128 words Boot start address=$1F80; [BOOTSZ=11]
bb168at1.bootloader.low_fuses=0x62
bb168at1.bootloader.high_fuses=0xD7
bb168at1.bootloader.extended_fuses=0x07
bb168at1.bootloader.path=empty
bb168at1.bootloader.file=empty168at1.hex
bb168at1.bootloader.unlock_bits=0x3F
bb168at1.bootloader.lock_bits=0x0F
bb168at1.build.mcu=atmega168
bb168at1.build.f_cpu=1000000L
bb168at1.build.core=arduino
###########################################################################
3. Start the Arduino IDE.
4. Enter or load an empty / do nothing sketch...
void setup( void )
{
}
void loop( void )
{
}
5. Select the first board from your new set (e.g. "ATmega168 @ 16 MHz")
6. Click
Verify7. Open
Explorer (the thing used to browse the harddrive)
8. Navigate to the temporary directory; in Windows the path "%TEMP%" gets you there.
9. In a sub-directory in the temporary directory, locate the corresponding dot-hex file. If the sketch is named "sketch_feb28a" the dot-hex will be named "sketch_feb28a.cpp.hex".
10. Copy the dot-hex file.
11. Navigate to the "Arduino/hardware/arduino/bootloaders" directory.
12. Create a sub-directory named "empty".
13. Navigate into the "empty" sub-directory.
14. Paste the dot-hex file.
15. Rename the dot-hex file to something appropriate for the board like "empty168at16.hex". This filename is the value for the "bootloader.file" entry in "boards.txt".
16. Switch to the Arduino IDE.
17. Select the next board (e.g. "ATmega168 @ 8 MHz").
18. Click
Verify19. Switch to
Explorer20. Navigate to the temporary directory (%TEMP%)
21. In a sub-directory in the temporary directory, locate the corresponding dot-hex file. If the sketch is named "sketch_feb28a" the dot-hex will be named "sketch_feb28a.cpp.hex".
22. Copy the dot-hex file.
23. Navigate to the "Arduino/hardware/arduino/bootloaders/empty" directory.
24. Paste the dot-hex file.
25. Rename the dot-hex file to something appropriate for the board like "empty168at8.hex".
26. Repeat steps 16 through 25 for any additional boards.
27. Close and restart the Arduino IDE.
It is now possible to change the fuse settings with impunity...
1. Select one of the new boards (like "ATmega168 @ 16 MHz").
2. Click
Tools /
Burn Bootloader.
The fuse settings are changed and an empty / do nothing sketch is uploaded. The processor is "hardware safe" and ready with the new fuse settings. For more examples, refer to the Tiny Core boards.txt file and "bootloaders"...
http://code.google.com/p/arduino-tiny/