Skip to content

Commit 1c1d02e

Browse files
committed
firmware: Makefile: Fix fuses!
Our calculations have been messed up this entire time... We thought we were running on the 16MHz external crystal oscillator (so all of our counter calculations were based on a 16MHz f_cpu) but our fuses were actually programmed to use the internal 8MHz RC oscillator. As they say, ______ < crap > ------ \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
1 parent 773fa5c commit 1c1d02e

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

‎firmware/Makefile‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ CLOCK = 16000000
2323
# PROGRAMMER = #-c stk500v2 -P avrdoper
2424
# PROGRAMMER = -c buspirate -P /dev/tty.usbserial-A700e7cb
2525
OBJECTS = main.o
26-
FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m
2726
# original fuse value read from device:
2827
# avrdude: Device signature = 0x1e9307
2928
# avrdude: safemode: lfuse reads as FF
@@ -56,6 +55,29 @@ FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m
5655
# For computing fuse byte values for other devices and options see
5756
# the fuse bit calculator at http://www.engbedded.com/fusecalc/
5857

58+
# FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m
59+
60+
61+
# 16 MHz external crystal oscillator
62+
# Fuse high byte:
63+
# 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000)
64+
# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0
65+
# | | | | | +-------- BOOTSZ1
66+
# | | | | +---------- EESAVE (set to 0 to preserve EEPROM over chip erase)
67+
# | | | +-------------- CKOPT (use 16MHz external crystal)
68+
# | | +---------------- SPIEN (if set to 1, serial programming is disabled)
69+
# | +------------------ WDTON (if set to 0, watchdog is always on)
70+
# +-------------------- RSTDISBL (if set to 0, RESET pin is disabled)
71+
# Fuse low byte:
72+
# 0xbf = 1 0 1 1 1 1 1 1
73+
# ^ ^ \ / \--+--/
74+
# | | | +------- CKSEL 3..0 (16M external crystal, slowly rising power)
75+
# | | +--------------- SUT 1..0 (slowly rising power)
76+
# | +------------------ BODEN (if 0, brown-out detector is enabled)
77+
# +-------------------- BODLEVEL (if 0: 4V, if 1: 2.7V)
78+
FUSES = -U hfuse:w:0xc9:m -U lfuse:w:0xbf:m
79+
80+
5981

6082
# Tune the lines below only if you know what you are doing:
6183

0 commit comments

Comments
 (0)