Hi everyone! I'm new to the Arduino but not micro controllers in general. I've had my nano for about a week now and have been playing with it using the both Arduino IDE and AVR studio. Things have been going great until today. I started messing around with counters and interrupts and I have put myself in quite the predicament. So now I'm hoping some expert help will prevent me from needing to buy a new one :).
Basically, what I've done is set up TIMER2 with a 1024 prescaler and an overflow interrupt. When the interrupt handler is called, I'm turning on some LEDs and delaying in order to verify the interrupt was called. Then I return to an empty busy loop in main and wait for the next overflow. I was programming this using AVR Studio and uploaded it via my AVRISP MKII and it ran fine.
However, now that I've uploaded this program, I can no longer connect to the Atmel to update the code. Every time I try to connect in AVR Sudio, it fails, even though I get the Green light on the AVRISP saying it has detected the chip. Should the AVRISP always be able to update the flash regardless of the program that's running? My first guess is that my interrupt handler is taking so long that by the time it exits, the overflow has already occurred again, and immediately calls the interrupt again. So there's no real "free" time for the micro to handle the ICSP connection. Would this constant interrupting prevent the ICSP from being able to communicate?
So I'm now stuck with these LEDs going crazy every time I power on the nano and I can't connect to fix the code. Is there a way I can stop the code from running or completely clear the flash without ICSP? How hosed am I? Be straight with me doc, I can take it...
-Thedigitalsean