Go Down

Topic: Mega 2560 as ISP for ATTiny (Read 11153 times) previous topic - next topic

kwilson68

#15
Apr 06, 2012, 03:52 am Last Edit: Apr 06, 2012, 03:57 am by kwilson68 Reason: 1
Here is a photo of my setup (without the USB cable).

It might be difficult to tell from the photo which pins are attached where, so for the SPI pins:

  • Red to 52

  • White to 50

  • Blue to 51

  • Orange to 53



The top of the breadboard has the red rail connected to +5V. This feeds the ATTiny and the line that runs through the two resistors and back to RESET. The resistors are 10ohms and 100ohms in series. A 10uF capacitor is also connected to the RESET line and then to the ground pin below 53 (a green wire) on the Mega2560. The setup on the left is the three LEDs on pins 9, 8, and 7 for feedback from ArduinoISP. The ground rail on the bottom of the breadboad grounds out the LEDs and the ATTiny.

And just for the sake of completeness, the desk is made of oak.

Nick Gammon

Well this is what I tried - with success ...



I had an Attiny85 to hand, not an Attiny45 - but it's the same datasheet.

[font=Courier]Orange: Attiny85 pin 5 (MOSI) to Mega pin 51
White: Attiny85 pin 6 (MISO) to Mega pin 50
Red: Attiny85 pin 7 (SCK) to Mega pin 52
Green: Attiny85 pin 1 (/RESET) to Mega pin 53

Blue: Gnd
Other red on right: +5V

47uF cap between Mega /RESET and Gnd

Decoupling 0.1 uF cap on breadboard.
Other components not connected (from earlier test).[/font]

Loaded ArduinoISP from Examples in the 1.0 Version of the IDE.

Hit reset button on the Mega. Waited till flickering stopped.

Sent command:

Code: [Select]
avrdude -c arduino -p t85 -vvvv -P /dev/tty.usbmodemfd141 -b 19200

Got response:

Code: [Select]
avrdude: Version 5.8cvs, compiled on Jan 15 2010 at 17:27:01
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/local/CrossPack-AVR-20100115/etc/avrdude.conf"
         User configuration file is "/Users/nick/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/tty.usbmodemfd141
         Using Programmer              : arduino
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
         AVR Part                      : ATtiny85
         Chip Erase delay              : 4500 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : possible i/o
         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
...
         Programmer Type : Arduino
         Description     : Arduino
avrdude: Send: A [41] . [80]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [02]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
avrdude: Send: A [41] . [84]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [85]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [86]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [87]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [89]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: Send: A [41] . [81]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: B [42] . [14] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] @ [40] . [02] . [00] . [00] . [00]   [20] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: Send: P [50]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude: Send: u [75]   [20]
avrdude: Recv: . [14] . [1e] . [93] . [0b] . [10]
Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e930b
avrdude: Send: V [56] P [50] . [00] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [e2]
avrdude: Recv: . [10]
avrdude: safemode read 1, lfuse value: e2
avrdude: Send: V [56] P [50] . [00] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [e2]
avrdude: Recv: . [10]
avrdude: safemode read 2, lfuse value: e2
avrdude: Send: V [56] P [50] . [00] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [e2]
avrdude: Recv: . [10]
avrdude: safemode read 3, lfuse value: e2
avrdude: safemode: lfuse reads as E2
avrdude: Send: V [56] X [58] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [df]
avrdude: Recv: . [10]
avrdude: safemode read 1, hfuse value: df
avrdude: Send: V [56] X [58] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [df]
avrdude: Recv: . [10]
avrdude: safemode read 2, hfuse value: df
avrdude: Send: V [56] X [58] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [df]
avrdude: Recv: . [10]
avrdude: safemode read 3, hfuse value: df
avrdude: safemode: hfuse reads as DF
avrdude: Send: V [56] P [50] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: safemode read 1, efuse value: ff
avrdude: Send: V [56] P [50] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: safemode read 2, efuse value: ff
avrdude: Send: V [56] P [50] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: safemode read 3, efuse value: ff
avrdude: safemode: efuse reads as FF
avrdude: Send: V [56] . [a0] . [01] . [fc] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: Send: V [56] . [a0] . [01] . [fd] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: Send: V [56] . [a0] . [01] . [fe] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: Send: V [56] . [a0] . [01] . [ff] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]

