Uploading sketches to an ATmega on a breadboard, 8 MHz internal clock

I (think I) have been able to bootload the chip on breadboard using Uno and these instructions:

Used ArduinoISP from Arduino-0022 due to the bug with bootloading, otherwise using 1.0 (and bootloaded using that aswell).

But I am unable to upload sketches. If I select "ATmega328 on a breadboard (8 MHz internal clock)" and try to compile, I get

In file included from C:\Users\asdf\Desktop\arduino-1.0\libraries\OneWire/OneWire.h:7,
from Fan_PWM_PID.cpp:2:
C:\Users\asdf\Desktop\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:212:26: error: pins_arduino.h: No such file or directory

On the other hand, if I select Uno I get
"avrdude: stk500_getsync(): not in sync: resp=0x00"

Is this breadboard profile only for bootloading or am I missing the include file?

The .zip file in that tutorial is outdated! Don't use it with 1.0

Take the standard boards.txt file of your IDE and modify/add one entry to your needs.

To get the fuses right, please use the online fuse calculators for AVR (see my signature). It is rather easy to use. It works both ways. Either set the fuses and get the hex-values you need, or enter hex-values and see what they mean.

OK, but shouldnt the fuses in the boards.txt be correct atleast?

It has now Low 0xE2, High 0xDA and Extended 0x05.
Seems the extended flags control only brown-out detection, and if I enter 0x05 the the calculator I get BODLEVEL1, 2.7 V. But selecting the same setting in calculator gives 0xFD, it varies between 0xFF and 0xFC.

Do you think this entry looks correct?

##############################################################
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=0xDA
atmega328bb.bootloader.extended_fuses=0x05
atmega328bb.bootloader.path=arduino:atmega
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
atmega328bb.build.variant=standard

The fuses look ok to me.

Regarding the 0xFC vs. 0x05 business... you should read everything on that site, especially the RED text.

I see. Both 0x05 and 0xFD have LSB 101.

OK, it is working nicely! Thanks for helping an Arduino (though not embedded programming) noob!

Google translate says: "olet tervetulleita"

You're the judge if it is any good :wink:

Hi Guys

so it works with using Arduino Uno as ISP? in 8Mhz? i thought this is only works with Duemilanove:

"Note that these techniques only work with the Arduino Duemilanove w/ an ATmega328, not the Arduino Uno (or older Arduino boards w/ an ATmega168)."

if it does work, does the atmega328p work with only vcc and gnd?

thank you!

L

If you can upload the "ArduinoISP" sketch to your Arduino board, it should work.

A blank (fresh from factory) ATmega168/328 chip will work with just 5V and GND. Don't forget a small capacitor (4.7µF or so for starters) between 5V and GND.

Depending on the FUSE settings you program, this may change and it may need an external crystal / resonator. These things are only a couple of cents, best to have at least one just in case.