Go Down

Topic: [SOLVED] ArduinoISP programming Atmega8515 on breadboard (Read 13579 times) previous topic - next topic

Coding Badly


There have been two suggestions on the forum: 1. Use a needle.  2. Remove the plastic shroud.

qwertymodo

Ok, so I got that sorted out (kinda... it works for now :P).  I want to give this another shot, but I'm going to start fresh and make no assumption that I have any idea what I'm doing here.  The information I'm going off of originated from http://www.instructables.com/id/How-to-use-Arduino-Mega-2560-as-Arduino-isp/ and http://arduino.cc/en/Tutorial/ArduinoToBreadboard, neither of which actually discusses programming to the 8515, but I'm assuming that the information is still applicable other than pin assignments on the microcontroller itself.  My information regarding the 8515 is coming from the project manual for the project I'm actually building

Manual:
http://www.reinerziegler.de/GB-Flasher/gbcflsh_manual.pdf

Schematic:
http://www.reinerziegler.de/GB-Flasher/schem+pcb/GB%20Cart%20Flasher%20(USB).pdf

Ok, so with all of that info, I've attached a picture to show what my board setup looks like (the LED is just a leftover from some other stuff I was working on...)

One thing I've been wondering is, do I need the 100uF cap across RST->GND on the Arduino to prevent auto-reset like I've read several places or is that not an issue?  Do I need the external crystal while flashing or can I do it this way?  Basically, I just want to make sure there are no errors in my hookup before continuing to hunt down the problem on the software side.

Coding Badly

Quote
Basically, I just want to make sure there are no errors in my hookup before continuing to hunt down the problem on the software side.


GNDs need to be connected.

Is the target powered close to 5 volts?

Quote
One thing I've been wondering is, do I need the 100uF cap across RST->GND on the Arduino to prevent auto-reset like I've read several places?


Yes.

Quote
Do I need the external crystal while flashing or can I do it this way? 


If the target will be running from an external crystal then you will need to connect the external crystal while flashing.

qwertymodo

Quote
GNDs need to be connected.

Which GND's?  Do I nee to connect the Arduino's GND to the breadboard GND?

Quote
Is the target powered close to 5 volts?

The breadboard supply line is connected to an external 5v 1000mA source.

Quote
If the target will be running from an external crystal then you will need to connect the external crystal while flashing.

It will be.  So I take it that I should be following more closely to the first scenario on the arduino.cc ArduinoToBreadboard guide for breadboard setup, rather than the barebones setup I have now?  If so, do I need the capacitors as well and how do I figure out which pins on the 8515 I should be wiring this stuff up to?  I'm assuming from the project wiring schematic that the crystal goes between pins 18 and 19, but I have no idea for the capacitors.

Coding Badly

Which GND's?  Do I nee to connect the Arduino's GND to the breadboard GND?


Yes.

Quote
The breadboard supply line is connected to an external 5v 1000mA source.


Perfect.

Quote
So I take it that I should be following more closely to the first scenario on the arduino.cc ArduinoToBreadboard guide for breadboard setup, rather than the barebones setup I have now?


At the point you change the fuses so the processor runs from the external crystal you will have to have the crystal connected.  Until then you can play with the target without connecting the external crystal.  The processor leaves the factory ready-to-run.

Quote
If so, do I need the capacitors as well


If you are using a crystal then yes.  If you are using a resonator then the capacitors are built-in.

Quote
and how do I figure out which pins on the 8515 I should be wiring this stuff up to?


Datasheet.  The crystal or resonator is connected across XTAL1 and XTAL2 (physical pins 18 and 19).

Quote
I'm assuming from the project wiring schematic that the crystal goes between pins 18 and 19, but I have no idea for the capacitors.


The capacitors are connected from the pin to GND.

qwertymodo

I don't have the right size caps and neither did RadioShack.  I'll have to drop by the school tomorrow and pick some up from the bookstore (yay tech school bookstores :D)

qwertymodo

