Go Down

Topic: Cannot upload sketches after burning bootloader (Read 5306 times) previous topic - next topic

aluminumati

I was following this tutorial:
http://arduino.cc/en/Tutorial/ArduinoToBreadboard

I was able to burn the bootloader to my atmega328 (no crystal connected; I used the internal 8 MHz clock). Now when I'm trying to upload sketches as shown in that tutorial, I keep getting this error:

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

I've been tusseling with this quite a bit today but cannot figure out what might be causing this.

Coding Badly


Huh.  The wiring for "Minimal Circuit - Uploading" is not complete.  The processor has to reset at the beginning of an upload for the upload to work.  I suggest adding a reset button and trying an upload using a manual reset.  Please report back if you get it working.

WyvernX86

I just worked through this tonight and got it working. I was trying the same thing, burning the bootloader to an atmega328 (internal clock) and went through several attempts before I got it working.
Note that I was using a UNO to do this.


Try 1
   1) Following tutorial

Result with reset jumped to pin 1:
   avrdude: stk500_getsync(): not in sync: resp=0x00
   avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Try 2
   1) boards.txt to changed
   From
   atmega328bb.bootloader.high_fuses=0xD9
   To
   atmega328bb.bootloader.high_fuses=0xD8
   2) Re burnt bootloader

Result with reset jumped to pin 1:
   avrdude: stk500_getsync(): not in sync: resp=0x00
   avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Try 3
   1) Boards.txt changed
   From
   atmega328bb.upload.speed=57600
   To
   atmega328bb.upload.speed=19200

Result with reset jumped to pin 1:
   avrdude: Expected signature for ATMEGA328P is 1E 95 0F
           Double check chip, or use -F to override this check.

Try 4
   1) boards.txt changed
   From
   atmega328bb.bootloader.file=ATmegaBOOT_168_pro_8MHz.hex
   To
   atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
   2) Change speed line back to
   atmega328bb.upload.speed=57600
   3) Re burnt bootloader
   
Result with reset jumped to pin 1:
   SUCCESS
   
   
TLDR
- Use the following boards.txt to burn the bootloader and upload sketches.
- Follow the tutorial instructions except add a jumper wire from the Arduino boards RESET to pin 1 of the atmega when uploading sketches.

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

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

atmega328bb.upload.protocol=stk500
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600

atmega328bb.bootloader.low_fuses=0xE2
#atmega328bb.bootloader.high_fuses=0xD9
atmega328bb.bootloader.high_fuses=0xD8
atmega328bb.bootloader.extended_fuses=0x07
atmega328bb.bootloader.path=arduino:atmega
#atmega328bb.bootloader.file=ATmegaBOOT_168_pro_8MHz.hex
atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino:arduino



WyvernX86

If you don't want to pop the atmega out of the Arduino board to upload sketches you can use the following instructions and boards.txt. The only caveats are that you have to erase the breadboarded atmega manually each time before uploading a sketch, and the bootloader will not be present.

- Upload the ArduinoISP sketch to the Arduino board

- Wire things up like so
http://arduino.cc/en/uploads/Tutorial/SimpleBreadboardAVR.png

- command to erase the breadboarded atmega (note: change COM7 to whatever port the Arduino board is on)
avrdude -P COM7 -b 19200 -c avrisp -p m328p -e


boards.txt

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

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

atmega328bb.upload.protocol=stk500
atmega328bb.upload.maximum_size=30720
#atmega328bb.upload.speed=57600
atmega328bb.upload.speed=19200
atmega328bb.upload.communication=serial

atmega328bb.bootloader.low_fuses=0xE2
#atmega328bb.bootloader.high_fuses=0xD9
atmega328bb.bootloader.high_fuses=0xD8
atmega328bb.bootloader.extended_fuses=0x07
atmega328bb.bootloader.path=arduino:atmega
#atmega328bb.bootloader.file=ATmegaBOOT_168_pro_8MHz.hex
atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino:arduino


modemch

Can someone please edit the tutorial to change atmega328bb.bootloader.high_fuses=0xD8, and use the correct bootloader image? I wasted 3 days trying to track this down, came here to post the solution and lo and behold, here it is.

The way it's currently written is worse than not working at all, it will actually upload the sketch once, but because the fuse value is wrong it won't work again until the chip is wiped and a bootloader is re-written.


