Programming ATmega328 without external oscillator

Is it possible to download program from full Arduino UNO board into single ATmega328 chip?
What are limitations for program running on single ATmega328 without external oscillator?
Is there ATmega328 specification I can put into my \hardware folder?

Thank you in advance.

The Arduino Uno board is a ATmega328, with RX and TX connected to USB. So there is nothing special about it.

If you choose to burn the bootloader with the Arduino, the Arduino programs the bootloader in flash and also sets the fuses.
The fuses are for 16MHz external. So that's a problem.

Solution: you have create your own board in boards.txt
For the fuses, you could use this: AVR® Fuse Calculator – The Engbedded Blog
You might want to use an existing bootloader, so you don't need to make your own.
The bootloader sets the baudrate according to the cpu clock, so you may want to choose a bootloader for a 8MHz Arduino (Fio, LilyPad, Pro mini).

I have done this, but it's some time ago.

Krodal,

If I got you correctly I need to perform next steps:

  1. Burn into ATmega328 boot loader for board which is based on same chip but use internal 8MHz clock.
  2. As soon the boot is burned set "board" option in Arduino IDE to some section which values match fuses set by burned boot.

The biggest obstacle you might encounter is the precision of the internal 8MHz clock - so most probably you will not be able to upload the sketch reliably without knowing the exact internal frequency..

Running 328p&1284p with internal oscillator (8.000MHz tuning):

http://arduino.cc/forum/index.php/topic,61501.0.html

Baruch:
Is it possible to download program from full Arduino UNO board into single ATmega328 chip?
What are limitations for program running on single ATmega328 without external oscillator?
Is there ATmega328 specification I can put into my \hardware folder?

To download to a standalone ATMega328 chip read this http://arduino.cc/en/Tutorial/ArduinoISP/ for how to connect everything up. Before connecting it though upload ArduinoISP to your UNO then connect up to your standalone 328. Select Tools->Programmer->Arduino as ISP and select Tools->Board->LilyPad Arduino w/ ATmega328.
Load the sketch you want to burn to the standalone 328 into the IDE and select File->Upload Using Programmer.

The main limitations of using internal oscillator are mostly slower code execution (half the speed) but depending on project this may not be important. An advantage is lower power consumption and ability to run on 3.3V instead of 5V.

I think the Lillypad arduino uses internal 8Mhz oscillator so you should be able to use it's board definition without having to create new entry in \hardware\arduino\board.txt

Looks like this convinced me to use external oscillator with ATmega328 or use some model of Atmel ATtiny.

Baruch:
Krodal,
If I got you correctly I need to perform next steps:

  1. Burn into ATmega328 boot loader for board which is based on same chip but use internal 8MHz clock.
  2. As soon the boot is burned set "board" option in Arduino IDE to some section which values match fuses set by burned boot.

I ment this:
(1) Check that link for the fuses.
(2) Create your board in boards.txt, using the code for the fuses, and using an existing bootloader (of an other board with the same microcontroller at 8MHz.
(3) Use the Arduino and select your own board. Burn the bootloader in your standalone chip. Perhaps using a USBasp programmer (easy) or an Arduino as ISP (less easy).

The bootloader doesn't have to know where the clock is coming from, either internal or external. That's all up to the fuses. But the bootloader must match the frequency and the microcontroller.

But if you use a 16MHz crystal, you avoid all this. So my standalone microcontroller has a 16MHz crystal, and all library functions and timings are the same as a normal Arduino Uno. It's a lot easier.

You don't need to program a bootloader into your mcu, you can program your sketch directly into it via ICSP, which is the same mechanism you would use to program a bootloader into it. Unless you need precise timing for some other reason, that also means you don't need to use a crystal or ceramic resonator, you can use the internal 8MHz clock instead. See Prototyping small embedded projects with Arduino | David Crocker's Solutions blog for more.

You can even try ArduinoToBreadboard... I gave it an attempt after getting my shipment of '328's, but I personally find it easier to use 16MHz crystals (available for about $0.33 ea. online). Good Luck!

Mr_E :slight_smile: