Go Down

Topic: Programming Atmel328P-PU bootloader fails (Read 2019 times) previous topic - next topic


Feb 06, 2013, 04:02 pm Last Edit: Feb 06, 2013, 04:13 pm by sl33k3r Reason: 1
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 (http://www.pololu.com/catalog/product/1300) 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
Code: [Select]
Detected device
Device name       ATmega328P
Device signature  0x1E950F

Datasheet information
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

Code: [Select]
DWEN = [ ]
WDTON = [ ]
EESAVE = [ ]
BOOTSZ = 2048W_3800
CKDIV8 = [X]
CKOUT = [ ]

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

Lock Bits
Code: [Select]

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


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...

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)


Feb 06, 2013, 04:20 pm Last Edit: Feb 06, 2013, 10:35 pm by sl33k3r Reason: 1
Sorry, I forgot to mention that I did change the boards text to reflect what I found in Atmel Studio.

boards.txt data for

Code: [Select]
atmega328.name=Arduino Duemilanove w/ ATmega328




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.


Feb 07, 2013, 06:26 am Last Edit: Feb 07, 2013, 06:34 am by westfw Reason: 1

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.


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.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)


Datasheet II

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

I use this:  http://www.engbedded.com/fusecalc


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.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131