Go Down

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

qwertymodo

Feb 20, 2012, 07:21 am Last Edit: Mar 14, 2012, 06:10 am by qwertymodo Reason: 1
I'm new to the Arduino and just starting to play around with my Mega 2650r3, but one thing I wanted to try out was the ArduinoISP capability to flash an Atmega8515 for another project I'm working on.  I have the Intel-format .hex file I wish to flash and I know the pinout for hooking it up, and I've have tried following the tutorial's I've found, but I have a feeling that I'm missing something in the configuration for flashing on a breadboard (preferably the barebones setup without additional components on the board).  I can get as far as uploading ArduinoISP to the Mega and then firing up avrdude and initializing the chip, but when I try to flash the actual .hex, it gives me a protocol error.  I'll post any more detailed information that may be necessary, but I'm pretty sure I am missing some basic setup, since most of the tutorials I've found are for programming other chips, so I may be incorrectly configured.  Any pointers would be greatly appreciated.

EDIT: For anyone reading this later for reference, I ended up wiring up the entire circuit shown here http://arduino.cc/en/Tutorial/ArduinoToBreadboard using an external crystal, the barebones layout did NOT work.  I then had to follow this hack http://code.google.com/p/arduino/issues/detail?id=661#c3 to get ArduinoISP to play nice.  Also, to clear up a couple of things that were not quite clear to me as a noob searching aimlessly on the internet, this does require a 100nF (.1uF) cap across RESET and GND on the Arduino inserted AFTER the ArduinoISP sketch has been uploaded but BEFORE uploading the .hex to the 8515, and the 22pF caps on the crystal recommended in the above linked guide worked fine even though my project manual indicated the need for 27's.

Coding Badly


qwertymodo

Sorry, I tried it last night and have since disconnected it.  Didn't remember the exact error offhand.  I'll hook it back up and post back.

qwertymodo

If it happens to be relevant, using the project documentation I have, this is how it's all connected:

       MEGA || 8515
MISO  50         7
MOSI  51         6
SCK    52         8
SS      53         9
    +5v            40
   GND            20

And here's the output of avrdude:

Code: [Select]
C:\>avrdude -p m8515 -P com7 -c avrisp -b 19200 -U flash:w:gbcf-fw-2.1-usb.hex

avrdude: please define PAGEL and BS2 signals in the configuration file for part
ATMEGA8515
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.14s

avrdude: Device signature = 0x1e9306
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: please define PAGEL and BS2 signals in the configuration file for part
ATMEGA8515
avrdude: reading input file "gbcf-fw-2.1-usb.hex"
avrdude: input file gbcf-fw-2.1-usb.hex auto detected as Intel Hex
avrdude: writing flash (3614 bytes):

Writing |                                                    | 0% 0.00s
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): protocol error

Coding Badly


qwertymodo

I used Arduino IDE to flash the ArduinoISP sketch to the Arduino, then I used avrdude manually from the command-line because I couldn't find any way to program a specified .hex file to a specified microcontroller, only the presets for the Arduino controllers.

Coding Badly


Which version of the Arduino IDE did you use to compile the ArduinoISP sketch?

qwertymodo

Whatever the latest version was as of a week or so ago.  It says 1.0.  And I'm using the ArduinoISP sketch that came with it.  File>Examples>ArduinoISP

Coding Badly


The failure is the result of a bug in the ArduinoISP sketch surfaced by a change in the Arduino IDE 1.0.  You can either lower the baud rate to 9600 or send me a Personal Message with your email address and I'll reply with a version that works.

qwertymodo

So, I did some more reading, and from what I've seen, I need to disable auto-reset?  I read that a 120ohm resistor or 100nm cap bridging from +5v to reset should be sufficient.  From what I have on hand, I have an equivalent resistance of ~114ohms across it and here's what I get now:

Code: [Select]
C:\>avrdude -p m8515 -P com7 -c avrisp -b 19200 -U flash:w:gbcf-fw-2.1-usb.hex

avrdude: please define PAGEL and BS2 signals in the configuration file for part
ATMEGA8515
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.13s

avrdude: Device signature = 0x1e9306
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: please define PAGEL and BS2 signals in the configuration file for part
ATMEGA8515
avrdude: reading input file "gbcf-fw-2.1-usb.hex"
avrdude: input file gbcf-fw-2.1-usb.hex auto detected as Intel Hex
avrdude: writing flash (3614 bytes):

Writing |                                                    | 0% 0.00s
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync

qwertymodo

Tried the baud rate change and this is what I got:

Code: [Select]
C:\>avrdude -p m8515 -P com7 -c avrisp -b 9600 -U flash:w:gbcf-fw-2.1-usb.hex
avrdude: stk500_getsync(): not in sync: resp=0xff

avrdude done.  Thank you.


My email is my username at yahoo, I'll be glad to give the fixed version a try.

Coding Badly


qwertymodo

The version you sent me gives even stranger errors than I was getting before...

Code: [Select]
C:\>avrdude -p m8515 -P com7 -c avrisp -b 19200 -U flash:w:gbcf-fw-2.1-usb.hex

avrdude: please define PAGEL and BS2 signals in the configuration file for part
ATMEGA8515
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.10s

avrdude: Device signature = 0x1e9306
avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may
not be reliable.
avrdude: safemode: To protect your AVR the programming will be aborted

avrdude done.  Thank you.


It's 1:30am here, so I'm gonna call it a night.  But thanks for the help so far.  Hopefully, we'll get this sorted...

Coding Badly


[font=Courier New]avrdude -p m8515 -P com7 -c stk500 -v -v -v -b 19200 -U flash:w:gbcf-fw-2.1-usb.hex[/font]

qwertymodo

I started on another project (musical floppy drives :D) so I've ignored this for awhile, and now that I decided to give it another try, I just accidentally broke off a wire end in the header for MOSI (pin 51).  Any ideas for removing a wire that's gotten broken off in the pin header?

Go Up