burning bootloader

Hi, I first time tried burning bootloader to Atmega168PA-PU w/ Arduino as ISP.

My board is Duemilanove with 328 chip. I wired as described here: http://arduino.cc/en/Tutorial/ArduinoToBreadboard

Then uploaded the ISP code to the the board. Finally, started burning the bootloader to the target chip.

Burning seems done with no problem. During the process RX and TX LEDs blinked and IDE output was done uploading.

Next I replaced 328 chip with the new 168 and changed the board definition in Tools menu accordingly (i.e. to a 168 chip), then opened the Blink exampled to burn. Burning failed.

Tried several time again and failed.

I guess the problem is something simple I just don't know, please tell me what it is if possible.

Where are the ERROR MESSAGES ? :0

Your problem is in line 42.

What do you mean line 42 please?

Error: not in sync !

if needed, I will repeat again and post here all the detail of the message. I thought this is what everybody knows other than me :D

"Error in line 42". 42 - "the meaning of life, the universe, and everything" (Hitchhiker's Guide to the Galaxy).

That is one of my standard replies I give to posters not giving sufficient information to give a sensible answer.

Binary sketch size: 1018 bytes (of a 30720 byte maximum) avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

And which bootloader did you burn?

And why does it show 30720 bytes? The 168 doesn't have 32k of flash.

zaputalca!

I’m using Atmega168PA-PU, may be that’s the reason?

I’ll now repeat again and post the results

Another question: on Arduino board I have a 328 chip, on breadboard I have 168PA-PU (to be bootloader burnt) is this making the issue?

You must make sure to select the right board/chip-type before you burn the bootloader and before you press upload. But that is obvious, isn't it?

Everybody may miss things when doing first time.

I chose the correct board with 328 chip as I have, then I loaded Arduino ISP program that makes the board a programmer, from this point there is a question:

where should I get the bootloader from? In Arduino folder I have hardware, then bootloader folder with hex files and a .c file. Arduino IDE will neither load hex nor .c but .pde.

If possible please explain this.

Assuming your ArduinoISP is still working:

0) make sure 'auto-reset' is disabled on your arduino board used as programmer 1) select the correct board/chip you want to program (168 in your case). 2) press burn bootloader "w/ Arduino as ISP".

If you want to know what happens behind the scenes, press and hold the 'shift' key before you click on the burn button.

http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

Thank you really for detailed instruction,

Please let me know make sure all points I got right and on what I still have questions..

1) select the correct board/chip you want to program (168 in your case).

this is the start of my confusion point: a) from the IDE menu, you do not have 2 choices, one for board, the other for target MCU, but only one choice for board b) my board has a 328 chip, so I used to program it with the board selected as a Duemilanove w/ ATmega328, and on my breadboard I have my target chip which is Atmega168PA-PU c) I am not sure if at all Atmega168PA-PU could be programmed with the bootloader hex file of a general 168 found under hardware folder. I checked the datasheet and Atmega168PA-PU can have up to 20Mhz crystal so that should be ok (theoretically), I am using a 16Mhz crystal as usual, but I'm not sure if any change in source of bootloader is needed for Atmega168PA-PU or not.

a) Yes... If you run your new 168 with 16MHz, choose the 'Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168' board type for the target to be programmed b) That was correct. ArduinoISP runs on the 328 chip. c) You don't have to change the source, as long as you stick to either 8MHz or 16MHz.

As you have the 168PA chip variant, you may experience error messages about a wrong device signature.

Thank you very much for making me clear!

Please give a final confirmation if I got the right process: 1. I choose board as a "w/ Atmega328" and burn the ArduinoISP sketch into my 328 chip on the board 2. Having my Atmega168PA-PU on the breadboard, I wire as stated on the official tutorial (link above) 3. From the Tools menu, I "change" the board declaration to 'Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168' 4. From Tools menu, I'll finally click on 'burn bootloader w/ Arduino as ISP'

Now shall I count down to zero and fire? :D

You need to disable auto-reset on the 328 board (after ArduinoISP upload), or your PC will talk to your 328 board (again).

Other than that, it sounds OK.

If you get: "yikes! invalid device signature" report back ;-)

