ATTINY84A-PU not blinking! Programmed via UNO

hi really just new to Arduino.

i tried first programming the ATTINY84A-PU using usbasp(bought on ebay) via the Arduino IDE but keeps getting the sck error. I think ive tried all the 3 board choices on Arduino IDE (ATtiny84 @ 16mhz external, @ 1mhz internal, and 8 mhz internal) but nothing works. i can't get the LED to blink.

so I tried it on my Arduino UNO to program the ATTINY84A-PU. I think it programmed it successfully but no blinking led still. I've checked all connecttions and all in the right place.

I read somewhere this forum that says:

You have switched the clock source to External Crystal Oscillator. You will have to provide a clock signal on the XTAL1 pin or connect the crystal + capacitors.

Is there any remedy if I don't have any crystal oscillator right now? So how can I provide a clock signal?

Is there any remedy if I don't have any crystal oscillator right now? So how can I provide a clock signal?

No. You will need a crystal or resonator to even program the chip again. Once you get to where you can program it again, burn a bootloader meant for the attiny to set the fuses and settings correctly before trying to upload a program.

codlink:
No. You will need a crystal or resonator to even program the chip again. Once you get to where you can program it again, burn a bootloader meant for the attiny to set the fuses and settings correctly before trying to upload a program.

Do I need to get a 16mhz crystal or anything below the Attiny84's maximum speed of 20mhz?

For the USBASP, the crystal frequency is not critical, but has to be above a certain figure or else you need to set the slow clock option in the programmer.

Now,

2n3904:
Is there any remedy if I don't have any crystal oscillator right now? So how can I provide a clock signal?

A crystal is not the only way to provide the clock.

Read up on it here with respect to the "Alternate clock source".

Nick's code should be applicable to the tiny84.

I think it programmed it successfully ...

Can you post your log when programming through the Uno?

i tried Nick's Atmega_Board_Detector and I get this on the Serial Monitor on Arduino IDE:

Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x93 0x0C
Processor = ATtiny84
Flash memory size = 8192 bytes.
LFuse = 0x62
HFuse = 0xD7
EFuse = 0xFF
Lock byte = 0xFF
Clock calibration = 0x6C
No bootloader support.

First 256 bytes of program memory:

0: 0x1E 0xC0 0x38 0xC0 0x37 0xC0 0x36 0xC0 0x35 0xC0 0x34 0xC0 0x33 0xC0 0x32 0xC0
10: 0x31 0xC0 0x30 0xC0 0x2F 0xC0 0x68 0xC0 0x2D 0xC0 0x2C 0xC0 0x2B 0xC0 0x2A 0xC0
20: 0x29 0xC0 0x01 0x02 0x04 0x80 0x40 0x20 0x10 0x08 0x04 0x02 0x01 0x02 0x02 0x02
30: 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x00 0x3B 0x38 0x00 0x3A 0x37 0x11 0x24
40: 0x1F 0xBE 0xCF 0xE5 0xD2 0xE0 0xDE 0xBF 0xCD 0xBF 0x10 0xE0 0xA0 0xE6 0xB0 0xE0
50: 0xE8 0xE9 0xF3 0xE0 0x02 0xC0 0x05 0x90 0x0D 0x92 0xA4 0x36 0xB1 0x07 0xD9 0xF7
60: 0x20 0xE0 0xA4 0xE6 0xB0 0xE0 0x01 0xC0 0x1D 0x92 0xAF 0x36 0xB2 0x07 0xE1 0xF7
70: 0x8D 0xD1 0x90 0xC1 0xC5 0xCF 0x61 0xE0 0x80 0x91 0x62 0x00 0x1B 0xC1 0x60 0x91
80: 0x64 0x00 0x70 0x91 0x65 0x00 0x80 0x91 0x62 0x00 0xD5 0xD0 0x20 0x91 0x60 0x00
90: 0x30 0x91 0x61 0x00 0x80 0x91 0x64 0x00 0x90 0x91 0x65 0x00 0x82 0x0F 0x93 0x1F
A0: 0x90 0x93 0x65 0x00 0x80 0x93 0x64 0x00 0x00 0x97 0x19 0xF0 0x8F 0x3F 0x91 0x05
B0: 0x39 0xF4 0x31 0x95 0x21 0x95 0x31 0x09 0x30 0x93 0x61 0x00 0x20 0x93 0x60 0x00
C0: 0x6E 0xE1 0x70 0xE0 0x80 0xE0 0x90 0xE0 0x7D 0xC0 0x8E 0xB5 0x88 0x7F 0x8E 0xBD
D0: 0x8F 0xB5 0x8C 0x7F 0x81 0x60 0x8F 0xBD 0x8E 0xB5 0x87 0x7E 0x8E 0xBD 0x8E 0xB5
E0: 0x88 0x7F 0x82 0x60 0x8E 0xBD 0x08 0x95 0x1F 0x92 0x0F 0x92 0x0F 0xB6 0x0F 0x92
F0: 0x11 0x24 0x2F 0x93 0x3F 0x93 0x8F 0x93 0x9F 0x93 0xAF 0x93 0xBF 0x93 0x80 0x91

