OpenSprinkler Forums OpenSprinkler Unified Firmware Programming a new Atmega328-PU Re: Re: Programming a new Atmega328-PU



To program a new mcu, you need to do the following:
1) program the fuse bits:
avrdude -c usbtiny -p m328p -B 250 -F -U lfuse:w:0xe2:m -U hfuse:w:0xd1:m -U efuse:w:0x06:m
(this sets various configurations, including setting the mcu to run with internal 8MHz clock. the -B 250 part is important because OpenSprinkler’s built-in usbtiny programmer is set to run at the highest speed, and a stock atmeg328 runs only at 1MHz so it cannot handle that speed. therefore you need to first use a slow programming speed to set the clock to run at 8MHz).

2) flash the firmware:
avrdude -c usbtiny -p m328p -F -U flash:w:firmware1.8.3.hex