Did my sketch stop my ProMicro from uploading?

i have a pro micro 3.3v/8Mhz (DEV-10999).
I have installed all the drivers etc., and the IDE 1.0.1 as per info on forums and the board has been working absolutely fine for some time.

However, i recently had an upload failure, and now i can no longer upload at all. If i try and upload a sketch it gets approx 80% of the way in then hangs.
Eventually i get a message:

Binary sketch size: 4,368 bytes (of a 28,672 byte maximum)
avrdude: ser_send(): write error: sorry no info avail

I have tried all the obvious fixes (board is set correct in the IDE, serial port is set correct, i have re-booted the PC, i have deleted and re-installed the SparkFun ProMicro8MHz driver etc).
The exact same setup will successfully program a Pro Micro 5v/16MHz board (once i switch the board & com port in the IDE).

The program i uploaded is listed below - a first attempt to do something with timers and interrupts. A modified version of code i found on the web. Could it have screwed the pro micro up??? (e.g i notice i left the wrong interrupt vector in there). Can anyone give me any help to get it going again?

Many Thanks,
Paul.

#include <avr/interrupt.h>
#include <avr/io.h>

int ledPin = 17;
int int_counter = 0;
volatile int second = 0;
int oldSecond = 0;
long starttime = 0;

ISR(TIMER2_OVF_vect) {
TCNT1 = 0;
int_counter += 1;
if (int_counter == 1000) {
second+=1;
int_counter = 0;
}
};

void setup() {
Serial.begin(115200);
Serial.println(“Initializing timerinterrupt”);

TCCR1A = 0x0;
TCCR1B = _BV(CS11);
TCCR1C = 0x0;

TIMSK1 = _BV(OCIE1A);
OCR1A = 1000;
TCNT1 = 0;
sei();
starttime = millis();
}

void loop() {
if (oldSecond != second) {
Serial.print(second);
Serial.print(". ->");
Serial.print(millis() - starttime);
Serial.println(".");
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
oldSecond = second;
}
}

I had more than one occasion where I was experimenting with a Pro Micro and a sketch gone awry could interfere with uploading new sketches. The simplest way to do it is just have some constant non-stop output on the serial port. Messing with interrupts could probably do it too, if you've done something to bork the virtual serial port.

The reason is that the automatic reboot portion of the code relies on a manipulation of the virtual serial port (specifically have the baud rate changed to 1200 baud), but if the virtual serial port is very busy then there's no opportunity for it to be tweaked to cause the uC to reset. And with the uC not resetting, the bootloader never runs, and the IDE cannot upload a new sketch.

The solution is to wire a reset button in there between the RST pin and Ground. Or you have the Pro Micro on a breadboard just use a bit of wire between RST and ground. The trick is once you press the 'upload' button in the IDE, then press your reset button (or touch the RST line to ground briefly). It requires a bit of trial and error to get the timing perfect but it can be done and it's not that hard. You don't want to hold the reset button (or hold RST to ground) you just want to briefly touch it and release so that the uC is reset and the bootloader starts running, right when the IDE is trying to upload the sketch.

The trick is for the Arduino IDE to 'see' the bootloader at the right moment, and then the sketch can be uploaded. If the timing is off you'll get an error in the IDE that avrdude can't communicate or something like that.