cannot upload. suspect code is stuck writing on pin 0...

Hi all,

I got my arduino recently and after playing around for a few days, I got it into a situation where I cannot upload code to it. It's a seeeduino v2.21 (ATMega 328). I suspect what caused it was a bit of code which I was modifying and uploaded by mistake in a not-so-good condition:

const int size=4;
const int arrayLine={3,4,5,6};
(...)
for(i=size-1;i>0;i++) { // notice the stopping condition is always true. this loop is infinite
  digitalWrite(arrayLine[i],LOW); // starts by writing LOW on pin 6 then proceeds forever into unitialised memory.
}

So the board is stuck trying to write onto unknown pins. If this includes pins 0 and/or 1, it might explain why the upload is failing, no?

The effect is that L keeps flashing constantly. When attempting to upload code RX flashes about 4 times (I believe this is the software trying to initiate the board for uploading) but TX never flashes, so the board is not responding to the programmer. Reset lights up the RST led while the button is pressed and L turns off, but immediately after RST is released, L returns to flashing. Hard reset (power off, power on) seems to initialise the board OK (RX, TX and L flash briefly, then all goes quiet) but after 1 second or so this behaviour resumes.

I've already ordered another arduino board to try and reflash the bootloader on this one. But I was interested in finding out how 'dead' the board may be, what's the content of uninitialised memory and what does my infinite cycle actually does.

Thanks in advance,
Pedro.

Good news, I managed to revive the board.

I did this by powering it on while holding the reset button, then starting the upload of a known working sketch and letting go of reset just after the sketch is compiled.

If anyone could chip in with information about that infinite loop condition, that would be helpful!

Cheers,
Pedro.