1

I want to use an Arduino Yun as ISP to program an Attiny85. I have soldered a shield following the circuit that is depicted in many sites. You can see it in this page.

I have included a LED with a 1k resistor in series connected between pin 5 (PB0) and ground so that I can monitor.

I have setup my sketch environment (Arduino 1.6.12) with the definitions of the Attiny so that I can select this board (Attiny85) with it's associated parameters.

I have defined in Arduino 1.6.12 the board in this way:

  • Board: "ATtiny25/45/85"
  • Processor: "ATtiny85"
  • Clock: "Internal 1MHz"
  • Port: "192.168.1.109 (Arduino Yún)"

I use this port instead of the serial USB port as I had many issues with the serial USB port.

I have started with the Blink sketch modifying it to use pin0 The sketch is this one:

// the setup function runs once when you press reset or power the board
int LED = 0;  //0 para Attiny
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED, HIGH);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

The output of the sketch loading in verbose mode is this one:

El Sketch usa 672 bytes (8%) del espacio de almacenamiento de programa. El máximo es 8.192 bytes.
Las variables Globales usan 9 bytes (1%) de la memoria dinámica, dejando 503 bytes para las variables locales. El máximo es 512 bytes.
/usr/bin/run-avrdude /tmp/sketch.hex -v -pattiny85

avrdude: Version 6.1, compiled on Apr  8 2016 at 15:56:17
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/root/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : unknown
         Using Programmer              : linuxgpio
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         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    10     8    0 no       1024    8      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : linuxgpio
         Description     : Use the Linux sysfs interface to bitbang GPIO lines
         Pin assignment  : /sys/class/gpio/gpio{n}
           RESET   = ~18
           SCK     =  11
           MOSI    =  27
           MISO    =  8

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587
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 "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xD8"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xD8:
avrdude: load data hfuse data from input file 0xD8:
avrdude: input file 0xD8 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFB"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFB:
avrdude: load data efuse data from input file 0xFB:
avrdude: input file 0xFB contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "/tmp/sketch.hex"
avrdude: writing flash (672 bytes):

Writing | ################################################## | 100% 0.40s

avrdude: 672 bytes of flash written
avrdude: verifying flash memory against /tmp/sketch.hex:
avrdude: load data flash data from input file /tmp/sketch.hex:
avrdude: input file /tmp/sketch.hex contains 672 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.57s

avrdude: verifying ...
avrdude: 672 bytes of flash verified

avrdude done.  Thank you.

What looks pretty normal for me. When the load is ongoing, I see the 1st thing that puzzles me: LED connected to pin 5 (PWM0) doesn't blink quickly. I have tested the polarity of the LED with a +5V connected to the physical pin of the chip and 0V connected to GND and it lights.

The second thing that puzzles me is that I get exactly the same output when I remove the programming shield (no Attiny at all) and I click on upload and the output is the same. Is the Arduino IDE caching this output?

When I put the "programmed" Attiny in a breadboard and I power it and connect one LED to port 5, it doesn't blink as per the Blink sketch.

I am quite a newby with Arduino and ATtiny85. I only wan to be able to program this ATtiny85 with my Arduino Yún

What am I doing wrong? Could you give some light to this darkness?

migrated from electronics.stackexchange.com Oct 11 '17 at 15:50

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • Your link location is incorrect, and takes you to a PIR sensor board. – DigitalNinja Oct 11 '17 at 0:25
  • Thanks for the comment... it's somewhat strange, when I follow the link it leads to a page with this title: "Program an ATtiny with an Arduino Nano" – user1006082 Oct 11 '17 at 20:49
  • The link is fine - it goes to something that seems like it should be relevant, but actually isn't because of the differences between the Nano and the more Leonardo-like Yun, and then because the asker has ignored the serial interface used and mistakenly substituted the Yun's method of ISPing it's captive Arduino - which isn't going to work for an external target. – Chris Stratton Oct 11 '17 at 21:07
1

It's not programming a non-existent ATtiny, it's quite explicitly stating in the output that it is programming an ATmega32u4 - and that would be the "Arduino" part of the YUN.

It's not clear that the YUN is really intended to ISP other targets.

If you can get serial communication to the ATmega32U4, you could try to find a compatible variation of the ISP sketch to load on that, and in turn use it to program an ATtiny.

Or you could try to define a different set of programming pins, but this may be tricky.

Essentially, what you are trying to do is a bit unusual, and will likely require investing some real time in understanding the existing / available mechanisms enough to adapt them to a fairly unique goal.

Otherwise, just get an Uno or similar and use that to ISP your ATtiny.

  • I have followed your advice, Chris. I've got an Arduino UNO and the shield that I have created worked like a breeze! Now I can program my ATtiny85 / 85... :) Thanks a lot for your answer. – user1006082 Oct 11 '17 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.