Blink sketch not working

I have a question concerning Arduino and downloading sketches via STK200 parallel port and the ATMEGA328 without a serial bootloader. I have it wired up with a 16MHz crystal and I tested it out by writing a quickie C program and downloading it with avrdude. I ran just fine.

I then opened Arduino and loadeed the example Blink sketch and used compile/verify which created Blink.cpp.hex in Linux’s /tmp/build< whole bunch of characters>. I then downloaded Blink.cpp.hex using avrdude, but nothing. I was not running.

Is there something that must be done to run sketches on an ATMEGA328 without a bootloader?

tj

Are you SURE it was not running? If you use an off-the-shelf ATmega328P and don't change the flags it will run at 1 MHz. That would mean your Blink sketch would toggle every 16 seconds. Burning the bootloader with the Arduino IDE takes care of switching to the external 16 MHz clock and pre-scale of 1 rather than the default internal 8 MHz clock and pre-scale of 8.

I changed the lfuse to 0xee, which should be low power crystal oscillator 8-16 Mhz and divide clock by 8 unprogrammed. Installed 16 Mhz crystal and LED circuit from pin 13 to ground.
First I wrote this standard C program and compiled it with avr-gcc

#include <avr/io.h>
#define DELAY 1024

int counter;

int main(void)
{
// Set Port D pins as all outputs
DDRD = 0xff;

// Set all Port D pins as HIGH
PORTD = 0xff;

while(1){
for(counter=DELAY;counter > 0;counter–);
PORTD = 0x00;
for(counter=DELAY;counter > 0;counter–);
PORTD = 0xff;
}
return 1;
}

Of course the LED glowed because of the output frequency, but I confirmed the square wave output with an oscilloscope.

I then started Arduino 1.0, loaded the Blink sketch, ran verify/compile and downloaded Blink.cpp.hex. No output toggling on PIN 13. I checked all port outputs with the scope and found none on any.

I’m stumped.

tj

tjp:
I changed the lfuse to 0xee, which should be low power crystal oscillator 8-16 Mhz and divide clock by 8 unprogrammed. Installed 16 Mhz crystal and LED circuit from pin 13 to ground.

If you want to use that Arduino IDE you should probably set the fuses to match one of the existing Arduino boards:
Arduino Duemilanove: hfuse=0xDA, lfuse = 0xFF, efuse=0x05
Arduino UNO: hfuse=0xDE, lfuse = 0xFF, efuse=0x05 (smaller bootloader)