Go Down

Topic: ArduinoISP and ATtiny85. (Read 7011 times) previous topic - next topic

myplacedk

I'm trying to program an ATtiny85, but I can't make it work. I've read a lot about it, searched a lot on Google and this forum, but most have no suggestions I can try, or a suggestion I couldn't make work. Here's a few things I've tried:

I plug my Duemilanove (ATmega 328) to the computer, with nothing else connected to it. I open Arduino IDE 1.0 (Linux 32 bit) and upload ArduinoISP.

I connect an ATtiny85 like this: http://hlt.media.mit.edu/wp-content/uploads/2011/06/Screen-shot-2011-06-06-at-1.46.39-PM.png
(Image from http://hlt.media.mit.edu/?p=1706) I skip the capacitor, it says that's only for Arduino Uno.

In Arduino IDE 1.0 I change "Board" to "ATtiny85 (internal 8 MHz clock)" and "Programmer" to "Arduino ISP". I then start "Burn Bootloader". It says "Done burning bootloader", but the console says:

avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

The tutorial says it doesn't matter, so I ignore it.

Now I open the Blink-sketch. I change the pin from 13 to 0 in all three places. I check that board and programmer is still correct, and then I upload. I get this error:

Binary sketch size: 750 bytes (of a 8192 byte maximum)
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x11
avrdude: stk500_cmd(): programmer is out of sync

I've read many places that this is a known problem with Arduino 1.0. Somewhere someone said I could simply upload ArduinoISP with an old Arduino IDE, and then use it with Arduino 1.0. I'll try that.

I open Arduino IDE 0022ubuntu0.1 and upload ArduinoISP from there. I open the blink-sketch, change pin to 0, and upload. It says "Done uploading", but the console says:

Binary sketch size: 750 bytes (of a 8192 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0x15

I disconnect the breadboard (except for power), add an LED to pin 0 (actually pin 5 on the IC), connect it to GND through a resistor, and ... nothing.

I've checked the LED/resistor by moving the plus-side of the led from the attiny pin 0 to the duemilanove pin 9, which sends the heartbeat signal. It works perfectly.

I've done lots of experiments, you don't want to hear about all of them. I tried the 10 uF cap on the Duemilanove reset pin. I tried adding a 10k pullup resistor on the attiny reset pin. I tried another attiny85.

I measured the voltage drop over the LED/resistor with an oscilloscope while testing the sketch uploaded to the attiny, on one attiny it was 1.9 volt constant, the other 1.5 volt. I expected it to alternate between 5V and 0V every second.

What can I try next? Probably "get a hardware ISP"...

Coding Badly

Quote
Duemilanove ... I skip the capacitor, it says that's only for Arduino Uno.


That is true.  The capacitor is used to disable auto-reset for Uno-like boards.  However, you still need to disable auto-reset.  Connect a 120 ohm resistor between RESET and +5V after uploading the ArduinoISP sketch.  Details here...

http://arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

smeezekitty

I did not need to disable auto reset when using AVRDUDE directly but when using the Arduino IDE, I did.
On my Duemilanove, I used a .1 uf capacitor from reset to ground because the resistor did not work. I hope I don't blow something up but it seems to work.
Try running this on the command line to see if the attiny is responding:
Code: [Select]

avrdude -P com4 -pt85 -b 19200 -c avrisp -v
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

Lazy_Glen

I'm not sure which tutorial that you are using, I see that you linked to an MIT HLT image, so perhaps that one.No where in that tutorial does it say anything about baud rate issues, which Coding Badly posted 3 links to in this message: http://arduino.cc/forum/index.php/topic,61607.msg664893.html#msg664893 I found the baud rate issue to fix most of my problems. I too downgraded to Arduino 022, but even so, did not have any joy until I dropped down to 9600. I still get out of synch errors about 25% of the time but usually trying a second time with no other changes makes it work.

Good luck.

LazyGlen

myplacedk

Connect a 120 ohm resistor between RESET and +5V after uploading the ArduinoISP sketch.

Thanks, but I mentioned in the very next sentence that i already tried that.  :) By combining resistors I measured 119.2 ohm across the resistors, that should be close enough. But I didn't notice any difference in behavior.

myplacedk

I found the baud rate issue to fix most of my problems.

I did try to change the baud rate, but I don't think I ever got it working. I'll try editing ArduinoISP.ino and programmers.txt as described in https://github.com/arduino/Arduino/commit/80a2154279a02fd69f995ef6ff9eb889363c73ca and report back. (Either tonight or tomorrow night.)

Coding Badly


Post a verbose output from avrdude.

myplacedk

Lowering the speed to 9600 didn't help. Here's the verbose output from Arduino 1.0, part 1:

Code: [Select]
Binary sketch size: 750 bytes (of a 8192 byte maximum)
/home/animal/arduino/arduino-1.0/hardware/tools/avrdude -C/home/animal/arduino/arduino-1.0/hardware/tools/avrdude.conf -v -v -v -v -pattiny85 -cstk500v1 -P/dev/ttyUSB0 -b9600 -Uflash:w:/tmp/build7134043750933359582.tmp/Blink.cpp.hex:i

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

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

        Using Port                    : /dev/ttyUSB0
        Using Programmer              : stk500v1
        Overriding Baud Rate          : 9600
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
        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        512    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      8192   64    128  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] . [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 | avrdude: Send: V [56] 0 [30] . [00] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [1e]
avrdude: Recv: . [10]
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [93]
avrdude: Recv: . [10]
################avrdude: Send: V [56] 0 [30] . [00] . [02] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [0b]
avrdude: Recv: . [10]
################################## | 100% 0.13s

avrdude: Device signature = 0x1e930b
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
        To disable this feature, specify the -D option.
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: erasing chip
avrdude: Send: V [56] . [ac] . [80] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
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: 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: reading input file "/tmp/build7134043750933359582.tmp/Blink.cpp.hex"
avrdude: writing flash (750 bytes):

Writing | avrdude: Send: U [55] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]

