Pages: [1]   Go Down
Author Topic: Pin13 blinking and cant upload to arduino  (Read 747 times)
0 Members and 1 Guest are viewing this topic.
California
Offline Offline
Sr. Member
****
Karma: 3
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I uploaded this program to my arduino UNO:

Code:
//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;
byte Dig[] = {
  B0000,
  B0001,
  B0010,
  B0011,
  B0100,
  B0101,
  B0110,
  B0111,
  B1000,
  B1001};

int Num[6] = {0,0,0,0,0,0};
int i = 0;

void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
 
  for(int x = 0;0<6;x++){
  Num[x] = x + 1;
  }
}

void loop() {
  i++;

  if (i==10)i=0;
  byte Digit[3];
 
Digit[0] = (Num[1] << 4) | Num[0];



  digitalWrite(latchPin, LOW);

  shiftOut(dataPin, clockPin, MSBFIRST, Digit[0]);
  shiftOut(dataPin, clockPin, MSBFIRST, Digit[0]);
  shiftOut(dataPin, clockPin, MSBFIRST, Digit[0]);



  digitalWrite(latchPin, HIGH);
  delay(1000);
}



And even though there is no mention of pin13, it is blinking. and even though it has a 1 second delay, it is blinking very fast, like 50 or 100 milliseconds delay. And now I cannot upload, i get the error:

Quote
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

I thought maybe I had messed up the atmega, so i put a new one in, uploaded this program fine, but the exact same thing is happening again. Im just trying to put the blink program on it and I get that error. Ive gone though the troubleshooter, unplugged everything, but I get the same results. The loop-back test or whatever its called works fine.
Logged

California
Offline Offline
Sr. Member
****
Karma: 3
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

All different timings of manual resetting don't help either.
Logged

California
Offline Offline
Sr. Member
****
Karma: 3
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Third and last atmega wont upload a new program at all, even after double checking the board settings and everything.
Logged

Left Coast, USA
Offline Offline
Sr. Member
****
Karma: 7
Posts: 499
Sometimes I just can't help myself.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Look (really look) at the following line:
Code:
for(int x = 0;0<6;x++)


Regards,

Dave

Footnote:
A lot of Uno boards were apparently shipped with a defective bootloader that causes problems under certain conditions.  You can try the old-fashioned way:

Load a simple sketch (the Blink example).

Hold the Uno reset button down and click the Arduino "Upload" icon.  As soon as the window at the bottom of the Arduino IDE reports "Binary sketch size:   " release the Uno reset button.  It may take some practice to get the timing right...
« Last Edit: April 09, 2011, 01:57:00 pm by davekw7x » Logged

California
Offline Offline
Sr. Member
****
Karma: 3
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Doh! I totally fixed that days ago but didnt save because my arduino app was running off a flash drive that a accidentally removed before saving.

Anyway I've tried all sorts of manual resets with no luck. Just keep trying?

Oh, im using bootloaded atmegas from sparkfun, not the one that came with it.
Logged

Houston
Offline Offline
Jr. Member
**
Karma: 0
Posts: 95
Electronics is just part of life.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

that's probably it. the atmega that come bootloaded from sparkfun are for the dicemelia. not for the uno. they just came out with the new ones this friday on the new product post. but i doubt those could arive that fast.
Logged

California
Offline Offline
Sr. Member
****
Karma: 3
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've tried it set for the UNO, Duemilanove and Dicemelia. I've tried holding reset until all different intervals of time, and still nothing.

The weird thing is that I didn't have this problem with the sparkfun chip until I uploaded this sketch. But now that I am having this problem it applies to even a fresh chip I haven't opened yet.

Oh, by the way, I see what the error was with my coding, but why is pin 13 blinking?

Also I should mention that I managed to upload this bad code to another chip with no problem after having trouble with the first. When I got to the third chip I just tried the blink example and had no luck.
« Last Edit: April 11, 2011, 03:24:36 am by stoopkid » Logged

California
Offline Offline
Sr. Member
****
Karma: 3
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I built a parallel programmer, installed giveio and set the registry entry for winxp and I get this error:

Quote
avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
avrdude: AVR device not responding
 ***failed; 
avrdude: verification error, first mismatch at byte 0x0000
         0x05 != 0x07
avrdude: verification error; content mismatch

can I get any advice?
Logged

Pages: [1]   Go Up
Jump to: