Atmega328 - 28PU bootloader issues with USBasp | DIY arduino

Yesterday i put together a diy arduino based off the instructions on this website http://www.makeuseof.com/tag/dont-spend-money-on-an-arduino-build-your-own-for-much-less/ The chip i bought was this particular one which does not come with a pre-installed bootloader: http://www.altronics.com.au/p/z5125-atmel-avr-atmega328-28pu-28-pin/ I am trying to flash the bootloader onto the chip using a USBasp but i just cant seem to get it to work. I have been looking all over the internet and still cant seem to find a solution. I keep getting the same error which is "cannot get sck period". I have some experience flashing speed controllers for quadcopters using the USBasp and from my experience when you get this error it is usually because of a connection error. I cannot for the life of me work out the solution to this with the diy arduino. Here is a link for some images of the build. http://imgur.com/a/hTZ6x If anyone has a solution it would be greatly appreciated.

Some bad USBasp sticks just can not get the sck right. Use the newest avrdude (the one with Arduino IDE 1.5.7 BETA for example) and you can slow it down with a few options.

I have two older USBasp sticks. One works better on one computer, and the other works better on my other computer. Sometimes a usb hub helps, or shorter or longer cables. But in the end you might have to buy a new USBasp stick.

The ATmega328 is not Arduino compatible. You need the ATmega328p (the 'p' for picopower). Is the "ATmega328-28PU" an official notation ? Is it a new one that runs at 28MHz ? The ATmel site is too slow to check it at the moment.

This is the USBasp i have, bought off ebay maybe 8-10 months ago. http://imgur.com/JbZZAOi I have succesfully reflashed Quadcopter and speed controllers before so in theory there should be no reason why this shouldnt work. It does however seem that these can be a bit hit and miss. I have a FTDI adapter on the way i just cant wait, my impatience is the worst! How do i use the latest AVRDUDE? Is that automatic when using the latest Arduino IDE or is there something else i have to do?

I thought you used avrdude directly somehow. But using the Arduino IDE to write a bootloader is better (it also sets the fuses). The avrdude is part of the Arduino IDE, so you automatically have a good version of avrdude :)

Some USBasp sticks seems to work fine, but not in every situation. I have had the same experience. You can try those things I mentioned, and check the voltage of the target. Did you decouple the Vcc and GND with 100nF ?

I'm new to this so youre going to have to explain what you mean by decoupling. I'm also assuming you mean 100 nano farad capacitor? And i also assume i will need a multimeter to measure the voltage of the target, might be a good excuse to finally get one.

That link you gave shows an Arduino compatible setup, but there are no decoupling capacitors.

A value of 100 nano Farad is mostly used, and it connects to 5V and GND. When the ATmega chip is running, the 5V can have noise and dips, created by the ATmega chip itself. The 100nF prevents that. It is sometimes called a decoupling capacitor.

Can you have a look at the ATmega chip with a magnifier ? Which chip is it ? Using a ATmega328p is so much easier, because it is Arduino compatible.

A multimeter on Ebay costs 4 dollars, but they can be 20% inaccurate. This one is better : http://www.adafruit.com/products/2034 A good multimeter can last for 50 years : http://www.amazon.com/Fluke-117-Electricians-True-Multimeter/dp/B000O3LUEI

Here is my favorite multimeter video: http://www.youtube.com/watch?v=rPGoMbVSUu8

I have a 100uF capacitor connected to the ground and ground rails. Thats the furthest left cap in this photo: http://i.imgur.com/LDBHxdV.jpg. Is this the same thing?

The top of the chip says: Atmega328P-PU. By the sounds of it the chip is arduino compatible.

Would a multimeter like this one be too cheap and inaccurate? http://www.altronics.com.au/p/q1053a-digital-multimeter-19-range-with-transistor-test/

Do you have a 10K resistor pulling reset (pin 1) to V+ and how are you connecting the USBasp to the 328. All the programming pins you use look to be in the right place on the board but to what pins are they connected on the USBasp.

mickeymug: I keep getting the same error which is "cannot get sck period". I have some experience flashing speed controllers for quadcopters using the USBasp and from my experience when you get this error it is usually because of a connection error.

no. you are the 401 thousandth person to say that. in fact that is not an error at all. just a warning and should be ignored.

from my experience all the cheapest usbasp from ebay work fine. since yours works with other avr chips it is virtually impossible thats the problem. your chip is maybe defective or wired wrong. pay attention to the other hints in this thread.

or more likely you have the wrong part selected. there are many variations of m328. i suggest using avrdude from the command line and try to read fuses with -F option. post results here to find what your problem really is.

Peter_n: A multimeter on Ebay costs 4 dollars, but they can be 20% inaccurate.

i disagree. ive obtained dozens of those same cheap meters from harbor freight and a few from ebay. every time theres a coupon in a mag i pick one up for free. worth the trip just for that 9v battery. anyway they test accurate to withing a fraction of a percent every time. even if they didnt there is a trimpot inside that would allow dead on calibration at least as good as the $100 ones. a modern technological marvel.

Perhaps I bought one or two, that were not calibrated with the trimpot.
I have a fluke, but always in the wrong place. So I bought a cheap one, just to grab it when I need it.

Ar the moment i dont have a pull down resistor, just a push button switch between the reset pin and ground. Should i put a resistor in? I will try all the things suggested after class. Thanks for all the help!

mickeymug: Ar the moment i dont have a pull down resistor, just a push button switch between the reset pin and ground. Should i put a resistor in? I will try all the things suggested after class. Thanks for all the help!

Pullup not pulldown. You need to connect it between reset and VCC [u]not[/u] reset and GND.

Added in the resistor, it works! Thanks everyone for your help and answering my noobie questions.

Glad you got it working okay.