No success making blink on ATtiny84

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have come from from successes with ATtiny85 and ATmega328 to failture with ATtiny84. I can't even get a single pin to light an LED. I have a VERY simple setup. Can anyone spot a trouble area?

My fuses read as follows (l,h,e): 0x62, 0xdf, 0xff

My code is 10 lines:

#include 

int main()
{
  DDRA |= 255; // set all port A pins for output
  PORTA |= 255; // set all bits on port A
  DDRB |= (1<<PB2);
  PORTB |= (1<<PB2);
  while (1) {}
}

The wiring is simple:

My USBtiny programmer is connected to the chip's 5V, GND, RESET, SCK, MOSI, & MISO pins (and avrdude raised no complaints). I have an LED connected to GND through a resistor; on its (+) lead, I have a jumper wire, which I have connected with each pin on the ATtiny84, but only the 5V pin will make the LED glow.

I have not burned a bootloader onto the chip (but I believe that it came from Sparkfun, so it should have a bootloader on it already).

Thank you for any support you may render.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems like a rather slippery problem.
Have you checked the compiler settings? Run the code in the simulator?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm afraid I have done neither of those, but if you can point me to instructions, I will do both.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Instructions for what! You assume i know what tools you are using. Nevertheless, most tools have help files.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

so it should have a bootloader on it already
As soon as you used ISP you will have wiped any bootloader.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry. Well, I'm using avr-gcc, and I have no idea how to make use of a simulator even after googling "avr-gcc simulator attiny84." Is avrstudio the only application out there with a simulator?

Quote:
As soon as you used ISP you will have wiped any bootloader.

I guess that I have always been without a boot loader on all my ICs, then. Does that present a problem?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I guess that I have always been without a boot loader on all my ICs, then. Does that present a problem?

No, since you have another programmer.

A bootloader is nothing but a programmer implemented in the AVR that is to be programmed.

You have a programmer external to the AVR, so you do not need a bootloader.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OP wrote:
I have no idea how to make use of a simulator

Kartman wrote:
...Nevertheless, most tools have help files.
Why didn't you follow Kartman's suggestion then :?: :wink: Look in AVR tools help files...

So the LED's on PB2? Are you sure you put it on the correct pin and it's not reverse-bias connected?

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I will try to help if I can.

Simulator -- If you were using AVR Studio you'd have access to a simulator that you could check your code, check resisters as you step through code, etc. Quite handy! On gcc, never mind that advice for now.

Did this exact code work properly on 328P and Tiny85? Or is the code a little different?

Are you sure you have your chip hooked up correctly?

You can verify your fuse settings here: http://www.engbedded.com/fusecalc/

I can't see why the code wouldn't work, though. It probably isn't the code itself. Is the correct device set upon compile? (Screenshot of your compile output would tell us)

Michael

It should work - bot-thoughts.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the advice. I used AVR Studio's simulator to confirm that it was not a software problem.

Then I went over it with a multimeter.

In the end (I'm so embarrassed), it turns out that I was tying the RESET pin DOWN instead of UP; I needed to move my 10Kohm resistor from Ground to +Vcc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to the club. Maybe the lesson learned is keep a scrapbook of all the problems that were hard to debug but would up having a simple fix. (Computer screen is blank? Cord plugged into wall? Lamp works in that wall socket? etc)

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Question, his code is initializing PortA but his LED's are being toggled on PortB... am I seeing this correctly?

include  

int main() 
{ 
  DDRA |= 255; // set all port A pins for output 
  PORTA |= 255; // set all bits on port A 
  DDRB |= (1<<PB2); 
  PORTB |= (1<<PB2); 
  while (1) {} 
}

Shouldn't his code be"

include  

int main() 
{ 
  DDRB |= 255; // set all port B pins for output 
  PORTB |= 255; // set all bits on port B 
  DDRB |= (1<<PB2); 
  PORTB |= (1<<PB2); 
  while (1) {} 
}
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Irwinjs22 wrote:
Question, his code is initializing PortA but his LED's are being toggled on PortB... am I seeing this correctly?

include  

int main() 
{ 
  DDRA |= 255; // set all port A pins for output 
  PORTA |= 255; // set all bits on port A 
  DDRB |= (1<<PB2); 
  PORTB |= (1<<PB2); 
  while (1) {} 
}

Shouldn't his code be"

include  

int main() 
{ 
  DDRB |= 255; // set all port B pins for output 
  PORTB |= 255; // set all bits on port B 
  DDRB |= (1<<PB2); 
  PORTB |= (1<<PB2); 
  while (1) {} 
}

He already is setting PB2 as output, its fine