[SOLVED]Problem when burning bootloader to ATmega168PA-AU

Hello,

I have made a perfboard circuit for bootloading Atmega328P-AU which works fine using the ArduinoISP sketch with a Arduino Nano.

I'm trying to use ATmega168PA-AU instead of 328P-AU for my project. As their pin assignment are the same, I use the same circuit for bootloading the 328p-au. This time, I'm using Nick Gammon's sketch and it detects the 168PA-AU without any problem. After sending "G" in serial monitor, it said "Clearing 'Divide clock by 8' fuse bit" and started "fixing low fuses setting". However, It could no longer enter programming mode and the chip could not be detected anymore (Failed to enter programming mode. Double-check wiring!). I have tried 2 168PA-AUs and the results are the same. I have been searching for hours and still could not solve the problem. Does anyone have faced the same problem before? Thanks for your time.

EDIT:

I found that I used a 1k pull-up resistor for the RESET pin instead of a 10k. After replacing that and adding two 0.1uF decoupling caps, it works fine now! Wonder why the 1k pullup works for 328P. Hope this would help someone in the future!

Have you tried just doing the standard Tools > Burn Bootloader of the Arduino IDE instead of using that Nick Gammon sketch?

I did. For the first time it said the signature is 0x1e940b which didn’t match the expected signature for m168 = 0x1e9406. Then I tried Nick Gammon’s sketch and now I am getting 0xff0000 using the standard Burn Bootloader from the Arduino IDE (tried selecting Nano and Duemilanove as the board). I suspect it has something to do with the crystal, but i do have a 16MHz and 22pF caps connected to pin 7 and 8 so I’m not sure.

Thanks for your reply.