FrequencyTimer2 & Serial ... conflicting?

I built and tested a robot. Ran great. Decided to upgrade the motion control with a timer interrupt and a look-ahead buffer.

I use FrequencyTimer2 to run the motion control code on timer2. While that's going on I'm sending the occasional string to the Arduino through serial at 57600 baud. (Buffering new commands.) Where I used to have flawless serial connection I'm now losing a random character or two. I can only assume it has something to do with the interrupt.

In a related issue, the Arduino now enjoys hanging if I use too many Serial.print(), especially if they're in the interrupt method.

In a related issue, when the Arduino hangs the PC often emits a tone from the speaker.

I'm sorry I don't have a simplified test case. I'm sorry for making this more difficult.

Yes, you are quite likely overloading the CPU, doing too much in an interrupt context, so there's not enough time to service the serial driver interrupts. Also, the serial driver interrupts probably lock out your timer interrupt function at times, too.

You really should do almost nothing in an interrupt function. Set a flag, and the pick up that flag in your loop() function, for the best sharing of time/resources. Beware, though, that long print() statements on the serial port will lock out other code from running for a while, so they will introduce jitter. Try sending only short codes for debug status.

I've tested my interrupt loop, it's 400-600us long. I'm calling the interrupt every 1000us, leaving 400us for other activity. I can't put even a single Serial.print("A") in the interrupt, even though in my tests that only lengthens the time to 640us. If interrupt call B happens while call A is still running then call B is returned ASAP so they shouldn't screw with each other.

In what might be a related issue, I'm having trouble uploading to the arduino - 3 out of 4 tries will checksum fail.

Any ideas?

The first few Serial.print("A") will add only a little bit, because that just copies the data into the outgoing buffer.
However, when that buffer fills up, the print() call will block until there is enough space in the buffer, which is going to be a lot longer than just sending a single letter.
When you send one letter at 56700 bps at 8N1 serial format, that's 176 microseconds per letter.
Also, the AVR cannot "do one interrupt" while "doing another interrupt" -- the next interrupt will be queued until the first interrupt is complete.

Finally, it sounds as if you may be having a bad cable or interference of some sort. Is this using a Duemilanove or an Uno? (e g, is the serial receiver the PC, or the USB chip of the Arduino?)