Hello,
I'm using Arduino MEGA to read data from a GPS module (http://www.nooelec.com/files/SKM53_Datasheet.pdf). I'm using SoftwareSerial to receive data from the module through pin 10, using a baud rate of 9600 (default for this module). Everything works fine at 16MHz.
I want to consume the least amount of power possible, so my battery will last longer. For this, I want to reduce the clock speed. The problem is that if I use a prescaling of 16 to reduce the clock speed to 1MHz, I get some garbled data using SoftwareSerial, while if I use any of the USART pins I get the correct data.
Can anybody help me understand what's going on?
My code is below:
#include <SoftwareSerial.h>
#include <avr/power.h>
SoftwareSerial GPS(10,11);
void setup(){
Serial.begin(9600);
clock_prescale_set (clock_div_16);
GPS.begin(9600);
}
void loop(){
if(GPS.available())
Serial.print((char)GPS.read());
}
And here is some example of garbled data:
$GP,2,,8,,2PIb‚’š)’b5ÔnÂbb‚b‚‚G¢‚,20,
$GhGGA,141546.000,6,,,0,2,,,M,,M,649