Pages: [1]   Go Down
Author Topic: Mega2560 as ISP for ATTINY45  (Read 702 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,

I'm using the instructions found here to program an ATTINY45 using the Arduino as an ISP:

http://hlt.media.mit.edu/?p=1695

I'm using Arduino 1.0, a MEGA2560 with ARDUINOISP installed, and the ATTiny core found here: http://code.google.com/p/arduino-tiny/downloads/list.

Here is a picture of my setup:



Ok, so I modified the Blink sketch to use pin 0 as in the instructions, selected the output board type, and hit "Upload". Here is what happens (I've enabled verbose output in the preferences so I can see exactly what AVRDude is complaining about:)

Code:
Binary sketch size: 714 bytes (of a 4096 byte maximum)
/home/rowan/Bins/arduino/hardware/tools/avrdude -C/home/rowan/Bins/arduino/hardware/tools/avrdude.conf -v -v -v -v -pattiny45 -cstk500v1 -P/dev/ttyACM0 -b19200 -Uflash:w:/tmp/build8474854941817919548.tmp/Blink_Tiny.cpp.hex:i

avrdude: Version 5.11, compiled on Sep  9 2011 at 16:00:41
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/home/rowan/Bins/arduino/hardware/tools/avrdude.conf"
         User configuration file is "/home/rowan/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : stk500v1
         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                      : ATtiny45
         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
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     6     4    0 no        256    4      0  4000  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6    32    0 yes      4096   64     64  4500  4500 0xff 0xff
                                  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
                                  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  9000  9000 0x00 0x00
                                  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  9000  9000 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  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 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          2    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
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] . [01] . [00] . [00] . [00] . [10] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny45
avrdude: Send: P [50]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

Not sure what's wrong. It definitely seems to be communicating with the firmware, and it even seems to be sending stuff to the chip, but it just messes up halfway through.

Some help would be appreciated.

Cheers,

R smiley
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 200
Posts: 12773
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Not sure what's wrong.

I am.  Buggy ArduinoISP sketch.  Your (not mutually exclusive) choices are...

• Downgrade to Arduino 0023
• Change the baud rate to 9600 (modify the sketch and boards.txt file)
• Wait for your newly purchased programmer to arrive... http://www.pololu.com/catalog/product/1300
• Send me a Personal Message with your email address and I'll reply with a version that works
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, an update.

Tried your TinyISP sketch; no difference.

Tried modifying your sketch to use a 9600 baud rate, no difference.

Tried Arduino 028 and also 022, no difference. Modified those to use a 9600 rate, no difference. (In all three instances I had to change the baud rate in programmers.txt, not boards.txt).

Still stops at:

avrdude: Send: P [50]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

in all cases.

So, I connected the diagnostic LEDs to the arduino. Neither of the other two LEDs ever light up except when first powering the arduino. The heartbeat one blinks until the upload fails, at which point it just stops blinking.

Seems as though the firmware is actually freezing up there.

Not entirely sure why. Trying to do some debugging now. What should the firmware be doing when the host sends P [50] [20]?

Cheers.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 200
Posts: 12773
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


How are you disabling auto-reset?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried two ways - firstly a 10uF capacitor from Reset to Ground, and when that didn't work I cut the removable track on the arduino and installed a jumper instead. Same result both cases. With the jumper installed there is no communication at all, so I don't think it's that.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 200
Posts: 12773
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Tried your TinyISP sketch; no difference.

The verbose output was identical?
Logged

Tokyo, Japan
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A workaround

Step 1 : upload (knowing that it fails)

[...]
avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/build8315599149462982275.tmp/85.cpp.elf /tmp/build8315599149462982275.tmp/85.cpp.eep
avr-objcopy -O ihex -R .eeprom /tmp/build8315599149462982275.tmp/85.cpp.elf /tmp/build8315599149462982275.tmp/85.cpp.hex
Binary sketch size: 1472 bytes (of a 8192 byte maximum)
/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -pattiny85 -cstk500v1 -P/dev/ttyUSB0 -b19200 -Uflash:w:/tmp/build8315599149462982275.tmp/85.cpp.hex:i

avrdude: Version 5.11.1, compiled on Oct 18 2011 at 21:17:35
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
         User configuration file is "/home/warwick/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

avrdude done.  Thank you.

The undescored line is the key

Step 2 : Copy and paste the (underscored) line in a terminal, change 19200 for 9600 as suggested previously, and run.

That's all.
Please note : Both steps need to be done each time the code is changed, as the temp folders will change for each compile
Logged

Pages: [1]   Go Up
Jump to: