SoftwareSerial affects Time

Hello!
I am using SoftwareSerial library.
It is very useful and convenient.
But unfortunately it slows down the clock aproximately 1 hour per day.
I suppose, that the reason is that it stops interrupts, that timer uses to calculate current time.
Please, suggest me how to solve this problem.
Thank you!

Increase the baud rate. The risk is a higher incidence of corrupt data.

Upgrade to a "bigger" board. Something with a processor from the ATmega1280 or ATmega644 family.

If you need to keep fairly accurate time you might want to invest in an RTC chip. The Arduino UNO only has a ceramic resonator so it does not make a very good clock.

Really? What's going on?

A higher baud rate equates to much less time spent in the interrupt service routine which reduces the chance of an overrun and the amount of overrun if one occurs. (I'm assuming @miclmr's diagnosis is correct.)

The "bigger" boards have more than one serial port eliminating the need for SoftwareSerial.

@miclmr: Are you using the SoftwareSerial that comes with Arduino 1.0?

slowing down with 1 hour/day is 4% of the time, sounds like not so much communication.

Are there other things in your sketch that could corrupt timers?
Please post your code.

You could use my AltSoftSerial library. It's designed to minimize interrupt latency, so it plays nicely with other interrupt-based functions.

http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html

Sadly, very few people know about AltSoftSerial. If it solves your problems, please help spread the word.....

I am gonna give it a try this afternoon ...

Makes sense, just hadn't considered it or had it happen. Maybe I never drove Software Serial hard enough. OTOH, I might not have missed a few millis() here and there :wink:

That's the problem with milliseconds. How can you tell if a few are missing?

Pin Change Interrupts are higher priority than the Timer Overflow Interrupts so it's possible for SoftwareSerial to essentially starve the rest of the program of CPU time.

They add up.....