====== avrdude: error: programm enable: target doesn't answer. 1 ======
When programming your Atmel Avr with avrdude, you could get this error :
$ sudo avrdude -p m48 -c usbasp -U lfuse:w:0xc2:m
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
It is often due to fuse bits setted for using an external oscillator. To change this, just plug a crystal oscillator (4 MHz for example) between pin XTAL1 and XTAL2 of your AVR. Plug also two 15 pF capacity between XTAL1 and Ground and between XTAL2 and Ground. \\
\\
Then you can program your AVR to use the internal oscillator. Here the avrdude command line for an atmega48 using an usbasp programmer :
$ sudo avrdude -pm48 -cusbasp -Ulfuse:w:0xc2:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9205
avrdude: reading input file "0xc2"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xc2:
avrdude: load data lfuse data from input file 0xc2:
avrdude: input file 0xc2 contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Now you can remove your crystal oscillator and the two capacity. You should be able to program your AVR.