Go Down

Topic: Pin13 blinking and cant upload to arduino (Read 790 times) previous topic - next topic

stoopkid

I uploaded this program to my arduino UNO:

Code: [Select]
//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.

stoopkid

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

stoopkid

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

davekw7x

#3
Apr 09, 2011, 08:48 pm Last Edit: Apr 09, 2011, 08:57 pm by davekw7x Reason: 1
Look (really look) at the following line:
Code: [Select]

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...

stoopkid

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.

Go Up