Programming mode off.

I connected the xtal1 pin from the attiny84a to the UNO's pin 9 but still no blinking led.

A while back, I'm not really sure if I programmed it successfully or not.

Here's what I did to program ATtiny84a via Arduino UNO:

  • Opened the ArduinoISP and uploaded it successfully to the Arduino UNO.
  • Connected the ATtiny84a to the UNO(MISO to pin12, SCK to pin13, MOSI to pin 11, RESET to pin 10, vcc to 5v, gnd to gnd).
  • I selected from >> Board >> ATTiny84 @ 1 MHz (internal oscillator; BOD disabled)
  • I selected from >> Programmer >> Arduino as ISP
  • Upload done without errors.

I've seen two different pin mapping diagrams for the ATtiny84, both widely available online. When I first used one, I connected the pins according to the diagram I had, and also didn't get the expected flashing LED. I connected my LED plus resistor to each pin in turn, and soon discovered that it was in fact working, but I had the wrong pin mappings.
I searched and found a mapping diagram that corresponded to the result of my test, and have never had another problem.

I might be waaay off-track, but just thought I'd better mention it.
This is the diagram I now successfully use, in conjunction with DrAzzy's tiny cores:-

From memory, with the first mapping diagram that I followed, pin D0 was listed as physical pin 13, instead of physical pin 2.

Edit: Just looking at your last post, did you do the "Burn Bootloader" step, between your step 4 and step 5? ie. Just before uploading your sketch.
This must be done to set the fuses.

Im using the same diagram i found at http://www.atmel.com/images/8183s.pdf

Yes i've done the "Burn Bootloader" before uploading the sample sketch.

Im kinda confused. Is arduino.org and arduino.cc the same? Coz i got the Arduino IDE software from the .org site. Should I use the software on .cc instead?

Arduino.cc

And can you please post your code, between code tags.

The diagram in the ATtiny84 datasheet doesn't show the equivalent Arduino pin mappings. The Arduino pin numbers are from 0 to 10, as shown in the diagram I posted.

In your code, which pin number did you set to blink?
e.g.

pinMode(3, OUTPUT);
digitalWrite(3, HIGH);

makes a LED on physical pin 6, (PA7), turn on.

Edit: You do have a resistor fron pin 4, (reset), to Vcc don't you?

ok, so I downloaded Arduino 1.6.7 from arduino.cc and installed. I did all the steps again and it works successfully this time. what a relief! :slight_smile: :slight_smile: :slight_smile: the blinking LED just makes my day. hahaha..

However, i get this message at the bottom of the IDE software:

Done uploading.

In file included from D:\Arduino.cc\hardware\arduino\avr\cores\arduino/Stream.h:26:0,

from D:\Arduino.cc\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29,

from D:\Arduino.cc\hardware\arduino\avr\cores\arduino/Arduino.h:224,

from sketch\Fade.ino.cpp:1:

D:\Arduino.cc\hardware\arduino\avr\cores\arduino/Print.h:32:0: warning: "BIN" redefined [enabled by default]

#define BIN 2

^

In file included from d:\arduino.cc\hardware\tools\avr\avr\include\avr\iotn84.h:38:0,

from d:\arduino.cc\hardware\tools\avr\avr\include\avr\io.h:440,

from d:\arduino.cc\hardware\tools\avr\avr\include\avr\pgmspace.h:88,

from D:\Arduino.cc\hardware\arduino\avr\cores\arduino/Arduino.h:28,

from sketch\Fade.ino.cpp:1:

d:\arduino.cc\hardware\tools\avr\avr\include\avr\iotnx4.h:71:0: note: this is the location of the previous definition

#define BIN 7

^

Sketch uses 1,000 bytes (12%) of program storage space. Maximum is 8,192 bytes.
Global variables use 15 bytes of dynamic memory.

