First post here, I'll be pretty straight forward.
I have been playing around with the mega16 a while now. Most recently i tried to get PWM working. I thought i was pretty close to working code so i decided to test run to see if what happened.
I flashed to software to the chip (avrdude with a stk500 board), here's what happened:
PD6 is lit, slightly dimmed.
PD5 is lit, bright.
PD3 is not lit, when i press reset is lit (very faint).
Now i cannot flash the chip anymore.
Avrdude tells me:
avrdude: stk500v2_command(): command failed avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check.
AVRStudio4 can read the id of the card but i cannot erase it.
Here's the code:
... // Set up the pins as output DDRD |= (1 << PD5); // OC1A DDRD |= (1 << PD4); // OC1B ICR1 = 20000; // Set the resolution to 20000 (overflows every 20ms) OCR1A = 1500; OCR1B = 1500; TCCR1A |= (1 << COM1A1)|(1 << COM1A0); // Inverted Compare Output Mode TCCR1A |= 14; // WGMode 14: Fast PWM using ICR1 as TOP TCCR1B |= (1 << CS10); // No Prescaling (1MHz) TCCR1B |= 14; // WGMode 14: Fast PWM using ICR1 as TOP ...
When i run avrdude with -tuF i get:
avrdude: Device signature = 0xffffff avrdude: Yikes! Invalid device signature. avrdude: Expected signature for ATMEGA16 is 1E 94 03 avrdude>