[Fixed] Unable to upload to AtMega328 on breadboard

I've been fiddling around with the Arduino Uno and am now ready to program a ATMega328 (which I got from Sparkfun preprogrammed with the bootloader)

The followed the steps here http://arduino.cc/en/Tutorial/ArduinoToBreadboard
Removed the chip from the uno, wires it to the breadboard, added in 16Mhz xtal, 22pF caps, and applied power.

When I upload I get:
Uploading to IO board
And then after 20 secs
Problem uploading to board.
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expected=0x14, resp=0x51

Any ideas? The guide seems fairly straightforward bit I can't get it working? :frowning:

I just did that last night (but not on the Sparkfun chips as explained below) and it worked fine, so I know it's doable.

You are uploading a sketch, correct, not the bootloader?

What is your power hookup? The chip would not run with the reset line connected if the UNO board was not powered. I was using seperate 5v for the breadboard, so I did not share a power line with the UNO, (but still shared ground, of course). When I pulled the USB cable, the UNO would power down and lockup the chip on the breadboard. Disconnecting the reset line, then power cycling the chip cleared that.

Correct - uploading a sketch.

Tried this guide - didnt help either.
http://www.ladyada.net/learn/arduino/help.html

A quick question - how do I know the chips I bought really have the bootloader code on them - the label says so but if it doesn't then it wont work.

I mean its supposed to be simple but its not working.

GregM:
Correct - uploading a sketch.

Tried this guide - didnt help either.
Arduino Tutorial - Learn electronics and microcontrollers using Arduino!

A quick question - how do I know the chips I bought really have the bootloader code on them - the label says so but if it doesn't then it wont work.

I mean its supposed to be simple but its not working.

Can you put the chip directly into the UNO? That would test it.

I also just got the bootloaded SparkFUn atmega328.But I haven't tried it yet.

I'll try to test it later at work.

I was using the chip pulled out of the UNO.

Loudhvx:
Can you put the chip directly into the UNO? That would test it.

Should that work? I've tried 2 chips and put them into the Uno and tried to program my sketch. Both fail.

I can only upload my sketch to the Uno with the original 328 in it.

Tried powering from a external 5V and using the 5V from the Uno. Didnt make any difference.

Also tried using the breadboard.zip file and using the simple circuit which doesnt require the xtal and cap - still not working.

What board are you selecting before attempting to upload a sketch to your breadboard 328 chip? As the sparkfun chip doesn't contain the uno bootloader but rather the older standardard 328 bootloader running at slower baudrate you must select the board type in the IDE that matches the chip's bootloader.

Lefty

retrolefty:
What board are you selecting before attempting to upload a sketch to your breadboard 328 chip? As the sparkfun chip doesn't contain the uno bootloader but rather the older standardard 328 bootloader running at slower baudrate you must select the board type in the IDE that matches the chip's bootloader.

Lefty

The 328's I got from Sparkfun say "Atmega328 with Arduino bootloader"

I'm using the "Arduino Duemilanove or Nano w/ ATmega328" in the IDE.

That's correct, must be something else.

I was under the impression that the SparkFun atmega328 with Arduino bootloader pre-burned was able to go into the socket on the UNO and work just like the original UNO.

The only thing to keep straight is to put the chip into the socket the correct way. Note the chip has a little tongue-shaped cutout on one end. This lines up with the tongue-shaped cutout on the socket (away from the USB connection side).

But I haven't tried mine yet. I'll try that later today too.

Loudhvx:
I was under the impression that the SparkFun atmega328 with Arduino bootloader pre-burned was able to go into the socket on the UNO and work just like the original UNO.

Nope - not mine. Will be interesting to see if yours do. I"ve now tried all 3 I purchased.

So when I test the Sparkfun chips, I should select Duemilanove as the board?

I'll try that too, then.

Yes - select "Arduino Duemilanove or Nano w/ ATmega328"

I think I read last night, a thread showing how to install the new Optiboot bootloader onto a 328 using the UNO board. I may have to try this too if the Sparkfun chips are really using the older bootloader.

Loudhvx:
I think I read last night, a thread showing how to install the new Optiboot bootloader onto a 328 using the UNO board. I may have to try this too if the Sparkfun chips are really using the older bootloader.

Hopefully they dont have older bootloader otherwise I want a refund from Sparkfun :slight_smile:

GregM:

Loudhvx:
I was under the impression that the SparkFun atmega328 with Arduino bootloader pre-burned was able to go into the socket on the UNO and work just like the original UNO.

Nope - not mine. Will be interesting to see if yours do. I"ve now tried all 3 I purchased.

It should work, you just can't select the Uno as the board type, but rather the prior 328 board type (one with the funny name)

retrolefty:
It should work, you just can't select the Uno as the board type, but rather the prior 328 board type (one with the funny name)

Ok - getting somewhere. I used the Sparkfun 328's in the Uno and selected "Arduino Duemilanove or Nano w/ ATmega328" and uploaded my sketch to it and it works fine.

So its not the 328 and the bootloader is fine.

I've double and triple checked my circuit and it looks fine, and yet it still refuses to upload.

I've double and triple checked my circuit and it looks fine, and yet it still refuses to upload.

Bad interconnections on the breadboard?
Wrong crystal cap sizes?
Wrong crystal frequency?
Wiring error that you just can't see because you are the one that wired it up :smiley:

Sometimes it can be a bear getting things just right, but I think you must be close.

If I was to suggest anything else it would be to add two .1ufd 'bypass' caps right near where the two ground the +5vdc wires attach to the 328 chip, one cap across pins 7 & 8 and the other across pins 20 & 22. Extra power supply noise filtering never hurts.

Lefty

I think its jinxed.

I've tried the simple circuit which doesnt require caps and a xtal - doesnt work.
Added in decoupling caps - doesnt work.

I'll start from scratch tomorrow and maybe it will work :slight_smile:

GregM:
I think its jinxed.

I've tried the simple circuit which doesnt require caps and a xtal - doesnt work.
Added in decoupling caps - doesnt work.

I'll start from scratch tomorrow and maybe it will work :slight_smile:

Good plan. :wink: