You can either take a pre-built firmware package from http://www.smarthomatic.org/builds/builds.html or build your own firmware. If you take the prebuilt package, extract it to a directory of your choice.
Every microcontroller has three parts that can be flashed (written):
If you build your binaries by yourself with “make”, your fuse settings should be available as files lfuse.bin, hfuse.bin and efuse.bin in the bin subdirectory of the device you want to flash. You can write these fuses with:
Be sure about the fuse settings you want to write in your microcontroller. With wrong fuse settings, your microcontroller might not be accessible anymore!
If you are creating a new or modified SHC device, you may want to write other than the default fuses. You can do so with:
avrdude -p ATMEGA328P -U lfuse:w:0x??:m
(replace ?? by the hex value for the needed fuse settings and use “lfuse”, “hfuse” or “efuse” accordingly).
Some fuses only use a part of their bits. If you set such a fuse, avrdude may complain at verification that it read out another value than it wrote.
Writing the EFuse of the ATMega168 or 328 returns a value of only the last 3 bits (upper 5 unused), so a value of xxxxxyyy is read out as 00000yyy. Example:
avrdude: verification error, first mismatch at byte 0x0000 0xfc != 0x04 avrdude: verification error; content mismatch
Don't worry. The warning is only returned because avrdude does not know that the upper 5 bits are always 1 (as per spec).
After setting up avrdude, you can flash the firmware by calling the flash scripts
If you have the source code on your machine, you can flash the firmware with the following command from the firmware subdirectory:
If you want to call avrdude by hand you can flash everything with:
avrdude -p m328p -U flash:w:shc_basestation.hex -U eeprom:w:shc_basestation.e2p:r -U lfuse:w:lfuse.bin:r -U hfuse:w:hfuse.bin:r -U efuse:w:efuse.bin:r
(leave one part ”-U …” out to flash only a part).