I just worked through this tonight and got it working. I was trying the same thing, burning the bootloader to an atmega328 (internal clock) and went through several attempts before I got it working.
Note that I was using a UNO to do this.


Try 1
   1) Following tutorial

Result with reset jumped to pin 1:
   avrdude: stk500_getsync(): not in sync: resp=0x00
   avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Try 2
   1) boards.txt to changed
   From
   atmega328bb.bootloader.high_fuses=0xD9
   To
   atmega328bb.bootloader.high_fuses=0xD8
   2) Re burnt bootloader

Result with reset jumped to pin 1:
   avrdude: stk500_getsync(): not in sync: resp=0x00
   avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Try 3
   1) Boards.txt changed
   From
   atmega328bb.upload.speed=57600
   To
   atmega328bb.upload.speed=19200

Result with reset jumped to pin 1:
   avrdude: Expected signature for ATMEGA328P is 1E 95 0F
           Double check chip, or use -F to override this check.

Try 4
   1) boards.txt changed
   From
   atmega328bb.bootloader.file=ATmegaBOOT_168_pro_8MHz.hex
   To
   atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
   2) Change speed line back to
   atmega328bb.upload.speed=57600
   3) Re burnt bootloader
   
Result with reset jumped to pin 1:
   SUCCESS
   
   
TLDR
- Use the following boards.txt to burn the bootloader and upload sketches.
- Follow the tutorial instructions except add a jumper wire from the Arduino boards RESET to pin 1 of the atmega when uploading sketches.

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

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

atmega328bb.upload.protocol=stk500
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600

atmega328bb.bootloader.low_fuses=0xE2
#atmega328bb.bootloader.high_fuses=0xD9
atmega328bb.bootloader.high_fuses=0xD8
atmega328bb.bootloader.extended_fuses=0x07
atmega328bb.bootloader.path=arduino:atmega
#atmega328bb.bootloader.file=ATmegaBOOT_168_pro_8MHz.hex
atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino:arduino




aluminumati

Huh, I was wondering if a fuse was set incorrectly. Glad that got cleared up! Thank you for all the responses! I'm going to try this later today. I'll let you know if it worked for me!

aluminumati

Ok so I just tried this using a Duemilanove and it did not work. I got this error when burning the bootloader:

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

So it sounds like it works for the Uno but not Duemilanove.

aluminumati

Ok so I had some time today to try again. This time I tried putting the blank ATmega328P chip in the Arduino board and flashing the bootloader with the AVR Dragon. And IT WORKED!!!!

Here's what I did (sorry if some points are vague. I'd be glad to verify any confusions):

HOW TO BURN THE ARDUINO BOOTLOADER TO THE DUEMILANOVE WITH AVR DRAGON:

1. Place desired Atmega328P chip in the Arduino board.

2. Connect the ICSP header connections to the AVR Dragon ISP header as shown in the AVR Dragon User's Guide in
AVR Studio.

*I had an external 9V power supply connected to the Arduino so it wasn't draining so much power from the Dragon, but it
wasn't required.

3. Set the Input hex file path under Program path to
<location>\arduino-0022\hardware\arduino\bootloaders\atmega\ATmegaBOOT_168_atmega328.hex

4. Make sure the fuses are set to: (in order as Extended, High, Low)
0xFD 0xDA 0xFF

5. The Lockbits should be: 0xCF

6. I set the ISP frequency to 125 kHz. This is because the chip in the board is fresh out of the Atmel manufacturing
center.

7. Under Auto be sure the following boxes are checked: Erase Device, Program FLASH, Verify FLASH, Program Fuses, Verify Fuses,
Program Lockbits, and Verify Lockbits

8. Go!

kllsamui

#8
Jul 07, 2011, 05:35 pm Last Edit: Jul 09, 2011, 06:01 am by kllsamui Reason: 1
following
http://arduino.cc/en/Tutorial/ArduinoToBreadboard
using a 2009 and burning bootloader (2009) worked, while new cpu 328 in
-- breadboard or
-- UNO board!
BUT ONLY WHEN USING ARDUINO 21 (upload, burn bootloader),
not when i used ARDUINO 22.

following
Uploading Using an Arduino 2009 Board ( as FTDI, without CPU)
using circuit
http://arduino.cc/en/uploads/Tutorial/ArduinoUSBSerial.png
did not work.
after i added one more wire from RESET header of 2009 board to pin1 of breadboard cpu
it worked!
pls change that ArduinoUSBSerial.png, thanks


Go Up