sample code i use:

/*
 Fade

 This example shows how to fade an LED on pin 9
 using the analogWrite() function.

 The analogWrite() function uses PWM, so if
 you want to change the pin you're using, be
 sure to use another PWM capable pin. On most
 Arduino, the PWM pins are identified with 
 a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.

 This example code is in the public domain.
 */

int led = 7;           // the PWM pin the LED is attached to
int brightness = 0;    // how bright the LED is
int fadeAmount = 15;    // how many points to fade the LED by

// the setup routine runs once when you press reset:
void setup() {
  // declare pin 9 to be an output:
  pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // set the brightness of pin 9:
  analogWrite(led, brightness);

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;
  }
  // wait for 30 milliseconds to see the dimming effect
  delay(30);
}

Yep, you'll always get that warning message, it's not an error.
It's a problem with the libraries, because they all decided to redefine "BIN" instead of thinking of their own names.
It can potentially come back to bite you, depending on which of the standard library functions you actually use, but until it's actually a problem with a sketch, just ignore it.

Your Arduino pin numbers must be totally different mappings to the cores that I'm using, from DrAzzy's site.
You define the LED as being on Arduino pin 7. That maps to physical pin 10 using DrAzzy's cores, which isn't a PWM output.
Further confusion is added by the fact that the comments in your code call it pin 9.

Which pin do you have the LED on, according to the actual chip pin numbers, (1 to 14), not the pin mappings?

I thought you might answer my question before leaving, but maybe you missed it.

I just duplicated your result on physical PWM pin 7, PA6, but had to define the pin in my code as pin 4:-

const byte led = 4;

Where did you get the cores you're using?
And would you mind answering my last question? ie Which 'physical' pin do you have your LED connected to?
I'm surprised that different cores appear to use different pin mappings.

OldSteve:
I thought you might answer my question before leaving, but maybe you missed it.

I just duplicated your result on physical PWM pin 7, PA6, but had to define the pin in my code as pin 4:-

const byte led = 4;

Where did you get the cores you're using?
And would you mind answering my last question? ie Which 'physical' pin do you have your LED connected to?
I'm surprised that different cores appear to use different pin mappings.

The LED is connected on the attiny84a's pin 6 as per http://www.atmel.com/images/8183s.pdf.

The code i used from File >> Examples >> 01. Basics >> Fade

Thanks. That's interesting. Physical pin 6 is defined as Arduino pin 3 with DrAzzy's cores.

Are the ATtiny cores that you're using supplied with the V1.6.7 Arduino installation, or did you get them elsewhere?
I'm using V1.6.5, which came without any tiny cores.

To get the exact same result as you, I have to do this:-

const byte led = 3;

All very confusing. Pity that all cores don't use the same pin mapping. This will cause heaps of confusion amongst different users trying to get the same code working. Not good at all.

Im using arduino.cc version 1.6.7. I don't think you can program attiny chips out of the box. im not sure but I got the additional boards from https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json.

2n3904:
Im using arduino.cc version 1.6.7. I don't think you can program attiny chips out of the box. im not sure but I got the additional boards from https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json.

No, usually you need to add cores, but not having used V1.6.7, I thought maybe they'd been added to the standard installation.

David Mellis wrote your ATtiny cores. He usually goes anti-clockwise in his mappings, but in the case of the tiny84, he went clockwise.

The cores I'm using were mapped anti-clockwise, so they're effectively opposite. I'm not sure which is truly correct, but at this point that doesn't matter, I suppose.

Bloody annoying, and as I say, bound to lead to lots of confusion when programs don't perform as expected.

Thanks for helping me to sort this out in my head, anyway. I'll keep it in mind if and when I help someone else out with the tiny84.

(I decided to use DrAzzy's cores because they have a wider range of options for oscillator, BOD and support for more of the tiny boards.)

OldSteve, your welcome! I just got my arduino uno a few days ago and just started learning.

2n3904:
OldSteve, your welcome! I just got my arduino uno a few days ago and just started learning.

I've had mine a lot longer, but am still learning too. :smiley:

And the plot thickens. A bit of research shows that David Mellis wrote both sets of pin mappings. The mappings in DrAzzy's cores were written by David in 2007, and are in the anti-clockwise direction. I wonder what made him rewrite them the other way around?

At least I now know who to blame for the confusion. :slight_smile:

Edit: Your cores were written by David in 2005, then modified in 2009, apparently by David and two others.

All finished now. :smiley: