SOLVED: ATmega168 does not run in external circuit after it is programmed by ISP

Hello guys,

I have problem with my new ATmega168. I bought new chip with no arduino bootloader and, create circuit and followed steps as described here:
http://www.micahcarrick.com/tutorials/avr-microcontroller-tutorial/getting-started.html
(schema is too atached).

I tried too blink sketch compiled with arduino ide, and manually compiled and uploaded this:

#define F_CPU 1000000UL

#include <avr/io.h>
#include <util/delay.h>

int
main (void)
{
    DDRB |= _BV(DDB0); 
    
    while(1) 
    {
        PORTB ^= _BV(PB0);
        _delay_ms(500);
    }
}

Everything seems to by fine. Chip was programmed and verified correctly (i try to use avrdude and avrstudio).

Output here:

avrdude -p m168 -c avrispmkII -P usb -e -U flash:w:blik.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9406
avrdude: erasing chip
avrdude: reading input file "blik.hex"
avrdude: input file blik.hex auto detected as Intel Hex
avrdude: writing flash (198 bytes):

Writing | ################################################## | 100% 0.06s                                                                                                           
                                                                                                                                                                                    
avrdude: 198 bytes of flash written                                                                                                                                                 
avrdude: verifying flash memory against blik.hex:                                                                                                                                   
avrdude: load data flash data from input file blik.hex:                                                                                                                             
avrdude: input file blik.hex auto detected as Intel Hex                                                                                                                             
avrdude: input file blik.hex contains 198 bytes                                                                                                                                     
avrdude: reading on-chip flash data:                                                                                                                                                
                                                                                                                                                                                    
Reading | ################################################## | 100% 0.06s

avrdude: verifying ...
avrdude: 198 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

But after reset no led blink on any pin. Where can be problem? I changed the fuse bits to this values (disable bootloader):
lfuse: 0x62, hfuse: 0xdf, efuse:0xfe.

Can anybody help me please? I check circuit 3x. Thanks a lot… Some files attached

blik.hex (578 Bytes)

Blinkx.cpp.hex (2.93 KB)

Haven’t looked up the fuse values, but I am tempted to suspect it may require a crystal.

Check out Nick!

Since you are using a low fuse set to 0x62 it is configured to use the internal oscillator at a 8MHz/8.So it should be running at 1Mhz Did you have access to a scope? You could set the PORTB0 to output the clock signal and measure it to see if it's really working. To do this you must set the low fuse to 0x22

I do not have aparature for measure frequency. But I can add an external oscilator. What oscilator can I use? 8MHz or 16MHz? How can I set fuses values according to: 1) No bootloader 2) External oscillator

Is this correct for 8MHz oscilator and no bootloader? lfuse: 0x7f, hfuse: 0xdf, efuse: 0xfe

Fuses confuses me... Thanks..

Is this correct for 8MHz oscilator and no bootloader? lfuse: 0x7f, hfuse: 0xdf, efuse: 0xfe

Fuses confuses me... Thanks..

Fuses are not hard to understand.In fact they are pretty simple Visit this online calculator: http://www.engbedded.com/fusecalc Here you choose your target CPU and at the bottom page you have the fuse values.If you grab your values lfuse: 0x7f, hfuse: 0xdf, efuse: 0xfe and insert it there you can see what changes are in fact being done in the table.

Ok, so I upgrade my ISP firmware, rebuild the whole circuit again (and use external 16MHz crystal), program fuses to: lfuse: 0xff, hfuse: 0xdd, efuse: 0x00 as described for "Arduino Diecimila or Duemilanove w/ ATmega168" and now it is working.. It is so beautiful. I do not know exactly where was a mistake, but I am happy that it is working now. Thanks for advices.