Atmega168PA-PU on arduino uno R3 issue

Hello,

I have an Arduino UNO R3 board in which I want to replace the Atmega328 with Atmega168PA-PU.
IDE ver 1.0.5.

I’ve added new flavor of the UNO to the C:\Program Files\Arduino\hardware\arduino\boards.txt file as following:

##############################################################

uno168.name=Arduino Uno w/ ATmega168p
uno168.upload.protocol=arduino
uno168.upload.maximum_size=15872
uno168.upload.speed=115200
uno168.bootloader.low_fuses=0xff
uno168.bootloader.high_fuses=0xdd
uno168.bootloader.extended_fuses=0xfc
uno168.bootloader.path=optiboot
uno168.bootloader.file=optiboot_atmega168.hex
uno168.bootloader.unlock_bits=0x3F
uno168.bootloader.lock_bits=0x0F
uno168.build.mcu=atmega168p
uno168.build.f_cpu=16000000L
uno168.build.core=arduino
uno168.build.variant=standard

##############################################################

uno.name=Arduino Uno w/ ATmega328
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.speed=115200
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.core=arduino
uno.build.variant=standard

##############################################################

My changes are in red.

I’ve programed the optiboot_atmega168.hex bootloader from C:\Program Files\Arduino\hardware\arduino\bootloaders\optiboot using AVRISP mkII and Atmel studio 6.1 (the internal IDE programmer doesn’t recognize the AVRISP mkII – any idea?).

Now, when I try to load a Sketch to the board I get the message :

avrdude: Expected signature for ATMEGA168P is 1E 94 0B
Double check chip, or use -F to override this check.

Any idea what I’ve done wrong?

The 168P has a different signature than the 168 (non-P); Arduino supports the latter, and the bootloader will report that the device is a 168 even if it is really a 168P.

This is actually the preferred method, IMO. Change your boards.txt to say that you have a 168, and program the bootloader with a version of AVRdude that supports the 168P (rather than using the IDE.) Thereafter, Arduino software will think you have a regular 168.

For most practical purposes, there are no differences between a 168 and 168p.

Thanks!
it works.