myplacedk

Part 2:
Code: [Select]
avrdude: Send: d [64] . [00] @ [40] F [46]   [20] . [c0] / [2f] . [c0] . [2e] . [c0] - [2d] . [c0] , [2c] . [c0] A [41] . [c0] * [2a] . [c0] ) [29] . [c0] ( [28] . [c0] ' [27] . [c0] & [26] . [c0] % [25] . [c0] $ [24] . [c0] # [23] . [c0] " [22] . [c0] . [00] . [00] . [00] . [00] 7 [37] . [00] . [00] . [00] . [00] . [00] 8 [38] . [00] . [00] . [00] . [00] . [00] 6 [36] . [00] . [02] . [02] . [02] . [02] . [02] . [02] . [01] . [02] . [04] . [08] . [10]   [20] . [01] . [02] . [00] . [00]   [20]
avrdude: Recv: . [11]

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x11
avrdude: Send: V [56] @ [40] . [00] . [00]   [20]   [20]
avrdude: Recv: . [12]
avrdude: stk500_cmd(): programmer is out of sync

Coding Badly


From part 2, between here...

Code: [Select]
avrdude: Send: d [64] . [00] @ [40] F [46]   [20] . [c0] / [2f] . [c0] . [2e] . [c0] - [2d] . [c0] , [2c] . [c0] A [41] . [c0] * [2a] . [c0] ) [29] . [c0] ( [28] . [c0] ' [27] . [c0] & [26] . [c0] % [25] . [c0] $ [24] . [c0] # [23] . [c0] " [22] . [c0] . [00] . [00] . [00] . [00] 7 [37] . [00] . [00] . [00] . [00] . [00] 8 [38] . [00] . [00] . [00] . [00] . [00] 6 [36] . [00] . [02] . [02] . [02] . [02] . [02] . [02] . [01] . [02] . [04] . [08] . [10]   [20] . [01] . [02] . [00] . [00]   [20]

...and here...

Code: [Select]
avrdude: Recv: . [11]

...is there a noticeable pause?

myplacedk

...is there a noticeable pause?

I don't see any pause. The output is a bit choppy, probably because the Arduino IDE (or its GUI framework) buffers it. But the upload process (without compiling) takes close to 2 seconds, in 9600 baud.

Coding Badly


Try this version...
https://raw.github.com/rsbohn/ArduinoISP/master/ArduinoISP/ArduinoISP.ino

myplacedk

Try this version...
https://raw.github.com/rsbohn/ArduinoISP/master/ArduinoISP/ArduinoISP.ino

Hey, that works! Thanks!

I had to reduce the speed from 19200 to 9600 baud (in ArduinoISP.ino and programmers.txt), but it works!

Coding Badly


Excellent!  You are welcome.

jgrina

Arduino IDE version 0022 uses ATtiny45-85
Arduino IDE version 1.0 uses tiny.zip from github
Loading ATtiny45-85 onto Arduino IDE version 1.0 makes a mess

Go Up