hinata46243 / mega-isp

Automatically exported from code.google.com/p/mega-isp
0 stars 0 forks source link

Duemilanove programming Attiny85 succeeds but doesn't work #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
--------------------
Steps to dupe:
--------------------
1. Using Arduino-0016, program Arduino Duemilanove (Duey) with mega-isp.

2. Hook Duey to Attiny85 (Tiny):
   Duey   Tiny
   13     pin7 (PB2 / SCK)
   12     pin6 (PB1 / MISO)
   11     pin5 (PB0 / MOSI)
   10     pin1 (PB5 / Reset)

3. Power Tiny with 5V (independent of Duey)
   0V     pin4
   5V     pin8

4. Compile and program Tiny:
avr-gcc -mmcu=attiny85 -Wall -I./ -o myblinky.out matt.c
avr-objcopy -j .text -O ihex myblinky.out myblinky.hex
avrdude -p t85 -c avrisp -b19200 -P /dev/ttyUSB0 

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

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

avrdude: Device signature = 0x1e930b

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

5. Disconnect Duey from Tiny.  Connect reset to VCC.

--------------------
Expected output
--------------------
I expect 5V on Tiny's PB4 (pin 3) or PB3 (pin 2).

--------------------
Actual output
--------------------
Tiny:
4.9V  pin1 PB5 (reset)
0.4V  pin2 PB3
0.3V  pin3 PB4
0.0V  pin4 GND
0.4V  pin5 PB0 (MOSI)
0.4V  pin6 PB1 (MISO)
0.4V  pin7 PB2 (SCK)
4.9V  pin8 VCC

Duey:
pin7 (heartbeat)   LED slowly pulsing
pin8 (error)       LED never comes on
pin9 (programming) LED on while programming, now off

--------------------
Other info
--------------------
Ubuntu 9.04

$ avrdude -v
avrdude: Version 5.5, compiled on Jan 28 2009 at 10:40:52

Here's the fuse data:
$ cat efuse.dat 
0b11111111
$ cat hfuse.dat 
0b11011111
$ cat lfuse.dat 
0b1100010

This is the first AVR I've ever tried to program.  I'm guessing I'm making
a newbie mistake.  And if I need to be directed to a different forum,
please tell me.

--------------------
matt.c
--------------------
/* Gets the avr library from /usr/lib/avr/include on my machine */
#include <avr/io.h>

int main (void) {
    /* PB4/PB3 are not used when programming */
    DDRB = _BV(PB4) | _BV(PB3);

    while (1) {
        /* PB4 = 1, PB3 = 0 */
        PORTB = _BV(PB4);
    }
}

Original issue reported on code.google.com by haggar...@gmail.com on 19 Nov 2009 at 5:01

GoogleCodeExporter commented 8 years ago
The defect, dear sirs, is with the human.

I was doing:

avrdude -p t85 -c avrisp -b19200 -P /dev/ttyUSB0

instead of

avrdude -p t85 -c avrisp -b19200 -P /dev/ttyUSB0 -U flash:w:myblinky.hex

No wonder it wasn't working :)  It now works wonderfully!

Original comment by haggar...@gmail.com on 20 Nov 2009 at 5:43

GoogleCodeExporter commented 8 years ago
Glad that it is working for you!

Original comment by rsb...@gmail.com on 23 Nov 2009 at 9:17