I have build a couple of boards that have an ATMEGA328P-AU (the 32 pin MLF, as used on the Arduino Pro Mini). If I burn a bootloader via SPI to use an external 8MHz clock, I can then use the Arduino IDE to write a program via the serial port. If I burn a bootloader to use an internal 8MHz clock, burning the bootloader is still successful but programming with the Arduino IDE does not work.
The current boards do have crystals, but I want to build the rest of the boards without a crystal, so I need to get internal clock working.
The internal (non-working) script looks like this:
avrdude -Cavrdude.conf -v -patmega328p -B4 -cusbasp -Pusb -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xE2:m
avrdude -Cavrdude.conf -c usbasp -p atmega328p -e -Uflash:w:ATmegaBOOT_168_atmega328_pro_8MHz.hex
The external (working) script looks like this:
avrdude -Cavrdude.conf -v -patmega328p -B4 -cusbasp -Pusb -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m
avrdude -Cavrdude.conf -c usbasp -p atmega328p -e -Uflash:w:ATmegaBOOT_168_atmega328_pro_8MHz.hex
By my reckoning, lfuse=0xE2 should be CKDIV8=1, CKOUT=1, SUT=10 and CKSEL=0010.
Any suggestions how to make the internal clock work?