Error in uploading a bootloader to Atmel328P-PU

The AVR USB programmer https://www.pololu.com/catalog/product/1300 is getting an error from Arduino IDE.

avrdude: stk500_getsync(): not in sync: resp=0x00

The basic setup is like here → http://arduino.cc/en/Main/Standalone except I do not have the 16Mhz crystal, SKU BOB-08508 or the FT232 breakout board. I have the AVR USB Programmer mentioned before connected as follows:

MISO → Pin 18
VDD → Pin 7
SCK → Pin 19
MOSI → Pin 17
RST → Pin 1
GND → Pin 8

There is a steady 11.75 volts feeding my breadboard where is is regulated down to 4.95 volts to feed the breadboard.

The green light on the programmer is steady except for a few flickers after trying to initialize upload of the bootloader. The yellow LED has a steady flash slightly less than a second.

I have quit the Arduino IDE and edited the boards.txt to reflect the lack of an external crystal to the atmega328.build.f_cpu=8000000L instead of the original 16000000L. This made no difference.

I also have other Atmega328P-PU ICs that are also new with the same results.

I can connect to the Atmel328P-PU with Atmel Studio 6.0 and retrieve data from the IC after lowering the ISP clock to 57.6 kHz.
Device Information

Detected device
Device name       ATmega328P
Device signature  0x1E950F

Datasheet information
                ATmega328P
CPU              8-bit AVR
Flash size       32 Kbytes
EEPROM size      1 Kbytes
SRAM size        2 Kbytes
VCC range       1.8 - 5.5 V
Maximum speed       N/A

Fuses

BODLEVEL = DISABLED
RSTDISBL = [ ]
DWEN = [ ]
SPIEN = [X]
WDTON = [ ]
EESAVE = [ ]
BOOTSZ = 2048W_3800
BOOTRST = [ ]
CKDIV8 = [X]
CKOUT = [ ]
SUT_CKSEL = INTRCOSC_8MHZ_6CK_14CK_65MS

EXTENDED = 0xFF (valid)
HIGH = 0xD9 (valid)
LOW = 0x62 (valid)

Lock Bits

LB = NO_LOCK
BLB0 = NO_LOCK
BLB1 = NO_LOCK

LOCKBIT = 0xFF (valid)

I can also access the fuses.

I have searched and come up empty. Please help if you are able.

Thank you

Hi,

Since you can connect to the Atmel328P-PU, it is a good sign your basic setup works. Your problem is likely in the settings you chose in the Arduino IDE.

You might check to see if you are using the correct COM port. Also, it would be helpful if we knew what the actual AVRDUDE command is, (the Arduino IDE usually doesn’t tell you). Could you use just AVRDUDE instead and tell us the exact command you typed?

Please post a picture of your connections, what version Arduino IDE you are using and what your settings are for the Board, Programmer and Serial Port.

-Derrill

I can program and read to/from my Baby Orangutan B-328 and read from the Atmega328P-PU with the USB AVR Programmer so I don’t believe it is a defective USB AVR Programmer.

The programmer is using Pololu USB AVR Programmer Programming Port (COM3).

The Arduino IDE is as follows:
Version 1.0.3
Board = Arduino Duemilanove w/ ATmega328
Serial Port = COM3
Programmer = AVR ISP

board.txt

atmega328.name=Arduino Duemilanove w/ ATmega328

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

atmega328.bootloader.low_fuses=0x62
atmega328.bootloader.high_fuses=0xD9
atmega328.bootloader.extended_fuses=0xFF
atmega328.bootloader.path=atmega
atmega328.bootloader.file=ATmegaBOOT_168_atmega328.hex
atmega328.bootloader.unlock_bits=0x3F
atmega328.bootloader.lock_bits=0xFF

atmega328.build.mcu=atmega328p
atmega328.build.f_cpu=8000000L
atmega328.build.core=arduino
atmega328.build.variant=standard

I tried Avrdude with command

"avrdude" -p m128 -c avrisp -P com3 -U flash:w:"C:\arduino-1.0.3\hardware\arduino\bootloaders\atmega\ATmegaBOOT_168_atmega328.hex":a

Avrdude returned: avrdude: stk500_getsync(): not in sync: resp=0x00

From the USB AVR Programmer Utility:
ISP Frequency = 4.0 kHz
minimum voltage = 4832 mV

Error From Last Programming:
The SPI command for entering programming mode was sent, but the expected response from the target was not received. Make sure that the ISP frequency setting is less than 1/4th of the target’s clock frequency.




Great job responding with the settings and pictures we needed! It is good to see you were able to use AVRDUDE so quickly.

It looks like you have a parameter in your command of “m128”. Please try changing it to “m328p”.

-Derrill

I still haven’t been able to get a bootloader to upload to the Atmega328P-PU, but I did get a simple blink program to upload by using Atmel Studio and pre-compiling the program, then opening the Device Programming (On the Tools menu), selecting the proper programmer and IC then changing the ISP frequency to 14.07 kHz. I then selected “Memories”, loading the pre-compiled blink program and uploading it from there. Only thing is…it operates at 1/4 speed. The internal clock must be WAY OFF! I am ordering crystals and going external for the clock.

I will try changing the m128 to m328p as well, but I think my biggest issue is the internal clock rate.

Upon waking this morning, I checked the datasheet for internal timing and sure enough…the CKDIV8 selected means that the internal clock is at 1/8 speed.

From the datasheet (p. 27):

I deselected the CKDIV8 and applied the changes. Immediately my blink program was running at a speed which I thought it should have been.

I could have saved a lot of time by reading the datasheet. Too bad it’s so dry to read.

I have not had any success uploading the bootloader to the 328P and now i have Atiny85 and still cannot upload a bootloader to it either. The programmer works fine for uploading programs and reading from the ICs, but will not upload a bootloader. Any suggestions or clarifications I can make?

Now this is odd…just turned on verbose setting in Arduino IDE and I am able to upload the sketches to my Attiny85. Will check later on the Atmega328p.

Thank goodness