Software serial issues

Hi all,

I am using the arduino built in software serial library to read a second Serial port where a GPS device is attached.
The GPS information is internally updated every 5 seconds, however the receiver sends data once a second, which, even tough it is not being used, is making the code, including interrupts, lag significantly given the way the library works (interrupt based).

So my question is if one could disable the software serial or associated interrupts each time data is received while I am not listening to the serial port or if there is any other alternative that doesn't have the above issues?

Thanks

I am confused. Is something coming in the GPS port during the 5 seconds when GPS information is not being updated?

So my question is: can I disable the software serial while not needed?

There is no need to. When there is no incoming data, the SoftwareSerial interrupts don't do anything, so they don't take much time.

If time REALLY is an issue, get the right hardware.

vaj4088:
I am confused. Is something coming in the GPS port during the 5 seconds when GPS information is not being updated?

Yes, if you are only decoding a few of the messages and ignoring the message types that you're not interested in. The NMEA stream from a typical GPS device is very busy.

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

You can also turn the pin change interrupts on and off. See the Data Sheet for whatever micro you are using.

casemod:
I am implementing a software serial library to read a GPS port.

Does this mean you are writing your own software serial library ?

You have been using the Forum for long enough now to know to post your code without having to be asked for it.

...R

Can you not configure the GPS to send only the messages required ?

I re-wrote the question, to make it look more logical if someone has a similar issue.

tf68:
AltSoftSerial Library, for an extra serial port

You can also turn the pin change interrupts on and off. See the Data Sheet for whatever micro you are using.

tf68l, those are two excellent suggestions. I ended up using Paul's Altsoftserial and the issues are gone. Interrupts perform as they should and the whole code doesn't lag each time the GPS receiver sends data to the arduino.