I have been working on creating a stripped down Arduino project that uses the ATMEGA328 chip without the Arduino board.
After buying a bunch of ATMEGA328 chips with UNO bootloader installed I found that I was unable to get the Arduino on a breadboard example to work(found Here)
The reason for this is that once a chip is boot loaded with a boot loader that requires a crystal oscillator (or any external oscillator for that matter) it needs to be connected to the external clock source before you can overwrite the bootloader or even overwrite any of the fuse bits.
Since my ATMEGA328s were boot loaded with an UNO bootloader I needed to attach a 16MHz crystal. There are cases that I’ve read about where people have accidentally set the fuse bits to expect some other clock input. The way they got around this is by using another micro controller to provide the clock signals while overwriting the boot loader.
In my case, I don’t have an UNO but I do have an Arduino Nano (v3.0). So to overwrite the boot loader I set it up as follows
Points to note:
Capacitor between 5V and Reset is 10μF and is used to override the automatic reset on connection
The crystal oscillator is 16MHz with two 22pF capacitors
- Set up your project as seen above
- Download the board spec for Arduino on a breadboard from here
- Unzip the file and place it in the ‘hardware’ folder in your Arduino directory (don’t place the .txt file as it is, instead place the folder in the hardware directory. It should looks something like this ../Arduino/hardware/ATMEGA328/boards.txt
- Restart the Arduino IDE
- Select the board you connected on the correct port. In my example the board is an Arduino Nano w/ ATMEGA328
- Burn the Ardunio ISP sketch from the examples onto your board.
- Next select ‘ATMega328 on Breadboard (8MHz internal clock)’ from your boards
- Now select Tools>Programmer>Arduino as ISP
- Then select Tools>Burn Bootloader