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