I have the blink code below running on an attiny24 with the default fuses, via Atmel Studio 6. If I set DDRA to any combination of 5 pins (or set DDRA to 0xFF and then blink by setting PORTA to any combination of 5 pins) then it works but as soon as I use 6 pins it resets itself. The PORTB.0 toggle at start up demonstrates the reset.
The usual cause for this sort of behaviour is sourcing or sinking too much current on the outputs, however this is happening when the outputs are left open, nothing attached, so I can't see what's causing it. Any suggestions?
int main(void)
{
// DEBUG: Toggle PORTB.0 to demonstrate AVR reset.
DDRB = 0x01; PORTB ^= 0x01; _delay_ms(10); PORTB ^= 0x01;
// Output 6 pins at once (change to 5 pins and AVR does not reset).
DDRA = 0b00111111;
for (;;)
{
PORTA = 0xff;
_delay_ms(1000);
PORTA = 0x00;
_delay_ms(1000);
}
}
I've tried the usual suspects, power supply, running with AVRISP disconnected and ensuring there is a cap between +VE and GND. Also tried setting pins individually and as soon as it hits 6 it resets.
