[Fixed] Unable to upload to AtMega328 on breadboard

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:

From what I've read, you must have the crystal and two caps. Without them requires a different bootloader which specifies to use the internal clock. The standard bootloaders must use an external clock.

I may have it wrong, but I think it's all in that first link you provided in the first thread. It talks about using a different bootloader in order to use the "minimal" setup.

:Be sure to select "ATmega328 on a breadboard (8 MHz internal clock)" when burning the bootloader.

I still haven't tried my Sparkfun chips yet, but it seems that's not the problem since it works in your UNO.

When I got the original UNO chip working on the breadboard, I had the crystall and two caps as specified on the SparkFun site.

I tried doing just what you are attempting and failed. Resorted to putting the chip in an arduino, uploading the sketch, popping it out and putting it into the breadboard circuit. That worked. I'm curious to see if anyone has a solution that actually works to upload a sketch from a chipless arduino directly onto a breadboard mounted chip.

I just did it with the SparkFun 328 (Duemilanove bootloaded). It worked perfectly. I was able to upload sketch after sketch with no problem. As you said, I had to select Duemilanove as the board.

Full details:
I put the Sparkfun atmega328 (preloaded with the Duemilanove bootloader) into a breadboard circuit with a stepper controller and external 5v supply. I then connected four wires from the breadboard to the UNO (without a 328 chip on board): ground, reset, Rx, Tx. Make sure to use the pin mapping page to know which pins to connect. I also have a 10k pullup resistor on the reset pin of the 328 (other end of the resistor is connected to 5v on the breadboard). I connected 5v to the 328 for vcc(pin7), aref(pin21), avcc(pin20). I connected ground to the 328 for the two GND(pins 8 and 22) connections. I connected a 16mhz crystal to pins 9 and 10 of the atmega328. I also connected one cap to each of those pins and ground. The USB connection provided the 5 volts to the empty UNO board. Then I just treated the whole thing like a normal Duemilanove board (even though it's actually an UNO).

When I selected UNO as the board, it failed as expected with:
stk500_getsync()
stk500_disable()
etc.

After the sketches loaded, I could unplug the USB cable, disconnect the reset line, and it worked as a standalone. I could reset the board using the reset wire to ground, or I could just power cycle the supply.

Couple of notes about the bootloaders: Both chips (original UNO 328 with optiboot, and Duemilanove 328 with older bootloader) would take about one second before starting the sketch after a manual reset. However, and this is a big deal for me, the UNO with optiboot starts immediately on power up, but the Duemilanove still waits for one second after power up.

I am going to have to find a way to get the optiboot bootloader on these chips from Sparkfun. If I can figure that out, then I can also buy the cheaper chips.

Loudhvx - thanks for the post the confirming it works. I'll try again tonight and follow your steps and let you know how it turns out.

CristobalGordo:
I tried doing just what you are attempting and failed. Resorted to putting the chip in an arduino, uploading the sketch, popping it out and putting it into the breadboard circuit. That worked. I'm curious to see if anyone has a solution that actually works to upload a sketch from a chipless arduino directly onto a breadboard mounted chip.

I built something for that a while ago, but doesn't require taking the chip out of the arduino:

http://arduino.cc/forum/index.php/topic,8084.0.html

Crook:
I built something for that a while ago, but doesn't require taking the chip out of the arduino:

http://arduino.cc/forum/index.php/topic,8084.0.html

That's a great idea....so simple. Why didn't I think of that?

The problem with the "Uploading Using an Arduino Board" example, is that they don't tell you that you need a wire connecting the 2 reset pins.

alparent:
The problem with the "Uploading Using an Arduino Board" example, is that they don't tell you that you need a wire connecting the 2 reset pins.

Wooooo hoooooooo!!!! That fixed it!! Connected reset from the Uno to the reset of the 328 on the breadboard and it worked first time!

Thanks a ton!

GregM:
Wooooo hoooooooo!!!!

That's the exact same thing I said when I finally got it to work.

alparent:
The problem with the "Uploading Using an Arduino Board" example, is that they don't tell you that you need a wire connecting the 2 reset pins.

Wow, I didn't even notice that. I didn't find those instructions until after I had it working so I assumed they had the reset lines conected. I would have mentioned it earlier if I had known, sorry. (This is still all pretty new to me.) I wonder why they show the reset lines when burning bootloaders, but don't show them for either of the uploadingsketch examples?

So it works without even using the crystal on the breadboard? Does it still run the sketch if you disconnect the UNO board entirely (with another power source)?

Crook:

CristobalGordo:
I tried doing just what you are attempting and failed. Resorted to putting the chip in an arduino, uploading the sketch, popping it out and putting it into the breadboard circuit. That worked. I'm curious to see if anyone has a solution that actually works to upload a sketch from a chipless arduino directly onto a breadboard mounted chip.

I built something for that a while ago, but doesn't require taking the chip out of the arduino:

http://arduino.cc/forum/index.php/topic,8084.0.html

I like that as well. How is the switch connected to the socket? I have several sockets coming from Sparkfun, So I'd probably like to give this a try.

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

I get mine from Futurlec 3.50$ and I put the optiboot on them myself using the Arduino as ISP.

Thanks everyone for the help. Just glad its working.

Now to break it all and try and upgrade the bootloader :smiley:

GregM:
Thanks everyone for the help. Just glad its working.

Now to break it all and try and upgrade the bootloader :smiley:

Please keep us up to date on that. I think I need to update my Sparkfun chips too.

Apparently there is a member (WestFW, I think) here who corrected some of the bugs in the first version of optiboot. He also has a thread on how to put the new bootloader on UNO boards.

Loudhvx:

Crook:

CristobalGordo:
I tried doing just what you are attempting and failed. Resorted to putting the chip in an arduino, uploading the sketch, popping it out and putting it into the breadboard circuit. That worked. I'm curious to see if anyone has a solution that actually works to upload a sketch from a chipless arduino directly onto a breadboard mounted chip.

I built something for that a while ago, but doesn't require taking the chip out of the arduino:

http://arduino.cc/forum/index.php/topic,8084.0.html

I like that as well. How is the switch connected to the socket? I have several sockets coming from Sparkfun, So I'd probably like to give this a try.

It was actually a little hellish with my thick fingers, but I drilled a hole through the side of the DIL socket, removed the pin from the socket and repositioned it through the hole and connected it to a pin on the switch which was glued there. Then from the other switch contact I set up a winding contact under the socket and to an added pin to finally connect back underneath the DIL socket pin.

I'm sure there is a market for a DIL socket with little DIP switches along the sides, breaking contacts if needed? I've found 2 uses for such a thing already - this one, and just today disabling the reset pin for burning bootloaders onto blank atmega328's.

Thanks Crook. Yeah that seems a little hairy to put together. But I like the idea. I wonder if they make sockets with really long legs in a 28 pin size. I have some, but they are only 14 or 16 legs.