I have burned an arduino bootloader to an ATmega168PA. I want to use the internal 8MHz oscillator for the ATmega, and I used an arduino Uno as an ISP. For that, I did the following:
Created the directory at Documents/Arduino/hardware/breadboard/avr. In there I placed a boards.txt file, and a bootloaders folder, which contained the .hex file. Both files can be found at the end.
I found the hex file I used in this link. From it, I used the optiboot_atmega168pa_8000000L_57600.hex
The burning of the bootloader completed successfully. Also I successfully uploaded a blink example to my ATmega168PA via the arduino ISP and the Arduino IDE.
The problem is that when I try to upload something a second time, I get this error:
If I reburn the bootloader, I can again successfully upload a sketch. But once more, I cannot upload a second time.
optiboot_atmega168pa_8000000L_57600.hex file:
:103E00001F92CDB7DEB7112484B714BE982F9D70D2
:103E100009F0C4D082E08093C00088E18093C100A3
:103E200086E08093C20080E18093C4008EE0A1D040
:103E3000812C912C93E0F92EEE24E39425E0D22EF0
:103E400031E1C32E8AD0813479F487D0898397D029
:103E50008981823811F482E005C0813811F486E04E
:103E600001C083E073D06FC0823411F484E103C0D9
:103E7000853419F485E08BD066C0853541F46DD06A
:103E8000882E6BD0912C982A880C991C5BC08635A3
:103E900021F484E07CD080E0E5CF843609F036C0A0
:103EA0005CD05BD0B82E59D0A82E00E011E055D0E0
:103EB000F80181938F01BE12FACF61D0F5E4AF1201
:103EC00001C0FFCFF401F7BEE89507B600FCFDCFB7
:103ED000B401A0E0B1E02C911296AD01415051091E
:103EE000FA01808130E0382BFB010901E7BEE8953B
:103EF00011246E5F7F4FBA12EECFF401D7BEE89562
:103F000007B600FCFDCFC7BEE8951DC0843769F435
:103F100024D023D0B82E21D032D08401F80185914D
:103F20008F0114D0BA94D1F70EC0853739F427D059
:103F30008EE10CD084E90AD08BE094CF813511F466
:103F400088E017D01CD080E101D07CCF9091C000D8
:103F500095FFFCCF8093C60008958091C00087FF35
:103F6000FCCF8091C00084FD01C0A8958091C6005F
:103F70000895E0E6F0E098E1908380830895EDDF16
:103F8000803219F088E0F5DFFFCF84E1DFCFCF93F7
:103F9000C82FE3DFC150E9F7CF91F1CF282E80E0A1
:083FA000E8DFE0E0FF270994CF
:023FFE000206B9
:0400000300003E00BB
:00000001FF
Boards.txt file:
atmega168pabb.name=ATmega168PA on a breadboard (8 MHz internal clock)
atmega168pabb.upload.protocol=arduino
atmega168pabb.upload.maximum_size=14336
atmega168pabb.upload.maximum_data_size=1024
atmega168pabb.upload.speed=19200
#atmega168pabb.upload.speed=115200
atmega168pabb.upload.tool=arduino:avrdude
atmega168pabb.bootloader.tool=arduino:avrdude
atmega168pabb.bootloader.low_fuses=0x62
atmega168pabb.bootloader.high_fuses=0xDF
atmega168pabb.bootloader.extended_fuses=0xF8
atmega168pabb.bootloader.file=optiboot_atmega168pa_8000000L_57600.hex
atmega168pabb.bootloader.unlock_bits=0x3F
atmega168pabb.bootloader.lock_bits=0x3F
atmega168pabb.build.mcu=atmega168p
atmega168pabb.build.f_cpu=8000000L
atmega168pabb.build.core=arduino:arduino
atmega168pabb.build.variant=arduino:standard
atmega168pabb.build.board=ATmega168PA_BreadBoard