oh no, just as you predicted :(

ERROR while burning bootloader: avrdude: Expected signature for ATMEGA168 is 1E 94 06 Double check chip, or use -F to override this check.

HELP! SOS! :D

I burnt bootloader to 3 Atmega168 chips. Two of them being 10PU but I run the 16Mhz and burning was successful: I removed the ISP chip of board, leaving the 10PU on breadboard and loaded the Blink sketch to it and put LED all ok.

So there is proof of concept (i.e. I wired ok and I got the process as explained above right), but what to do with those new ATmega168PA-PU ones? I still tried some more and same error:

ERROR while burning bootloader: avrdude: Expected signature for ATMEGA168 is 1E 94 06 Double check chip, or use -F to override this check.

Help? :D

You need to create a new board-type for this chip in 'boards.txt'.

Duplicate one that works with your 168-PU chip, give it a new name + description and replace 'XXX.build.mcu=atmega168' with 'XXX.build.mcu=atmega168p'.

Please let me check if I got it right,

What I used with my 168-10PU was just what you instructed, i.e. 'Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168', so I added this to the end of file (not yet tested, making sure here), please see if I changed right:

pro5v.name=Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168PA-PU

pro5v.upload.protocol=stk500 pro5v.upload.maximum_size=14336 pro5v.upload.speed=19200

pro5v.bootloader.low_fuses=0xff pro5v.bootloader.high_fuses=0xdd pro5v.bootloader.extended_fuses=0x00 pro5v.bootloader.path=atmega pro5v.bootloader.file=ATmegaBOOT_168_diecimila.hex pro5v.bootloader.unlock_bits=0x3F pro5v.bootloader.lock_bits=0x0F

pro5v.build.mcu=atmega168p pro5v.build.f_cpu=16000000L pro5v.build.core=arduino

Looks ok, except you need to give it a unique name!

myboard.name=... myboard.upload... ...

madworm: Looks ok, except you need to give it a unique name!

myboard.name=... myboard.upload... ...

Thanks again, I changed it this way:

my168papu.name=Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168PA-PU

my168papu.upload.protocol=stk500
my168papu.upload.maximum_size=14336
my168papu.upload.speed=19200

my168papu.bootloader.low_fuses=0xff
my168papu.bootloader.high_fuses=0xdd
my168papu.bootloader.extended_fuses=0x00
my168papu.bootloader.path=atmega
my168papu.bootloader.file=ATmegaBOOT_168_diecimila.hex
my168papu.bootloader.unlock_bits=0x3F
my168papu.bootloader.lock_bits=0x0F

my168papu.build.mcu=atmega168p
my168papu.build.f_cpu=16000000L
my168papu.build.core=arduino

and got the error message, I guess that means the declaration of this chip is not presented, but where to get it?

avrdude: AVR Part "atmega168p" not found.

Valid parts are:
  m6450 = ATMEGA6450      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:11732]
  m3250 = ATMEGA3250      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:11543]
  m645 = ATMEGA645       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:11354]
  m325 = ATMEGA325       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:11165]
  usb1287 = AT90USB1287     [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:10977]
  usb1286 = AT90USB1286     [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:10788]
  usb647 = AT90USB647      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:10599]
  usb646 = AT90USB646      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:10409]
  t84  = ATtiny84        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:10226]
  t44  = ATtiny44        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:10044]
  t24  = ATtiny24        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:9862]
  m2561 = ATMEGA2561      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:9669]
  m2560 = ATMEGA2560      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:9476]
  m1281 = ATMEGA1281      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:9288]
  m1280 = ATMEGA1280      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:9099]
  m640 = ATMEGA640       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:8911]
  t85  = ATtiny85        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:8730]
  t45  = ATtiny45        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:8551]
  t25  = ATtiny25        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:8371]
  pwm3b = AT90PWM3B       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:8190]
  pwm2b = AT90PWM2B       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:8007]
  pwm3 = AT90PWM3        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:7824]
  pwm2 = AT90PWM2        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:7640]
  t2313 = ATtiny2313      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:7453]
  m328p = ATMEGA328P      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:7265]
  m168 = ATMEGA168       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:7077]
  m88  = ATMEGA88        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:6891]
  m48  = ATMEGA48        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:6704]
  t861 = ATTINY861       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:6516]
  t461 = ATTINY461       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:6327]
  t261 = ATTINY261       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:6138]
  t26  = ATTINY26        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:5981]
  m8535 = ATMEGA8535      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:5823]
  m8515 = ATMEGA8515      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:5665]
  m8   = ATMEGA8         [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:5505]
  m161 = ATMEGA161       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:5365]
  m32  = ATMEGA32        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:5190]
  m6490 = ATMEGA6490      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:4997]
  m649 = ATMEGA649       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:4812]
  m3290 = ATMEGA3290      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:4629]
  m329 = ATMEGA329       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:4444]
  m169 = ATMEGA169       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:4264]
  m163 = ATMEGA163       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:4121]
  m162 = ATMEGA162       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:3925]
  m644p = ATMEGA644P      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:3734]
  m644 = ATMEGA644       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:3543]
  m324p = ATMEGA324P      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:3351]
  m164p = ATMEGA164P      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:3159]
  m16  = ATMEGA16        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:2981]
  c128 = AT90CAN128      [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:2790]
  m128 = ATMEGA128       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:2612]
  m64  = ATMEGA64        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:2431]
  m103 = ATMEGA103       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:2291]
  8535 = AT90S8535       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:2170]
  8515 = AT90S8515       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:2056]
  4434 = AT90S4434       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:1973]
  4433 = AT90S4433       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:1849]
  2343 = AT90S2343       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:1725]
  2333 = AT90S2333       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:1640]
  2313 = AT90S2313       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:1527]
  4414 = AT90S4414       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:1414]
  1200 = AT90S1200       [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:1299]
  t15  = ATtiny15        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:1166]
  t13  = ATtiny13        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:993]
  t12  = ATtiny12        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:860]
  t11  = ATtiny11        [D:\arduino-0023\arduino-0023\hardware/tools/avr/etc/avrdude.conf:796]