Arduino Forum

Using Arduino => Programming Questions => Topic started by: pcfr33k on Oct 10, 2012, 05:50 am

Title: [SOLVED] ATmega328 on BreadBoard Bootloader Question
Post by: pcfr33k on Oct 10, 2012, 05:50 am
I am beating my head against the wall here.  I figured out how to use the reset switch on the ATmega328 on a Breadboard to successfully upload any and all sketches.   The procedure is not exactly the same with Burning a new Bootloader onto the ATmega328 and I cannot figure out why or if this is normal or not?

I cannot release the Reset button until the bootloader has been burned and verified.   If release it for example while its verifying the burn I get a error.

If I release the Momentary Switch at any time the process fails.  Yet I can release the button when uploading a sketch usually right after I see the message come up on the window, I forget exactly what it is, but the point is, it works every time when I upload a sketch.

If I keep the button depressed the entire time until I see "DONE" or "COMPLETE", the bootloader successfully burns, with no errors!!

Does this sound normal??

It doesn't matter if I use an Arduino Uno R3 or the USBtinyISP as the host, I get the same results.

I know my connections are 100% correct on the breadboard.

Maybe the bootloader never really burns even when it says its successful?  Is there a way to wipe the bootloader just to make sure I really am burning a new one?  This of course is another question but would like to know if the procedure above sounds normal to you or not



Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: CrossRoads on Oct 10, 2012, 05:57 am
I don't normally press the reset  button at all (or include one on boards even).
The ICSP programmer connected to the ICSP header should take control of the reset pin.

Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: pcfr33k on Oct 10, 2012, 05:59 am
I don't use the ICSP header.  I connect the pins to 13,12,11 etc!!
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: CrossRoads on Oct 10, 2012, 06:06 am
"I connect the pins to 13,12,11"

And to Reset? No?  Maybe that's the problem.
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: pcfr33k on Oct 10, 2012, 06:08 am
There is a reset Pin # 1 and another reset pin on the opposite side don't remember the pin # but I tried it that way to. UNless I am connecting it wrong?

So you don't do anything for Pin #1 and connect only the reset pin on the opposite side of the chip to the RST or equivalent on the ICSP board?

EDITED:

http://www.arduino.cc/en/Main/Standalone
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: CrossRoads on Oct 10, 2012, 06:13 am
"There is a reset Pin # 1 and another reset pin on the opposite side don't remember the pin # but I tried it that way to."
Opposite side of what?
You said you had a breadboard - is that where the reset button is you are talking about?

"RST or equivalent on the ICSP board"
You are using an Uno or something as the programmer?
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: pcfr33k on Oct 10, 2012, 06:20 am
Opposite side of Pin # 1 on the ATmega328.

The reset button is on the breadboard for Pin #1

I am using the USBtinyISP and an Arduino UNo R3 without the CHip of course.

I have connected the other reset pin to RST or equivalent  name to the ICSP controllers with the same result.  I have to hold down the reset button on the breadboard to burn it successfully!!


Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: CrossRoads on Oct 10, 2012, 06:28 am
Opposite of pin #1 being pin #28? That is not a reset pin, that is AnalogInput5 pin.

