Arduino ATMega328 ONE without external crystal.

The purpose of this post is to provide a definitive guide to using the Arduino ATMega328 ONE without external crystal, using its internal 8 MHz oscillation. Some of the concepts should be defined as follows:

  • The 2-pin microcontroller where the crystal is connected, what will happen to them? Will it be used as I / O? How to program pin numbering will (20 and 21)?
  • Since the oscillation frequency in half (from 16 MHz to 8 MHz), what about the function millis()? What the function delay()? to count 1 ms 2 ms must pass.
  • Both the settings of the 2-pin I / O as the adjustment of external to internal oscillation, directly affect the bootloader code? Then what bootloader you must load the microcontroller? Would it be a new board which would be selected from the Tools - Board menu?

Step 1: Select "Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328" from Boards Step 2: Burn the bootloader

You should be able to use the crystal pins for i/o but you'll have to use Direct Port Access.

albuino: - Since the oscillation frequency in half (from 16 MHz to 8 MHz), what about the function millis()? What the function delay()? to count 1 ms 2 ms must pass.

compiler will take care of that if you have the right frequency selected , which for 8mhz should look like this atmega328.build.f_cpu=8000000L but as johnwasser said selecting 'Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328' will take care of you most problems now youll only need an isp programmer to burn the bootloader

Go use a 644/1284:

Port Pin Alternate Functions PB7 XTAL2 (Chip Clock Oscillator pin 2) TOSC2 (Timer Oscillator pin 2) PCINT7 (Pin Change Interrupt 7)

PB6 XTAL1 (Chip Clock Oscillator pin 1 or External clock input) TOSC1 (Timer Oscillator pin 1) PCINT6 (Pin Change Interrupt 6)

• XTAL2/TOSC2/PCINT7 – Port B, Bit 7 XTAL2: Chip clock Oscillator pin 2. Used as clock pin for crystal Oscillator or Low-frequency crystal Oscillator. When used as a clock pin, the pin can not be used as an I/O pin. TOSC2: Timer Oscillator pin 2. Used only if internal calibrated RC Oscillator is selected as chip clock source, and the asynchronous timer is enabled by the correct setting in ASSR. When the AS2 bit in ASSR is set (one) and the EXCLK bit is cleared (zero) to enable asynchronous clocking of Timer/Counter2 using the Crystal Oscillator, pin PB7 is disconnected from the port, and becomes the inverting output of the Oscillator amplifier. In this mode, a crystal Oscillator is connected to this pin, and the pin cannot be used as an I/O pin. PCINT7: Pin Change Interrupt source 7. The PB7 pin can serve as an external interrupt source. If PB7 is used as a clock pin, DDB7, PORTB7 and PINB7 will all read 0.

• XTAL1/TOSC1/PCINT6 – Port B, Bit 6 XTAL1: Chip clock Oscillator pin 1. Used for all chip clock sources except internal calibrated RC Oscillator. When used as a clock pin, the pin can not be used as an I/O pin. TOSC1: Timer Oscillator pin 1. Used only if internal calibrated RC Oscillator is selected as chip clock source, and the asynchronous timer is enabled by the correct setting in ASSR. When the AS2 bit in ASSR is set (one) to enable asynchronous clocking of Timer/Counter2, pin PB6 is disconnected from the port, and becomes the input of the inverting Oscillator amplifier. In this mode, a crystal Oscillator is connected to this pin, and the pin can not be used as an I/O pin. PCINT6: Pin Change Interrupt source 6. The PB6 pin can serve as an external interrupt source. If PB6 is used as a clock pin, DDB6, PORTB6 and PINB6 will all read 0.