Is it possible to change the baud rate of a serial port after it's been initialized?
I'm reading a GPS module from a Mega, and I have had to change the data rate from it's default to something faster. When I first got the GPS unit of the box, I wrote a very very short sketch to talk to the GPS (at it's default speed) to change the configuration to it's new, faster rate. Then I can reload the mega with my actual sketch and it will happily communicate at a higher speed.
So far so good.
Since then the internal battery on the GPS seems to have failed. This appears to mean that even after a momentary break in the power it looses it's configuration and returns to it's defaults.
What I'd like to do is write a sketch that will talk to the GPS at 9600, send the commands to change the speed to 57600, and then reconfigure the mega's port to change it's own bit rate to 57600. I need to be able to do this in a single sketch, is this possible?
Before anyone asks, I don't know the make/model of the GPS module, and can't spot anything that looks like a battery - so replacing it might be problematic!