Go Down

Topic: [Fixed] Unable to upload to AtMega328 on breadboard (Read 4752 times) previous topic - next topic

retrolefty



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)

GregM



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.

retrolefty

Quote
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  :D

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


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 :)

retrolefty


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 :)



Good plan.  ;)

Loudhvx

#20
Mar 02, 2011, 11:14 pm Last Edit: Mar 02, 2011, 11:18 pm by Loudhvx Reason: 1
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.  
Quote
: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.

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.

Loudhvx

#22
Mar 03, 2011, 03:31 am Last Edit: Mar 03, 2011, 03:39 am by Loudhvx Reason: 1
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.

GregM

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.

Crook


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

3D Artist,Modeler, Texturer, Animator, Electronics and Robotics, Programming C, VB, Website Design, Flash animator

Too many hobbies?

alparent


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?

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.

GregM


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!

alparent


Wooooo hoooooooo!!!!


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

Loudhvx

#29
Mar 03, 2011, 05:40 pm Last Edit: Mar 03, 2011, 05:43 pm by Loudhvx Reason: 1

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)?

Go Up