Go Down

Topic: arduino as an AVR isp programmer - atmega8515 (Read 5040 times) previous topic - next topic

###OCT###

Hello everybody, nice to finally have a valid question that wasn't answered before (or at least I couldn't find using the search here).

So I need to upload .hex (NOT the bootloader) file to an atmega8515, cheaply, since it will probably be an one time only type of thing, ruling out the need to build devices such as usbasp, or buying other programmers.

I've read the tutorials here, but they are geared towards uploading the bootloader only.
arduino.cc/en/Tutorial/ArduinoToBreadboard

The diagrams shown here are specific about using the atmega168, and no explanation about what each pin connection is doing makes it very hard for me to adapt it to the 8515 pins.  
arduino.cc/en/Tutorial/ArduinoISP

I'm thinking I can do this using the ATmega328p with the Arduino bootloader on it and use an Arduino as an USB-to-serial convertor,
AVRdude, MegaISP, the 8515 itself and a breadboard or build a simple target board like:
evilmadscientist/avrtargetboards

Here are the problems/questions:

-cant find a description on what each pin on the arduino will do when is "avr-isp mode"

-the 8515 is in a 40 pin DIP package form, I could not find a good schematic/ plan on building a target board for it, or protoboard plans. most are for 28 DIP. Do I need a crystal oscillators for this?

-I managed to get the spec sheet for the 8515, but cant figure how to manage things on the arduino side. I'm confused  :o

any help will be much appreciated, here are the details of what I have and need to do:

-I need to connect  pins:
ISP connector                         ATMEGA8515 pin number
MOSI                                                       6
RST                                                         9
SCK                                                         8
MISO                                                       7
GND                                                        20
VDD                                                        40

So how do I go about this on the arduino? how do I set the connections from the arduino to the microcontroller? what should I run as software on the arduino for it to work with AVRdude?  Do I need other components besides the duemillanove, protoboard, wires? can I set fusebits with this? whew, I know its a heck of a lot of newbeesh questions, but I really appreciate your help.  
here is what I have to work with:
-arduino duemillanove
-protoboard, wires
-mac (osx 10.5)
-atmega8515

Cheers,
OCT




Osgeld

look for arduino pin mappings, that should clear up whats going where, and yes you will need to use avrdude, it will look something like

avrdude -c avrisp -p insert_part_name -P insert_com_port -b 19200 -U flash:w:filename.hex
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

itsgeektime

OCT, the pinout of the arduino is commented on de ArduinoISP code (on the arduino examples)

I'm trying to use my arduino as an AVR programmer too, but I have some problems, I have a board with an ATMEGA8 and I have successfully connected the arduino board to the ICSP head of my board, but I can't program it through avrdude (I'm a linux user). I have the following error

Code: [Select]
$ avrdude -c avrisp -P /dev/ttyUSB0 -p atmega8 -b 19200 -U flash:w:test.elf.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.12s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
        Double check connections and try again, or use -F to override
        this check.


avrdude done.  Thank you.



Googling I have found arduino ISP programmer can't handle the device signature, so I add a -F, but I'm still having errors when I try to upload the hex

Code: [Select]
$ avrdude -c avrisp -P /dev/ttyUSB0 -p atmega8 -b 19200 -F -U flash:w:test.elf.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.12s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA8 is 1E 93 07
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: reading input file "test.elf.hex"
avrdude: input file test.elf.hex auto detected as Intel Hex
avrdude: writing flash (110 bytes):

Writing | ################################################## | 100% 0.20s

avrdude: 110 bytes of flash written
avrdude: verifying flash memory against test.elf.hex:
avrdude: load data flash data from input file test.elf.hex:
avrdude: input file test.elf.hex auto detected as Intel Hex
avrdude: input file test.elf.hex contains 110 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.22s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
        0x12 != 0x00
avrdude: verification error; content mismatch

avrdude: safemode: Fuses OK

avrdude done.  Thank you.



Looks like there is some modifications on my board, but the results have non-sense with the code uploaded (just high-low some pins)

getting out of the avrdude errors, is fine that "avrdude: input file test.elf.hex auto detected as Intel Hex"? or can it be a compilation error?


leppie

Make sure you dont change any of the pins (10 - 13) on the Arduino side.

itsgeektime

#5
Jul 09, 2010, 06:38 pm Last Edit: Jul 09, 2010, 06:38 pm by itsgeektime Reason: 1
Yes, I have checked the circuit many times, and the Arduino is properly connected following the pins commented on the Arduino ISP code.

Thanks for the response  :)

leppie

#6
Jul 09, 2010, 07:25 pm Last Edit: Jul 09, 2010, 07:27 pm by leppie Reason: 1
Maybe a stupid question, but did you modify the fuses to suit your circuit?

PS: That avrdude message is just informational. You can get rid of it by appending :h to the end of the filename.

wlewis

Ok I just had this problem and YES.. you can upload any hex file you want assuming you programmed it properly.. to this end you can use MICROC which is just a lot easier because it includes the #include files. Just make sure your targeting the correct chip. I have successfully programmed the atmega2313 and the Atmega32 using this system.

here are the lines from my batch file:

--------------
avrdude -p m328p -b 19200 -P COM3 -c avrisp -V -F -e -u -U lock:w:0x3F:m -U hfuse:w:0xD8:m -U lfuse:w:0xFF:m -U efuse:w:0x03:m

avrdude -p m328p -b 19200 -P COM3 -c avrisp -V -D -F -u -U flash:w:AT328_hex.hex:i

avrdude -p m328p -b 19200 -P COM3 -c avrisp -V -F -u -U lock:w:0x0F:m

pause
---------

In this case, Im uploading the bootloader that I got from wolf paulus:

http://wolfpaulus.com/journal/embedded/arduino3

but you can program files in MICROC and then upload the hex file to your microchip. I havent tried the atmega64 but I have (not 1 but 2 now) and will be attacking that as well. The amtega64 is a monster.. but of course when using lcd screens you can run out of pins fast.

you will need this as well..

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

and this..

http://code.google.com/p/mega-isp/

download avrisp.03.zip from this last link.

Notice the connections on this tutorial. Because when youre using an internal clock you dont need an external crystal .. those connections are "literal".

Anyway.. Make sure youre connections are good to go. I was having trouble at first. Here are the mistakes i made:

1. tried to program "avrdude" by itself without having uploaded arduino isp to the atmega328p which turns this (in this case) into an outright  programmer. No wonder I wasnt getting anywhere. This is what happens when you put microchips down for a while (as a result of burnout) anyway.. im back in. This is seriously exciting stuff.

2. Once youve uploaded avrisp.03 (i havent tried running avrisp directly from the examples page) youre ready.

3. make sure youre connections are correct. (I actually tried programming an atmega328p while it was plugged in BACKWARDS!!! no wonder I was getting error messages. Its amazing I didnt fry it! Did the guys at atmel think.. "hmm lets make this chip in such a way that if you put it in backwards it wont fry?" i wonder.

4. Also, once youre plugged in correctly you dont have to use -F. The arduino avrisp programmer will get the correct signature for your device. If youre not getting the correct device signature somethings wrong.. count on it.

5. Also, if youre able to upload arduino sketches successfully you should be able to use avrdude with equal success.

I hope this helps.



Go Up