Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

EvilScientist Example Circuit Not Working
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

EvilScientist Example Circuit Not Working

by jrh53 on Sat Dec 19, 2009 9:02 pm

I bought a USBTinyISP and a Evil Scientist Dec Board. I built the USBTinyISP and it works great. I programmed the sample LED blink code onto the ATMEGA328P provided with the kit with AVRdude and says it writes the code no problem. The LED on the board doesn't blink though and I don't know why it won't. I'm hooked up to Pin 5 and using the 1K resistor and LED that came with it. The LED is orientated right, i tested this using another power source. Is there something I have to do to "start" the micro controller or anything? Posted below is the example C code from the Adafruit Barebones Dev. Board page. It seems like a simple problem and is driving me crazy! help! haha

Code: Select all | TOGGLE FULL SIZE
#define F_CPU 1000000  // by default we have the 1MHz internal oscillator

#include <avr/io.h>      // this contains all the IO port definitions
#include <util/delay.h>

int main(void) {
  DDRB = (1 << 5);  // set PORTB5 to an output

  while (1) {
    PORTB |= 1 << 5;  // turn LED on
    _delay_ms(100);
    PORTB &= ~(1 << 5);  // turn LED on
    _delay_ms(100);
  }
}

jrh53
 
Posts: 25
Joined: Mon Nov 09, 2009 11:59 pm
Location: Ohio

Re: EvilScientist Example Circuit Not Working

by westfw on Sat Dec 19, 2009 10:33 pm

I'm hooked up to Pin 5
:
DDRB = (1 << 5); // set PORTB5 to an output

Are you connected to PIN 5, or the pin associated with PortB, Bit 5 (pin 19 of the chip, I believe.)?

(Sometimes I think that the single most important contribution of the Arduino development environment is that they renamed the pins in a way understandable by the average person, instead of the mystifying combination of "ports" and "bits.")

westfw
 
Posts: 1711
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: EvilScientist Example Circuit Not Working

by jrh53 on Sat Dec 19, 2009 10:39 pm

Its connected to the PB5. My setup is shown in the picture attached. I'm also powering it by the USBTiny using the jumper to provide 5V power.
Attachments
IMG_0269.JPG
IMG_0269.JPG (327.75 KiB) Viewed 3925 times

jrh53
 
Posts: 25
Joined: Mon Nov 09, 2009 11:59 pm
Location: Ohio

Re: EvilScientist Example Circuit Not Working

by trialex on Sun Dec 20, 2009 6:34 am

Windel (the guy behind evilmadscientist) is very active on the forums on his site - if you haen't already, posting over there will get you a quick response.
trialex
 
Posts: 189
Joined: Mon Apr 03, 2006 6:25 pm

Re: EvilScientist Example Circuit Not Working

by westfw on Sun Dec 20, 2009 3:44 pm

Does the combination of avrdude and USBtinyISP actually allow the target CPU to RUN after programming is done? It would be understandable behavior if it kept the cpu RESET except when actually programming it...

westfw
 
Posts: 1711
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: EvilScientist Example Circuit Not Working

by jrh53 on Sun Dec 20, 2009 4:27 pm

I tried that, powering it using a separate 5V source and disconnecting the programmer, no luck. Has anyone else bought the board and tried this simple circuit and got it working? Does the code look correct? I posted a topic on Evil Made Scientist Forums so maybe someone over there will be able to help

jrh53
 
Posts: 25
Joined: Mon Nov 09, 2009 11:59 pm
Location: Ohio

Re: EvilScientist Example Circuit Not Working

by oskay on Sun Dec 20, 2009 5:17 pm

I just tried your code and circuit and they both work... So, I suspect there's a bad solder joint at work here.

oskay
 
Posts: 19
Joined: Tue Jul 31, 2007 4:03 am

Re: EvilScientist Example Circuit Not Working

by jrh53 on Sun Dec 20, 2009 6:09 pm

Attached is a screen shot of my AVRdude Programming. I'm writing it to flash, is this correct?
Attachments
AVRDude.jpg
AVRDude.jpg (139.31 KiB) Viewed 3878 times

jrh53
 
Posts: 25
Joined: Mon Nov 09, 2009 11:59 pm
Location: Ohio

Re: EvilScientist Example Circuit Not Working

by westfw on Sun Dec 20, 2009 6:31 pm

86 bytes sounds awfully small. When I compiled your program on my system, I got a 196byte a.out file (according to avr-size)

(Hmm. Much of that is the vector table, though...)

westfw
 
Posts: 1711
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: EvilScientist Example Circuit Not Working

by oskay on Sun Dec 20, 2009 6:58 pm

I agree-- looks a little small. Can you show the step where you compile the code? Are you sure that the C program is saved?

oskay
 
Posts: 19
Joined: Tue Jul 31, 2007 4:03 am

Re: EvilScientist Example Circuit Not Working

by jrh53 on Sun Dec 20, 2009 7:27 pm

Not sure if this is correct...
I cd into the directory of the files then I type make
Attachments
MakeScreen.jpg
MakeScreen.jpg (142.48 KiB) Viewed 3871 times

jrh53
 
Posts: 25
Joined: Mon Nov 09, 2009 11:59 pm
Location: Ohio

Re: EvilScientist Example Circuit Not Working

by jrh53 on Sun Dec 20, 2009 7:58 pm

I got it working!!

Problem was in the makefile the MCU was the atmega8 while I was using the atmega328p.
I changed that ran the make program and it started flashing.

Thanks for your help!

jrh53
 
Posts: 25
Joined: Mon Nov 09, 2009 11:59 pm
Location: Ohio

Re: EvilScientist Example Circuit Not Working

by spierce on Tue Jan 19, 2010 1:01 am

I had exactly the same problem. When I did 'make', it made it for the Atmega8. Because the included chip is a AtMega328p (went nearly blind reading it off the chip; used the chip signature reported by avrdude and google to confirm), the code was wrong.

I tried to program the chip, but the type in the makefile was wrong (atmega8, correct: atmega328p), so it failed. I changed the Makefile (first line, MCU=atmega328p), then programmed it (same as you: 68 bytes), and it didn't work. That was because the code was still compiled for the Atmega8, but it was being flashed into the Atmega328p.

To fix: I did a 'make clean', then a 'make', then a 'make program', and it works now! BTW: The code was 158 bytes on mine.

I would have figured it out eventually, but the forum really helped.

Steve
spierce
 
Posts: 1
Joined: Tue Jan 19, 2010 12:51 am

Re: EvilScientist Example Circuit Not Working

by entropical on Mon Apr 05, 2010 10:54 pm

I have exactly this problem, and I'll try out your solution tonight.

I even posted a question here - viewtopic.php?f=20&t=15328

:)
entropical
 
Posts: 5
Joined: Mon Apr 05, 2010 5:33 pm

Re: EvilScientist Example Circuit Not Working

by mtbf0 on Tue Apr 06, 2010 10:42 pm

ain't that a bitch? make checks for modifications to everything except the Makefile.
"i want to lead a dissipate existence, play scratchy records and enjoy my decline" - iggy pop, i need more
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

Please be positive and constructive with your questions and comments.