avrdude: Send: V [56] P [50] . [00] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [e2]
avrdude: Recv: . [10]
avrdude: safemode read 1, lfuse value: e2
avrdude: Send: V [56] P [50] . [00] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [e2]
avrdude: Recv: . [10]
avrdude: safemode read 2, lfuse value: e2
avrdude: Send: V [56] P [50] . [00] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [e2]
avrdude: Recv: . [10]
avrdude: safemode read 3, lfuse value: e2
avrdude: safemode: lfuse reads as E2
avrdude: Send: V [56] X [58] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [df]
avrdude: Recv: . [10]
avrdude: safemode read 1, hfuse value: df
avrdude: Send: V [56] X [58] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [df]
avrdude: Recv: . [10]
avrdude: safemode read 2, hfuse value: df
avrdude: Send: V [56] X [58] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [df]
avrdude: Recv: . [10]
avrdude: safemode read 3, hfuse value: df
avrdude: safemode: hfuse reads as DF
avrdude: Send: V [56] P [50] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: safemode read 1, efuse value: ff
avrdude: Send: V [56] P [50] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: safemode read 2, efuse value: ff
avrdude: Send: V [56] P [50] . [08] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [ff]
avrdude: Recv: . [10]
avrdude: safemode read 3, efuse value: ff
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK
avrdude: Send: Q [51]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]

avrdude done.  Thank you.


So it all works. Now you just need to work out where you differ from those steps. :)
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

Oh and the desk is Laminex I think. :P
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

thatonekid123

I had the same problem. I couldn't figure out how to program an ATtiny with an Arduino Mega as all the tutorials used Arduino Unos. I eventually figured it out and made my own tutorial and posted it on my blog.

http://jamestav.blogspot.com/2014/08/programming-attiny85-microchip-using.html

Darkkeep

I had the same problem. I couldn't figure out how to program an ATtiny with an Arduino Mega as all the tutorials used Arduino Unos. I eventually figured it out and made my own tutorial and posted it on my blog.

http://jamestav.blogspot.com/2014/08/programming-attiny85-microchip-using.html
I viewed your blog...I do have to say the detail is good. However, ALL IC pins are counted in a U direction. Pin 1 denoted by a dot/indent or left of the indent on top. The ATTINY being 8 pins, 1 top left, 4 bottom left, 8 top right and 5 bottom right. So, I'm now gonna dig for the datasheet to find the pins. Might wanna fix that to make it correct. other than that...good job on the explanation

erniman

Hello, this is my first entry on this forum.

I was searching for help on this impossible task ("how to program an ATtiny85 with Arduino Mega). Well, after a long week here is what I´ve done to have success:

* Install Arduino IDE 1.6.4 (on Windows 7 desktop PC)
* Install driver for Arduino Mega (this is done by Windows automatically)
* Install ATtiny support from Boards Manager, (version 1.0.1)
* Open ArduinoISP scketch and upload to Arduino Mega
* Open Blink and select the following in my case:
Board: ATtiny
Processor: ATtiny85
Clock: 1MHz internal
Port: COM4 (Arduino Mega)
Programmer: Arduino as ISP
* Hit on File-> Upload Using Programmer

And magically all works!!
I´ve test others IDE version but I´ve no success. The only one that works for my was 1.6.4  :)

This is the Pin connection that I use, plus the 10uf Capacitor connected on Rest pin (Arduino Mega) to GND

Pin connections to Arduino Mega:

ATtiny Pin 1: Pin 53        ATtiny Pin 8: VCC
ATtiny Pin 2: S/C           ATtiny Pin 7: Pin 52
ATtiny Pin 3: S/C           ATtiny Pin 6: Pin 50
ATtiny Pin 4: GND          ATtiny Pin 5: Pin 51

Remember to use the capacitor after upload the ArduinoISP sketch.

Regards from Argentina!!!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy