Making own SMD pcb using atmega168

Hi, I've been doing some work on making my own "arduino" compatible board using SMD version of Atmega168 20AU (the same as used on Arduino Nano). I have been able to solder it perfectly, so regarding the size, I love this chip. But, I had some problems uploading program. At first I used only USBtinyISP to upload the sketch like described here, without using bootloader. It worked, let's say. But the program was about at 1/10 of it's speed (for example, blink sketch with 100ms delays in between worked with a delay of approximately 1s). Then I wanted to upload the bootloader and then everything came to a stop. It just wouldn't upload the bootloader: avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check. After trying this, I couldn't even upload the sketch, so whatever I try, I get this message. (remember, I was able to upload the sketch before trying to upload the bootloader).

My question is: has anyone dealed with this kind of problem, or at least used this kind of Atmega in he(she)'s own project and made it work?

Regards, Peter

what did you set the fuses to, what clock are you running it at?

That's the problem, as I didn't set anything. Why? Because the direct uploading worked with DIP28 package chips and I thought it would be the same with the SMD version. Could you please help me with these settings, as I am a full beginner with setting fuses etc.

Regards, Peter

you should be able to find the correct fuse settings in boards.txt, as far as programming them

http://www.ladyada.net/learn/avr/avrdude.html

at the bottom

by default I think avr’s are set to use the internal oscillator, 8Mhz, and divide by 8 giving you a clock speed of ~1Mhz

though trying to burn the bootloader should set the fuses, so maybe you have something else going on, I am hardly an expert

also once you set the fuses they wont change unless you tell them to, which is probably why it worked fine on your dip chip

I tryed setting fuses via avrdude -p m168 -c usbtiny -U lfuse:w:0xE2:m (I found that at: http://diydrones.com/profiles/blogs/tutorial-getting-those-pesky

but I still get avrdude: initialization failed, rc=-1

btw, does it matter what I connected to the board, should I programm it with on without the crystal?

Try slowing the bit clock with the -b switch. Try -b 100 and see if it programs. I have seen 168's come in with fuse settings that require a slow bit clock for the initial programming but work fine afterwards.

(* jcl *)