#21
Mar 10, 2012, 05:42 am Last Edit: Mar 10, 2012, 05:44 am by qwertymodo Reason: 1
Ok, so other than the resistor and caps being the wrong value (just threw in ones I had lying around for the sake of the picture, I'll get the right ones tomorrow) does this hookup look right?

The wires are:

                   Ard.  8515
RED:   MISO   50      7
YLW:  MOSI    51      6
GRN:  SCK     52      8
BLUE: SS       53      9

The crystal is between 18 and 19, with a cap on either side of it each connected to GND.  Pin 40 on the 8515 is tied to +5v and pin 20 goes to GND.  Breadboard GND is tied to Arduino GND, Arduino +5v is bridged to Arduino RESET by a 100nF cap.  10k resistor between the 8515 pin 9 (RESET) to GND  Breadboard has external +5v source (using an old phone charger I picked up at Goodwill :P) Anything else I'm missing?

Here's the 8515 pinout for reference http://circuits.datasheetdir.com/18/ATMEGA8515-pinout.jpg

Coding Badly


Crystal capacitors go to GND not +5V.  Other than that it looks good.

qwertymodo

Woops, good catch -_-  Turns out, the school bookstore has new owners and doesn't open on Saturdays anymore, so I'll have to wait till Monday to get parts :(

SirNickity

#24
Mar 12, 2012, 10:06 pm Last Edit: Mar 12, 2012, 10:09 pm by SirNickity Reason: 1
Unless I've missed something, you don't ever need a cap between +5v and reset.

You put a 100nF between +5v and Gnd to filter noise as close to the Vcc pin as possible (optional, recommended) and likewise one between DTR and reset if you're using FTDI for serial.  You DO, however, want the 10K resistor between +5v and reset -- this pulls it high unless grounded to reset.

Also, just a nitpick -- resonators don't always have built-in caps.  I have some that do, some that don't.  Check for the third leg.  FYI, it doesn't necessarily have to be 22nF on the nose.  Remember, most caps are 5% tolerance anyway.  I have 20nF, 27nF and 30nF in my parts bin.  No 22s.  (Just what I have.  No good reason for those values in particular.)

Oh, one last thing..  You might want to check the output voltage on that PSU.  Remember, transformers usually aren't rated at 5v exactly, especially not without a load.  Under light or no load, they may go significantly higher.  If it's regulated (probably the case for a cellphone charger, but not necessarily for a cordless phone) then you're all set.  If not, you need 7v+ and a 5v regulator.

qwertymodo


Unless I've missed something, you don't ever need a cap between +5v and reset.

You DO, however, want the 10K resistor between +5v and reset -- this pulls it high unless grounded to reset.


Just to clarify, the cap is between +5v and RST on the Arduino being used as the ISP, the 10k resistor is between +5v and RST on the chip being programmed... correct?

Also, I'm using a crystal with 22u caps, so no issue there, and my multimeter says the PSU is running @ 4.97V so that's good as well.  Goodwill FTW :)

Coding Badly

Just to clarify, the cap is between +5v and RST on the Arduino being used as the ISP ... correct?


Not correct.  (Sorry I missed that in your earlier post.)  The capacitor goes from RESET to GND (after uploading the ArduinoISP sketch).

When using a (120 ohm) resistor to disable auto-reset, the resistor is connected from RESET to +5V.


qwertymodo


Not correct.  (Sorry I missed that in your earlier post.)  The capacitor goes from RESET to GND (after uploading the ArduinoISP sketch).

When using a (120 ohm) resistor to disable auto-reset, the resistor is connected from RESET to +5V.




Woops, that's actually how I have it hooked up, I wasn't really paying attention when I typed :P

qwertymodo

Finally got the last of the parts, hooked it up, flashed the ArduinoISP sketch, fired up avrdude and got this:

Code: [Select]
avrdude: stk500_2_ReceiveMessage(): timeout

[repeats the timeout message over and over for several minutes]


Then after a few minutes this comes up:

Code: [Select]
avrdude: stk500v2_getsync(): timeout communicating with programmer
         AVR Part                      : ATMEGA8515
         Chip Erase delay              : 9000 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page
      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         4    10   128    0 no        512    0      0  9000  9000 0xff 0xff
                                  Block Poll               Page      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         33     6    64    0 yes      8192   64    128  4500  4500 0xff 0xff
                                  Block Poll               Page      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          4    0      0     0 0 0x00 0x00
                                  Block Poll               Page      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0 0 0x00 0x00
         Programmer Type : STK500V2
         Description     : Atmel STK500
         Programmer Model: Unknown
avrdude: stk500_2_ReceiveMessage(): timeout
[continues repeating every few seconds]


I get the same error with the TinyISP sketch that Coding Badly sent me.

Coding Badly

#29
Mar 14, 2012, 03:19 am Last Edit: Mar 14, 2012, 03:20 am by Coding Badly Reason: 1
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer


You've specified the wrong protocol.  "STK500" (versus "STK500V2") is the correct choice.

Go Up