Bootloader can't sync after Serial.write frm setup

Fresh out of the box, I got my Duemilanove to run the "Blink" and a modified "Blink" program fine. I loaded up a new custom midi encoder sketch, which sends out a "Device report" (midi SysEx) from the setup function, and now my bootloader can't sync up to load a new program. Have I managed to effectively "hose" the processor from a loaded program? I would hope it'd be more forgiving than that. Any suggestions shy of buying a new chip with bootloader? Thanks, -EM

Folks have reported that pressing the reset button while uploading (or holding the reset button until upload starts or uploading then pressing reset) has restored their Arduino. I suspect you can find details searching the forums. If you still can't get it working, post a reply with what you've tried. Hopefully someone can think of something else to try that works.

If you find something that helps, please report back. Your experience may help someone else.

Thanks for your reply. I haven't found any combination of resetting and uploading that seems to work. At least the chips with bootloader are pretty cheap. I think for future development cycles where I use the serial port, I may reserve one input data pin which I can take low to disable all serial access from my sketches, so that this can't happen again. Just delaying serial I/O for several seconds after startup is recommended, but goofs like mine are always possible and as I've discovered, can be hard to recover from. Thanks again! -EM

Huh. The behavior of your sketch shouldn't interfere with uploading. Is anything connected to pins 0 or 1? You might also try holding the reset button down while you connect your Arduino to the computer, and keep it down until just before hitting the upload button - but this shouldn't be necessary.

Well, maybe it's not my sketch. I see a number of other folks have gotten the same two messages as me, but I haven't seen a definitive solution. These error's are displayed and fast blinking "L" led encountered when trying to upload a sketch.

avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

Did you try the troubleshooting guide:

Yes. I've tried the troubleshooting tips as well. I've ordered a new chip with bootloader, so maybe I'll get lucky and it will fix whatever the problem is. Thanks to each of you for trying to help! Take care, -EM