ATmega328P-PU on breadboard

Hello , recently , I've bought 2 chips of ATMEGA328P-PU with Arduino Bootloader - Uno . and I want to use this chips on breadboard without any crystal , with internal clock . so saw many tutorials and nothing was done . I used local tutorials but there are errors . first of all , first error was that there was not arduino_pins.h file in specified folder so I found this file (standart) in arduino IDE and copied in specified folder what was in error . then there were no erros but, when I upload ISP on arduino board and connect every pin to another Atmega328 chip RX and TX LEDs blink 2-3 times and that's all . then it says that there is error resp() 0x00;

everything works well when I try to program this external atmega with crystal and removed atmega on board .

Please help me.

If the chips you bought have been configured for external crystal then the bootloader on them was also configured for external crystal. To get them working using there internal 8Mhz oscillator you will need to program a bootloader that works at 8Mhz and set the fusebits accordingly.

I don't know how to do so , as I guess this is colled parrarel programming . it would be great if you give me some precise definition and step by step tutorial . thank you in advance .

Seem like... unless you really need to use the internal 8Mhz oscillator ... it would be far less of a headache to just add a crystal to the breadboard with a couple of caps. They don't cost much. The chip should work with an external 8 MHz, just slower.

I have breadboarded a 328 using the internal oscillator. It is not hard. Arduino IDE comes with a bootloader you can use. It is call ATmegaBOOT_168_atmega328_pro_8MHz.hex. Now you need to set the fuse bits to activate the internal oscillator and set the divider to 1. The bytes are low_fuses=0xE2 high_fuses=0xDA

I added the following definition to my Boards.txt

BB1.name=Breadboard w/ ATmega328 Internal Oscillator BB1.upload.protocol=arduino BB1.upload.maximum_size=30720 BB1.upload.speed=57600 BB1.bootloader.low_fuses=0xE2 BB1.bootloader.high_fuses=0xDA BB1.bootloader.extended_fuses=0x05 BB1.bootloader.path=atmega BB1.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex BB1.bootloader.unlock_bits=0x3F BB1.bootloader.lock_bits=0x0F BB1.build.mcu=atmega328p BB1.build.f_cpu=8000000L BB1.build.core=arduino BB1.build.variant=standard

I have done some testing but not exhaustive testing. I works fine for me, so far.

BTW: Contrary to popular belief, you do not need a bootloader to use the Arduino IDE or run sketches. I once used the Arduino IDE to load the "Blink" sketch on a virgin chip. It didn't work as normal because it was compiled for an Uno running at 16MHz but was loaded onto a chip using the internal oscillator at 1MHz. So as you can imagine, the LED came on for 16 seconds and them went off for 16 seconds. I later loaded a bootloader and set the fuses using the definition above and all ran well.

The Bootloader is ONLY needed if you want to load your script via the serial port. If you use the ISP it is not needed. I do use the bootloader and that is why I loaded it.

"Now you need to set the fuse bits to activate the internal oscillator and set the divider to 1."

That's where the AVR ISP comes in - I'm pretty sure you have to set the fuses via the SPI signals on the ICSP connector.

Get yourself an AVR ISP, such as: http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415

or learn how to use an Uno as an AVR ISP,

or get a crystal and 2 caps and run at 16 MHz:

http://www.dipmicro.com/store/XC7-16000 http://www.dipmicro.com/store/C1K22-1000

I used crystal and 2 caps and it worked fine . but I want to use this chips with it internal clocks . I am bit confusing BB1.name=Breadboard w/ ATmega328 Internal Oscillator BB1.upload.protocol=arduino BB1.upload.maximum_size=30720 BB1.upload.speed=57600 BB1.bootloader.low_fuses=0xE2 BB1.bootloader.high_fuses=0xDA BB1.bootloader.extended_fuses=0x05 BB1.bootloader.path=atmega BB1.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex BB1.bootloader.unlock_bits=0x3F BB1.bootloader.lock_bits=0x0F BB1.build.mcu=atmega328p BB1.build.f_cpu=8000000L BB1.build.core=arduino BB1.build.variant=standard

where should I add this piece of code ? I downloaded atmega328 bootloader and in this text doc , or where ?

I want to use this chips on breadboard without any crystal , with internal clock

http://www.gammon.com.au/forum/?id=11637

That should be all you need.

thank you very much boredat20 , it worked great but when I wrote simple blink LED , on chip without external crystal LED needs too much time to blink than LED on arduino board /. why ?

as I discovered , AVR chips has it's own internal clock divider , and it divides 8MHz on 8 and it works on 1Mhz ? please , can anyone solve this problem for me ? or just advice what to do ? thank you in advance .

giorgi111-111: as I discovered , AVR chips has it's own internal clock divider , and it divides 8MHz on 8 and it works on 1Mhz ?

That is what I said at the end of Reply #4. I also gave my solution.

Okey but where I have to add this text ? nick gammons posts helped me very mush but , my clock is on 1MHz and how can I change it ?>

giorgi111-111: Okey but where I have to add this text ? nick gammons posts helped me very mush but , my clock is on 1MHz and how can I change it ?>

The choice of oscillator Int/Ext is part of what the fuse bytes do. So to change the divide by 8 to divide by 1 to go for 1Mhz to 8MHz clock you change the fuse bits. There are several fuse calculators. I have seen them as web apps and Android apps. You should be able to find one with a google search.

The file to update is ..\arduino\hardware\arduino\boards.txt. After updating this file, the IDE will show the new board as a selection. If you select the "Breadboard", it will use the information to compile sketches with the correct clock rate.

So what are your options for putting sketches on you breadboard? You can use the serial interface to flash your sketch. You need to know what baud rate the boot loader will use and set that in the board definition. The other option is to use the ISP interface. To do that you need an ISP programmer. It can be a stand alone programmer or an Arduino with an ISP sketch loaded. You will need to use an ISP programmer to set the fuse values. You can use the same interface to load sketches.

I hope this answers all your questions.