Programming Atmel328P-PU bootloader fails

I have several new Atmel328P-PU ICs that fail at this so I don't think it is the IC that is the issue. I have breadboarded my Atmel328P-PU similar to the one found 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 a Pololu AVR USB Programmer (Pololu USB AVR Programmer) 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 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 have tried using the Arduino IDE with Duemilanove w/Atmega328 board selected, COM3 (programmer COM) and programmer is AVR ISP.

The error is "avrdude: stk500_getsync(): not in sync: resp=0x00"

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

Thank you

sl33k3r:
I have several new Atmel328P-PU ICs that fail at this so I don't think it is the IC that is the issue.

It might be.

If they've had a bootloader burned onto them then you need the external crystal to be able to do anything with them.

You'll also have to edit the fuse settings in your boards.txt so that when you burn the bootloader they won't be set to use an external clock. The clock select bits are the lower four bits in "low_fuses". See the datasheet...

Sorry, I forgot to mention that I did change the boards text to reflect what I found in Atmel Studio.

boards.txt data for

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

Thank you for your assistance

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.

atmega328.bootloader.low_fuses=0x62
atmega328.bootloader.high_fuses=0xD9

these are not the correct fuses for using the internal 8MHz clock and the arduino bootloader.
You have the CLKDIV8 fuse set, which divides the internal clock by 8 (1MHz clock rate), and you have a bootloader size of 2k words selected, rather than 2k bytes. I think you want E2/DA/FF...

That said, I don't think this should have interfered with burning the bootloader, only with using it afterward.
Turn on "verbose upload" in the preferences, and you might get some additional useful information.
Unfortunately, the "Not in Sync" error is a catch all that only means you aren't communicating, without telling you why not...

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):

The device is shipped with internal RC oscillator at 8.0MHz and with the fuse CKDIV8 programmed,
resulting in 1.0MHz system clock. The startup time is set to maximum and time-out
period enabled. (CKSEL = "0010", SUT = "10", CKDIV8 = "0"). The default setting ensures that
all users can make their desired clock source setting using any available programming interface.

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 will check the low and high fuses as well, thank you.

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

Yep. It definitely needed more plot development and character involvement.

I heard they've got a new writer for Datasheet II.

Datasheet II

They added gratuitous color instead. You know, to increase the cost of printing, or something. :frowning:

I use this: AVR® Fuse Calculator – The Engbedded Blog

You shouldn't be using a bootloader if you are using the internal clock. Because the bootloader for the atmeg328p works over the serial port, you need to provide a clock within about 4% of the value you set F_CPU to. The internal clock is only specified to be within 10% of the nominal 8MHz as the chip is shipped, and only then at one particular voltage (3V AFAIR). So you can't reliably run a bootloader using the internal oscillator unless you calibrate the clock.

The solution is to do exactly what you have done, i.e. upload your sketch directly using the programmer.