I have been just messing around, but I seem to have it running quite reliably at 115200bps.
Here are my modifications:
Add:
#define MAXZ (19200L * 30)
#define BAUDRATE 115200
#define HBDELAY MAXZ/BAUDRATE
Modify:
void setup() {
Serial.begin(BAUDRATE);
...
}
uint8_t hbval=128;
int8_t hbdelta=3; // play with this to get what you like
void heartbeat() {
if (hbval > 224) hbdelta = -hbdelta;
if (hbval < 16) hbdelta = -hbdelta;
hbval += hbdelta;
analogWrite(LED_HB, hbval);
delay(HBDELAY);
}
Proof? :
>avrdude -Cavrdude.conf -cstk500v1 -P\\.\COM3 -b115200 -p atmega8 -U flash:w:ArduinoISP2.cpp.hex:i
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.04s
avrdude: Device signature = 0x1e9307
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "ArduinoISP2.cpp.hex"
avrdude: writing flash (4386 bytes):
Writing | ################################################## | 100% 2.78s
avrdude: 4386 bytes of flash written
avrdude: verifying flash memory against ArduinoISP2.cpp.hex:
avrdude: load data flash data from input file ArduinoISP2.cpp.hex:
avrdude: input file ArduinoISP2.cpp.hex contains 4386 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 2.56s
avrdude: verifying ...
avrdude: 4386 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.