I don't know what's going on with your reset, doesn't sound like something is correctly connected.
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: pcfr33k on Oct 10, 2012, 06:30 am
When I say opposite side I did not mean directly opposite the pin I meant the other side!!  I just don't have the pin # with me
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: WizenedEE on Oct 10, 2012, 06:37 am
would these be helpful?
(http://www.jameco.com/Jameco/workshop/JamecoBuilds/arduinocircuit_fig12.jpg)
ICSP pinout (6 pin is the one arduino uses)
(http://image.pinout.net/pinout_10_pin_files/avr_icsp.png)

There is only one reset pin on each one, so if you try to take an alternate path... I don't see how.
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: pcfr33k on Oct 10, 2012, 06:44 am
I am using the Tiny USB for now.  I did use the header.  The RST on the header of the ISP should be connected to the reset pin #1 on the ATmega328 on the breadboard correct?

I have done this and it fails every time!!

If I use the reset switch on the breadboard from pin # 1 and leave it depressed the entire time I burn a bootloader without any issues what so ever.

Ok so there is no reset pin on the right side of the ATmega328 so I connect RST from the ISP header to pin #1 right side of the ATmega328?

Doing it this way does not work for me and I cannot figure out why?  MOSI/MISO/RST/SCK/Vcc and Gnd connections are done correctly but unless I have a reset switch on Pin #1 of the Atmega328 on the breadboard and don't depress the button the entire time it will fail!!
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: tribalmonkey on Oct 10, 2012, 06:58 am
Post a picture of your assembled breadboard, connected to the programmer.

You may have made an error in reading the fritz diagram, like you did with the DTR capacitor.
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: pcfr33k on Oct 10, 2012, 07:57 am
Pics
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: Coding Badly on Oct 10, 2012, 08:01 am

The gray wire is not correct.  You have essentially wired it to nothing special.  It should be connected to the RESET pin.
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: pcfr33k on Oct 10, 2012, 08:03 am
I tired it both ways grey pin where it is now and grey pin to Pin # 1 of the ATmega328 same results
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: CrossRoads on Oct 10, 2012, 08:10 am
Ok, you have 6 wires coming out of the pocket programmer - not one of them goes to PIN 1.

Fix your wiring - I think you are mixing up the software name for the pins with hardware names.
Make the pocket programmer connect to these pins:

SCK - physical pin 19
MISO - physical pin 18
MOSI - physical pin 17
RESET - physical pin 1
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: pcfr33k on Oct 10, 2012, 08:28 am

Ok, you have 6 wires coming out of the pocket programmer - not one of them goes to PIN 1.

Fix your wiring - I think you are mixing up the software name for the pins with hardware names.
Make the pocket programmer connect to these pins:

SCK - physical pin 19
MISO - physical pin 18
MOSI - physical pin 17
RESET - physical pin 1


Thanks that worked on the USBTinyISP even with the reset switch in the way.

On the Arduino UNO R3 remove the chips and use the header not the shield connectors to do the same thing?  One of the diagrams shows them using the shield rail without the chip in place and using 13,12,~11 and ~10.  But if the chip is removed then how can those be used?

I am trying the Arduino now but using the header.  Not sure about the shield pins

Thanks Again!!


EDITED:

So the issue is resolved with USBTinyISP.  It works without all the trouble I described.   I cannot get the Arduino UNO R3 to work.  I get a Not in Sync.

Do I need to put a resistor on the shield reset pin and +5 volts?


EDITED AGAIN:

From the diagrams:

http://arduino.cc/en/Tutorial/ArduinoToBreadboard

It not 100% clear put it looks like the ATmega328 is not removed from the Arduino Uno R3 when burning a bootloader onto another ATmega328 on a breadboard for example.

Is this true?  Can I use either the 6 pin header or the Pins off the shield as shown from the link above?

Thanks
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: CrossRoads on Oct 10, 2012, 04:29 pm
Connect the 6 pins from the pocket programmer to either the ICSP header, or to Reset-SCK-MISO-MOSI on the female header and program away.
Nothing needs to be done to the card.

Arduino - to - breadboard. Why are you messing with that when you have a nice working AVR ISP?  Stay away from that.
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: pcfr33k on Oct 10, 2012, 10:34 pm

Connect the 6 pins from the pocket programmer to either the ICSP header, or to Reset-SCK-MISO-MOSI on the female header and program away.
Nothing needs to be done to the card.

Arduino - to - breadboard. Why are you messing with that when you have a nice working AVR ISP?  Stay away from that.


Well thanks for everyones help on this Post.

@CrossRoads,

I see your point about not needing to use the Arduino UNO R3 as an ISP since I already have a good working one to use.


I just wanted to see if I can get the Arduino UNO to work as the ISP as well.  I tried it with the female header and with the male header and I just cannot not get it to sync no matter what I do.


So the problem was not really with the TInyUSB but rather the Arduino as an ISP.  I just confused things by starting out with the TinyUSB when I should have had the Arduino connected up and took a picture of that instead.

Have you ever got it to work with the Arduino?
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: CrossRoads on Oct 11, 2012, 01:43 am
Never tried. The original seemed like a kludge; it has been replaced with better programs, yet the original is still out there confusig things.
I have a Duemilanove with pins added to the X3 connector that I used for bit-banging bootloaders. That was slow, and a little cumbersome, so I moved on.
I now have at least 4 other ISPs.
Started with this one
http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415
and used it for a long time.
Next I got an Atmel MKii when I was having trouble getting 1284s to program (turned out to be bootloader/IDE mismatch speed, since resolved).
I now use the MKii exclusively - the MDFLY is buried somewhere, had never even tried the others (had planned to, hasn't worked out timewise yet)
and occasionally plug on an FTDI Basic to show a serial port is working.

Somewhere along the line picked up an adafruit programmer with some other stuff someone was dumping, then a pocket pirate, and I think other too, maybe from nkcelectronics, unless that's the sparkfun pocketpirate.
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: retrolefty on Oct 11, 2012, 03:03 am

Never tried. The original seemed like a kludge; it has been replaced with better programs, yet the original is still out there confusig things.
I have a Duemilanove with pins added to the X3 connector that I used for bit-banging bootloaders. That was slow, and a little cumbersome, so I moved on.
I now have at least 4 other ISPs.
Started with this one
http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415
and used it for a long time.
Next I got an Atmel MKii when I was having trouble getting 1284s to program (turned out to be bootloader/IDE mismatch speed, since resolved).
I now use the MKii exclusively - the MDFLY is buried somewhere, had never even tried the others (had planned to, hasn't worked out timewise yet)
and occasionally plug on an FTDI Basic to show a serial port is working.

Somewhere along the line picked up an adafruit programmer with some other stuff someone was dumping, then a pocket pirate, and I think other too, maybe from nkcelectronics, unless that's the sparkfun pocketpirate.


Bob, I have no doubt that soon you will be able to burn a bootloader into a blank AVR using just a battery and a morse code key.  ;)

Lefty
Title: Re: ATmega328 on BreadBoard Bootloader Question
Post by: CrossRoads on Oct 11, 2012, 04:10 am
and a ZIF socket ...